diff --git a/dhis-2/dhis-test-e2e/src/test/java/org/hisp/dhis/analytics/generator/scenarios/tracked-entity-query.json b/dhis-2/dhis-test-e2e/src/test/java/org/hisp/dhis/analytics/generator/scenarios/tracked-entity-query.json index 70df3c2e875b..5cd5c698060c 100644 --- a/dhis-2/dhis-test-e2e/src/test/java/org/hisp/dhis/analytics/generator/scenarios/tracked-entity-query.json +++ b/dhis-2/dhis-test-e2e/src/test/java/org/hisp/dhis/analytics/generator/scenarios/tracked-entity-query.json @@ -9,7 +9,7 @@ }, { "name": "sortByTeDateAsc", - "query": "/api/analytics/trackedEntities/query/nEenWmSyUEp.json?dimension=ou:USER_ORGUNIT,gHGyrwKPzej,ciq2USN94oJ,cejWyOfXge6,IpHINAT79UW.A03MvHHogjR.bx6fsa0t90x,IpHINAT79UW.A03MvHHogjR.a3kGcGDCuk6&headers=ouname,gHGyrwKPzej,ciq2USN94oJ,cejWyOfXge6,IpHINAT79UW.A03MvHHogjR.bx6fsa0t90x,IpHINAT79UW.A03MvHHogjR.a3kGcGDCuk6,created&totalPages=false&rowContext=true&created=YESTERDAY&displayProperty=NAME&pageSize=100&page=1&includeMetadataDetails=true&asc=created&relativePeriodDate=2017-01-27", + "query": "/api/analytics/trackedEntities/query/nEenWmSyUEp.json?dimension=ou:USER_ORGUNIT,gHGyrwKPzej,ciq2USN94oJ,cejWyOfXge6,IpHINAT79UW.A03MvHHogjR.bx6fsa0t90x,IpHINAT79UW.A03MvHHogjR.a3kGcGDCuk6&headers=ouname,gHGyrwKPzej,ciq2USN94oJ,cejWyOfXge6,IpHINAT79UW.A03MvHHogjR.bx6fsa0t90x,IpHINAT79UW.A03MvHHogjR.a3kGcGDCuk6,created&totalPages=false&rowContext=true&created=YESTERDAY&displayProperty=NAME&pageSize=10&page=1&includeMetadataDetails=true&asc=created&relativePeriodDate=2017-01-27", "version": { "min": 41 } @@ -51,7 +51,7 @@ }, { "name": "sortByEnrollmentDateAscMultiProgram", - "query": "/api/analytics/trackedEntities/query/nEenWmSyUEp.json?dimension=ou:USER_ORGUNIT,cejWyOfXge6,w75KJ2mc4zz,IpHINAT79UW.A03MvHHogjR.a3kGcGDCuk6,ur1Edk5Oe2n.EPEcjy3FWmI.fTZFU8cWvb3&headers=ouname,cejWyOfXge6,w75KJ2mc4zz,IpHINAT79UW.A03MvHHogjR.a3kGcGDCuk6,IpHINAT79UW.ouname,ur1Edk5Oe2n.EPEcjy3FWmI.fTZFU8cWvb3,ur1Edk5Oe2n.enrollmentdate&totalPages=false&rowContext=true&enrollmentDate=ur1Edk5Oe2n.LAST_12_MONTHS,ur1Edk5Oe2n.LAST_5_YEARS&displayProperty=NAME&pageSize=30&page=1&includeMetadataDetails=true&asc=ur1Edk5Oe2n.enrollmentdate&relativePeriodDate=2022-01-27", + "query": "/api/analytics/trackedEntities/query/nEenWmSyUEp.json?dimension=ou:USER_ORGUNIT,cejWyOfXge6,w75KJ2mc4zz,IpHINAT79UW.A03MvHHogjR.a3kGcGDCuk6,ur1Edk5Oe2n.EPEcjy3FWmI.fTZFU8cWvb3&headers=ouname,cejWyOfXge6,w75KJ2mc4zz,IpHINAT79UW.A03MvHHogjR.a3kGcGDCuk6,IpHINAT79UW.ouname,ur1Edk5Oe2n.EPEcjy3FWmI.fTZFU8cWvb3,ur1Edk5Oe2n.enrollmentdate&totalPages=false&rowContext=true&enrollmentDate=ur1Edk5Oe2n.LAST_12_MONTHS,ur1Edk5Oe2n.LAST_5_YEARS&displayProperty=NAME&pageSize=30&page=1&includeMetadataDetails=true&asc=ur1Edk5Oe2n.enrollmentdate&relativePeriodDate=2028-01-27", "version": { "min": 41 } @@ -86,7 +86,7 @@ }, { "name": "singleOrgUnitLongitudeAsc", - "query": "/api/analytics/trackedEntities/query/nEenWmSyUEp.json?dimension=ou:jNb63DIHuwU,RG7uGl4w5Jq,lw1SqmMlnfh:GT:180&headers=ouname,RG7uGl4w5Jq,lw1SqmMlnfh&totalPages=false&rowContext=true&displayProperty=NAME&pageSize=100&page=1&includeMetadataDetails=true&asc=RG7uGl4w5Jq&relativePeriodDate=2024-06-13", + "query": "/api/analytics/trackedEntities/query/nEenWmSyUEp.json?includeMetadataDetails=true&dimension=ou:ImspTQPwCqd,RG7uGl4w5Jq,lw1SqmMlnfh:GE:190&headers=ouname,RG7uGl4w5Jq,lw1SqmMlnfh&totalPages=false&rowContext=true&displayProperty=NAME&pageSize=100&page=1&includeMetadataDetails=true&asc=RG7uGl4w5Jq&relativePeriodDate=2024-06-13", "version": { "min": 41 } @@ -128,7 +128,28 @@ }, { "name": "financialYear2018Sep", - "query": "/api/42/analytics/trackedEntities/query/Zy2SEgA61ys?dimension=ou:USER_ORGUNIT,B6TnnFMgmCk&headers=ouname,B6TnnFMgmCk,created&totalPages=false&rowContext=true&created=2018Sep&displayProperty=NAME&pageSize=100&page=1&includeMetadataDetails=true", + "query": "/api/42/analytics/trackedEntities/query/Zy2SEgA61ys.json?dimension=ou:USER_ORGUNIT,B6TnnFMgmCk&headers=ouname,B6TnnFMgmCk,created&totalPages=false&rowContext=true&created=2018Sep&displayProperty=NAME&pageSize=100&page=1&includeMetadataDetails=true", + "version": { + "min": 42 + } + }, + { + "name": "queryWithProgramAndEnrollmentDateAndNegativeEnrollmentOffset", + "query": "/api/analytics/trackedEntities/query/nEenWmSyUEp.json?program=IpHINAT79UW&enrollmentDate=IpHINAT79UW[1].LAST_YEAR&desc=lastupdated&relativePeriodDate=2023-04-03&headers=ouname,w75KJ2mc4zz,zDhUuAYrxNC", + "version": { + "min": 42 + } + }, + { + "name": "queryWithProgramAndFilterByEnrollmentDate", + "query": "/api/analytics/trackedEntities/query/nEenWmSyUEp.json?program=IpHINAT79UW&enrollmentDate=IpHINAT79UW.LAST_5_YEARS&desc=lastupdated&relativePeriodDate=2023-09-27&headers=trackedentity,lastupdated,createdbydisplayname,lastupdatedbydisplayname,geometry,longitude,latitude,ouname,oucode,ounamehierarchy,w75KJ2mc4zz,zDhUuAYrxNC,cejWyOfXge6,lZGmxYbs97q", + "version": { + "min": 42 + } + }, + { + "name": "queryWithProgramAndPagination", + "query": "/api/analytics/trackedEntities/query/nEenWmSyUEp.json?program=IpHINAT79UW&lastUpdated=LAST_10_YEARS&pageSize=10&totalPages=true&asc=lastupdated&relativePeriodDate=2022-09-27&headers=trackedentity,lastupdated,createdbydisplayname,lastupdatedbydisplayname,geometry,longitude,latitude,ouname,oucode,ounamehierarchy,w75KJ2mc4zz,zDhUuAYrxNC,cejWyOfXge6,lZGmxYbs97q", "version": { "min": 42 } diff --git a/dhis-2/dhis-test-e2e/src/test/java/org/hisp/dhis/analytics/trackedentity/TrackedEntityQuery3AutoTest.java b/dhis-2/dhis-test-e2e/src/test/java/org/hisp/dhis/analytics/trackedentity/TrackedEntityQuery3AutoTest.java index c369b42417ee..818c66163ab6 100644 --- a/dhis-2/dhis-test-e2e/src/test/java/org/hisp/dhis/analytics/trackedentity/TrackedEntityQuery3AutoTest.java +++ b/dhis-2/dhis-test-e2e/src/test/java/org/hisp/dhis/analytics/trackedentity/TrackedEntityQuery3AutoTest.java @@ -755,10 +755,9 @@ public void sortByTeDateAsc() throws JSONException { QueryParamsBuilder params = new QueryParamsBuilder() .add("includeMetadataDetails=true") - .add("asc=created") .add( "headers=ouname,gHGyrwKPzej,ciq2USN94oJ,cejWyOfXge6,IpHINAT79UW.A03MvHHogjR.bx6fsa0t90x,IpHINAT79UW.A03MvHHogjR.a3kGcGDCuk6,created") - .add("created=YESTERDAY") + .add("created=LAST_YEAR") .add("displayProperty=NAME") .add("totalPages=false") .add("rowContext=true") @@ -766,7 +765,8 @@ public void sortByTeDateAsc() throws JSONException { .add("page=1") .add( "dimension=ou:USER_ORGUNIT,gHGyrwKPzej,ciq2USN94oJ,cejWyOfXge6,IpHINAT79UW.A03MvHHogjR.bx6fsa0t90x,IpHINAT79UW.A03MvHHogjR.a3kGcGDCuk6") - .add("relativePeriodDate=2017-01-27"); + .add("desc=created") + .add("relativePeriodDate=2018-01-28"); // When ApiResponse response = actions.query().get("nEenWmSyUEp", JSON, JSON, params); @@ -783,7 +783,7 @@ public void sortByTeDateAsc() throws JSONException { // Assert metaData. String expectedMetaData = - "{\"pager\":{\"page\":1,\"pageSize\":100,\"isLastPage\":false},\"items\":{\"IpHINAT79UW.A03MvHHogjR.a3kGcGDCuk6\":{\"uid\":\"a3kGcGDCuk6\",\"code\":\"DE_2006098\",\"name\":\"MCH Apgar Score\",\"description\":\"Apgar is a quick test performed on a baby at 1 and 5 minutes after birth. The 1-minute score determines how well the baby tolerated the birthing process. The 5-minute score tells the doctor how well the baby is doing outside the mother's womb.\",\"dimensionItemType\":\"DATA_ELEMENT\",\"valueType\":\"NUMBER\",\"aggregationType\":\"AVERAGE\",\"totalAggregationType\":\"SUM\"},\"bx6fsa0t90x\":{\"uid\":\"bx6fsa0t90x\",\"code\":\"DE_2006101\",\"name\":\"MCH BCG dose\",\"dimensionItemType\":\"DATA_ELEMENT\",\"valueType\":\"BOOLEAN\",\"aggregationType\":\"SUM\",\"totalAggregationType\":\"SUM\"},\"IpHINAT79UW\":{\"uid\":\"IpHINAT79UW\",\"name\":\"Child Programme\"},\"ciq2USN94oJ\":{\"uid\":\"ciq2USN94oJ\",\"code\":\"MMD_PER_STA\",\"name\":\"Civil status\",\"description\":\"Civil status\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"ou\":{\"uid\":\"ou\",\"name\":\"Organisation unit\",\"dimensionType\":\"ORGANISATION_UNIT\"},\"USER_ORGUNIT\":{\"organisationUnits\":[\"ImspTQPwCqd\"]},\"YESTERDAY\":{\"name\":\"Yesterday\"},\"20170126\":{\"uid\":\"20170126\",\"code\":\"20170126\",\"name\":\"2017-01-26\",\"dimensionItemType\":\"PERIOD\",\"valueType\":\"TEXT\",\"totalAggregationType\":\"SUM\",\"startDate\":\"2017-01-26T00:00:00.000\",\"endDate\":\"2017-01-26T00:00:00.000\"},\"a3kGcGDCuk6\":{\"uid\":\"a3kGcGDCuk6\",\"code\":\"DE_2006098\",\"name\":\"MCH Apgar Score\",\"description\":\"Apgar is a quick test performed on a baby at 1 and 5 minutes after birth. The 1-minute score determines how well the baby tolerated the birthing process. The 5-minute score tells the doctor how well the baby is doing outside the mother's womb.\",\"dimensionItemType\":\"DATA_ELEMENT\",\"valueType\":\"NUMBER\",\"aggregationType\":\"AVERAGE\",\"totalAggregationType\":\"SUM\"},\"cejWyOfXge6\":{\"uid\":\"cejWyOfXge6\",\"name\":\"Gender\",\"description\":\"Gender\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"gHGyrwKPzej\":{\"uid\":\"gHGyrwKPzej\",\"code\":\"MMD_PER_DOB\",\"name\":\"Birth date\",\"description\":\"Birth date\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"DATE\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"ImspTQPwCqd\":{\"uid\":\"ImspTQPwCqd\",\"code\":\"OU_525\",\"name\":\"Sierra Leone\",\"dimensionItemType\":\"ORGANISATION_UNIT\",\"valueType\":\"TEXT\",\"totalAggregationType\":\"SUM\"},\"IpHINAT79UW.A03MvHHogjR.bx6fsa0t90x\":{\"uid\":\"bx6fsa0t90x\",\"code\":\"DE_2006101\",\"name\":\"MCH BCG dose\",\"dimensionItemType\":\"DATA_ELEMENT\",\"valueType\":\"BOOLEAN\",\"aggregationType\":\"SUM\",\"totalAggregationType\":\"SUM\"},\"pe\":{\"uid\":\"pe\",\"name\":\"Period\",\"dimensionType\":\"PERIOD\"},\"A03MvHHogjR\":{\"uid\":\"A03MvHHogjR\",\"name\":\"Birth\",\"description\":\"Birth of the baby\"},\"ouname\":{\"name\":\"Organisation Unit Name\",\"dimensionType\":\"ORGANISATION_UNIT\"}},\"dimensions\":{\"zDhUuAYrxNC\":[],\"lw1SqmMlnfh\":[],\"bx6fsa0t90x\":[],\"Qo571yj6Zcn\":[],\"DODgdr5Oo2v\":[],\"iESIqZ0R0R0\":[],\"n9nUvfpTsxQ\":[],\"kyIzQsj96BD\":[],\"xs8A6tQJY0s\":[],\"A4xFHyieXys\":[],\"OvY4VVhSDeJ\":[],\"RG7uGl4w5Jq\":[],\"spFvx9FndA4\":[],\"GUOBQt5K2WI\":[],\"Agywv2JGwuq\":[],\"lZGmxYbs97q\":[],\"VqEFza8wbwA\":[],\"ciq2USN94oJ\":[],\"ou\":[\"ImspTQPwCqd\"],\"w75KJ2mc4zz\":[],\"KmEUg2hHEtx\":[],\"G7vUx908SwP\":[],\"o9odfev2Ty5\":[],\"a3kGcGDCuk6\":[],\"FO4sWYJ64LQ\":[],\"NDXw0cluzSw\":[],\"ruQQnf6rswq\":[],\"cejWyOfXge6\":[],\"P2cwLGskgxn\":[],\"gHGyrwKPzej\":[],\"pe\":[\"20170126\"],\"VHfUeXpawmE\":[],\"AuPLng5hLbE\":[],\"ZcBPrXKahq2\":[],\"H9IlTX2X6SL\":[]}}"; + "{\"pager\":{\"page\":1,\"pageSize\":100,\"isLastPage\":false},\"items\":{\"zDhUuAYrxNC\":{\"uid\":\"zDhUuAYrxNC\",\"name\":\"Last name\",\"description\":\"Last name\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"lw1SqmMlnfh\":{\"uid\":\"lw1SqmMlnfh\",\"code\":\"Height in cm\",\"name\":\"Height in cm\",\"description\":\"Height in cm\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"NUMBER\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"IpHINAT79UW.A03MvHHogjR.a3kGcGDCuk6\":{\"uid\":\"a3kGcGDCuk6\",\"code\":\"DE_2006098\",\"name\":\"MCH Apgar Score\",\"description\":\"Apgar is a quick test performed on a baby at 1 and 5 minutes after birth. The 1-minute score determines how well the baby tolerated the birthing process. The 5-minute score tells the doctor how well the baby is doing outside the mother's womb.\",\"dimensionItemType\":\"DATA_ELEMENT\",\"valueType\":\"NUMBER\",\"aggregationType\":\"AVERAGE\",\"totalAggregationType\":\"SUM\"},\"bx6fsa0t90x\":{\"uid\":\"bx6fsa0t90x\",\"code\":\"DE_2006101\",\"name\":\"MCH BCG dose\",\"dimensionItemType\":\"DATA_ELEMENT\",\"valueType\":\"BOOLEAN\",\"aggregationType\":\"SUM\",\"totalAggregationType\":\"SUM\"},\"fDd25txQckK\":{\"uid\":\"fDd25txQckK\",\"name\":\"Provider Follow-up and Support Tool\"},\"DODgdr5Oo2v\":{\"uid\":\"DODgdr5Oo2v\",\"code\":\"Provider ID\",\"name\":\"Provider ID\",\"description\":\"Provider ID\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"Qo571yj6Zcn\":{\"uid\":\"Qo571yj6Zcn\",\"code\":\"Latitude\",\"name\":\"Latitude\",\"description\":\"Latitude\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"iESIqZ0R0R0\":{\"uid\":\"iESIqZ0R0R0\",\"name\":\"Date of birth\",\"description\":\"Date of birth\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"DATE\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"n9nUvfpTsxQ\":{\"uid\":\"n9nUvfpTsxQ\",\"code\":\"Zip code\",\"name\":\"Zip code\",\"description\":\"Zip code\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"NUMBER\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"kyIzQsj96BD\":{\"uid\":\"kyIzQsj96BD\",\"code\":\"Company\",\"name\":\"Company\",\"description\":\"Company\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"A4xFHyieXys\":{\"uid\":\"A4xFHyieXys\",\"code\":\"Occupation\",\"name\":\"Occupation\",\"description\":\"Occupation\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"xs8A6tQJY0s\":{\"uid\":\"xs8A6tQJY0s\",\"name\":\"TB identifier\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"ImspTQPwCqd\":{\"uid\":\"ImspTQPwCqd\",\"code\":\"OU_525\",\"name\":\"Sierra Leone\",\"dimensionItemType\":\"ORGANISATION_UNIT\",\"valueType\":\"TEXT\",\"totalAggregationType\":\"SUM\"},\"OvY4VVhSDeJ\":{\"uid\":\"OvY4VVhSDeJ\",\"name\":\"Weight in kg\",\"description\":\"Weight in kg\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"NUMBER\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"IpHINAT79UW.A03MvHHogjR.bx6fsa0t90x\":{\"uid\":\"bx6fsa0t90x\",\"code\":\"DE_2006101\",\"name\":\"MCH BCG dose\",\"dimensionItemType\":\"DATA_ELEMENT\",\"valueType\":\"BOOLEAN\",\"aggregationType\":\"SUM\",\"totalAggregationType\":\"SUM\"},\"ur1Edk5Oe2n\":{\"uid\":\"ur1Edk5Oe2n\",\"name\":\"TB program\"},\"A03MvHHogjR\":{\"uid\":\"A03MvHHogjR\",\"name\":\"Birth\",\"description\":\"Birth of the baby\"},\"RG7uGl4w5Jq\":{\"uid\":\"RG7uGl4w5Jq\",\"code\":\"Longitude\",\"name\":\"Longitude\",\"description\":\"Longitude\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"LAST_YEAR\":{\"name\":\"Last year\"},\"spFvx9FndA4\":{\"uid\":\"spFvx9FndA4\",\"name\":\"Age\",\"description\":\"Age\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"DATE\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"Agywv2JGwuq\":{\"uid\":\"Agywv2JGwuq\",\"code\":\"MMD_PER_MOB\",\"name\":\"Mobile number\",\"description\":\"Mobile number\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"GUOBQt5K2WI\":{\"uid\":\"GUOBQt5K2WI\",\"code\":\"State\",\"name\":\"State\",\"description\":\"State\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"lZGmxYbs97q\":{\"uid\":\"lZGmxYbs97q\",\"code\":\"MMD_PER_ID\",\"name\":\"Unique ID\",\"description\":\"Unique identiifer\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"VqEFza8wbwA\":{\"uid\":\"VqEFza8wbwA\",\"code\":\"MMD_PER_ADR1\",\"name\":\"Address\",\"description\":\"Country\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"AVERAGE\",\"totalAggregationType\":\"SUM\"},\"IpHINAT79UW\":{\"uid\":\"IpHINAT79UW\",\"name\":\"Child Programme\"},\"ciq2USN94oJ\":{\"uid\":\"ciq2USN94oJ\",\"code\":\"MMD_PER_STA\",\"name\":\"Civil status\",\"description\":\"Civil status\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"ou\":{\"uid\":\"ou\",\"name\":\"Organisation unit\",\"dimensionType\":\"ORGANISATION_UNIT\"},\"w75KJ2mc4zz\":{\"uid\":\"w75KJ2mc4zz\",\"code\":\"MMD_PER_NAM\",\"name\":\"First name\",\"description\":\"First name\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"KmEUg2hHEtx\":{\"uid\":\"KmEUg2hHEtx\",\"name\":\"Email address\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"USER_ORGUNIT\":{\"organisationUnits\":[\"ImspTQPwCqd\"]},\"G7vUx908SwP\":{\"uid\":\"G7vUx908SwP\",\"name\":\"Residence location\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"COORDINATE\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"o9odfev2Ty5\":{\"uid\":\"o9odfev2Ty5\",\"code\":\"Mother maiden name\",\"name\":\"Mother maiden name\",\"description\":\"Mother maiden name\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"a3kGcGDCuk6\":{\"uid\":\"a3kGcGDCuk6\",\"code\":\"DE_2006098\",\"name\":\"MCH Apgar Score\",\"description\":\"Apgar is a quick test performed on a baby at 1 and 5 minutes after birth. The 1-minute score determines how well the baby tolerated the birthing process. The 5-minute score tells the doctor how well the baby is doing outside the mother's womb.\",\"dimensionItemType\":\"DATA_ELEMENT\",\"valueType\":\"NUMBER\",\"aggregationType\":\"AVERAGE\",\"totalAggregationType\":\"SUM\"},\"FO4sWYJ64LQ\":{\"uid\":\"FO4sWYJ64LQ\",\"code\":\"City\",\"name\":\"City\",\"description\":\"City\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"NDXw0cluzSw\":{\"uid\":\"NDXw0cluzSw\",\"name\":\"Email\",\"description\":\"Email address\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"ruQQnf6rswq\":{\"uid\":\"ruQQnf6rswq\",\"name\":\"TB number\",\"description\":\"TB number\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"cejWyOfXge6\":{\"uid\":\"cejWyOfXge6\",\"name\":\"Gender\",\"description\":\"Gender\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"P2cwLGskgxn\":{\"uid\":\"P2cwLGskgxn\",\"name\":\"Phone number\",\"description\":\"Phone number\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"gHGyrwKPzej\":{\"uid\":\"gHGyrwKPzej\",\"code\":\"MMD_PER_DOB\",\"name\":\"Birth date\",\"description\":\"Birth date\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"DATE\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"2017\":{\"uid\":\"2017\",\"code\":\"2017\",\"name\":\"2017\",\"dimensionItemType\":\"PERIOD\",\"valueType\":\"TEXT\",\"totalAggregationType\":\"SUM\",\"startDate\":\"2017-01-01T00:00:00.000\",\"endDate\":\"2017-12-31T00:00:00.000\"},\"pe\":{\"uid\":\"pe\",\"name\":\"Period\",\"dimensionType\":\"PERIOD\"},\"uy2gU8kT1jF\":{\"uid\":\"uy2gU8kT1jF\",\"name\":\"MNCH / PNC (Adult Woman)\"},\"VHfUeXpawmE\":{\"uid\":\"VHfUeXpawmE\",\"code\":\"Vehicle\",\"name\":\"Vehicle\",\"description\":\"Vehicle\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"AuPLng5hLbE\":{\"uid\":\"AuPLng5hLbE\",\"code\":\"National identifier\",\"name\":\"National identifier\",\"description\":\"National identifier\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"ZcBPrXKahq2\":{\"uid\":\"ZcBPrXKahq2\",\"name\":\"Postal code\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"WSGAb5XwJ3Y\":{\"uid\":\"WSGAb5XwJ3Y\",\"name\":\"WHO RMNCH Tracker\"},\"H9IlTX2X6SL\":{\"uid\":\"H9IlTX2X6SL\",\"code\":\"Blood type\",\"name\":\"Blood type\",\"description\":\"Blood type\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"ouname\":{\"name\":\"Organisation Unit Name\",\"dimensionType\":\"ORGANISATION_UNIT\"}},\"dimensions\":{\"zDhUuAYrxNC\":[],\"lw1SqmMlnfh\":[],\"bx6fsa0t90x\":[],\"DODgdr5Oo2v\":[],\"Qo571yj6Zcn\":[],\"iESIqZ0R0R0\":[],\"n9nUvfpTsxQ\":[],\"kyIzQsj96BD\":[],\"A4xFHyieXys\":[],\"xs8A6tQJY0s\":[],\"OvY4VVhSDeJ\":[],\"RG7uGl4w5Jq\":[],\"spFvx9FndA4\":[],\"Agywv2JGwuq\":[],\"GUOBQt5K2WI\":[],\"lZGmxYbs97q\":[],\"VqEFza8wbwA\":[],\"ciq2USN94oJ\":[],\"ou\":[\"ImspTQPwCqd\"],\"w75KJ2mc4zz\":[],\"KmEUg2hHEtx\":[],\"G7vUx908SwP\":[],\"o9odfev2Ty5\":[],\"a3kGcGDCuk6\":[],\"FO4sWYJ64LQ\":[],\"NDXw0cluzSw\":[],\"ruQQnf6rswq\":[],\"cejWyOfXge6\":[],\"P2cwLGskgxn\":[],\"gHGyrwKPzej\":[],\"pe\":[\"2017\"],\"VHfUeXpawmE\":[],\"AuPLng5hLbE\":[],\"ZcBPrXKahq2\":[],\"H9IlTX2X6SL\":[]}}"; String actualMetaData = new JSONObject((Map) response.extract("metaData")).toString(); assertEquals(expectedMetaData, actualMetaData, false); @@ -816,639 +816,142 @@ public void sortByTeDateAsc() throws JSONException { validateHeader( response, 6, "created", "Created", "DATETIME", "java.time.LocalDateTime", false, true); - // Assert rows. + // Assert only 20 rows, as samples. validateRow( response, 0, - List.of( - "Kaliyereh MCHP", "1979-05-20 00:00:00.0", "", "", "", "", "2017-01-26 13:43:29.374")); + List.of("Blamawo MCHP", "1986-07-04 00:00:00.0", "", "", "", "", "2017-01-26 13:48:13.37")); validateRow( response, 1, List.of( - "Mapamurie MCHP", "1978-05-19 00:00:00.0", "", "", "", "", "2017-01-26 13:43:29.5")); + "Petifu Mayepoh MCHP", + "1972-05-03 00:00:00.0", + "", + "", + "", + "", + "2017-01-26 13:48:13.369")); validateRow( response, 2, - List.of("Bayama MCHP", "1974-08-09 00:00:00.0", "", "", "", "", "2017-01-26 13:43:29.513")); + List.of( + "Kondewakoro CHP", "1982-03-04 00:00:00.0", "", "", "", "", "2017-01-26 13:48:13.367")); validateRow( response, 3, - List.of( - "Semewebu MCHP", "1972-03-24 00:00:00.0", "", "", "", "", "2017-01-26 13:43:29.541")); + List.of("Mathen MCHP", "1987-01-28 00:00:00.0", "", "", "", "", "2017-01-26 13:48:13.365")); validateRow( response, 4, - List.of( - "Konta-Line MCHP", "1977-08-07 00:00:00.0", "", "", "", "", "2017-01-26 13:43:29.555")); + List.of("Mbokie CHP", "1981-03-21 00:00:00.0", "", "", "", "", "2017-01-26 13:48:13.363")); validateRow( response, 5, List.of( - "Kundorma CHP", "1989-04-08 00:00:00.0", "", "", "", "", "2017-01-26 13:43:29.569")); + "Kolisokor MCHP", "1988-01-18 00:00:00.0", "", "", "", "", "2017-01-26 13:48:13.36")); validateRow( response, 6, List.of( - "Mayogbor MCHP", "1984-06-26 00:00:00.0", "", "", "", "", "2017-01-26 13:43:29.583")); + "Grey Bush CHC", "1985-03-17 00:00:00.0", "", "", "", "", "2017-01-26 13:48:13.359")); validateRow( response, 7, List.of( - "Masofinia MCHP", "1978-12-27 00:00:00.0", "", "", "", "", "2017-01-26 13:43:29.592")); + "Dankawalia MCHP", "1978-03-30 00:00:00.0", "", "", "", "", "2017-01-26 13:48:13.357")); validateRow( response, 8, - List.of("Mabora MCHP", "1982-04-25 00:00:00.0", "", "", "", "", "2017-01-26 13:43:29.601")); - validateRow( - response, - 9, - List.of( - "Mayogbor MCHP", "1974-10-23 00:00:00.0", "", "", "", "", "2017-01-26 13:43:29.61")); - validateRow( - response, - 10, - List.of( - "Mayossoh MCHP", "1975-03-31 00:00:00.0", "", "", "", "", "2017-01-26 13:43:29.616")); - validateRow( - response, - 11, - List.of( - "Yankasa MCHP", "1972-03-22 00:00:00.0", "", "", "", "", "2017-01-26 13:43:29.619")); - validateRow( - response, - 12, - List.of("Sawuria CHP", "1975-02-24 00:00:00.0", "", "", "", "", "2017-01-26 13:43:29.625")); - validateRow( - response, - 13, - List.of( - "Baoma (Koya) CHC", - "1985-08-22 00:00:00.0", - "", - "", - "", - "", - "2017-01-26 13:43:29.632")); - validateRow( - response, - 14, - List.of( - "SLRCS (Nongowa) clinic", - "1987-05-07 00:00:00.0", - "", - "", - "", - "", - "2017-01-26 13:43:29.639")); - validateRow( - response, - 15, - List.of( - "Mabai (Kholifa Rowalla) MCHP", - "1974-04-02 00:00:00.0", - "", - "", - "", - "", - "2017-01-26 13:43:29.644")); - validateRow( - response, - 16, - List.of("Foakor MCHP", "1986-08-22 00:00:00.0", "", "", "", "", "2017-01-26 13:43:29.657")); - validateRow( - response, - 17, - List.of( - "Masimera CHC", "1979-11-24 00:00:00.0", "", "", "", "", "2017-01-26 13:43:29.667")); - validateRow( - response, - 18, - List.of("Worreh MCHP", "1988-06-13 00:00:00.0", "", "", "", "", "2017-01-26 13:43:29.674")); - validateRow( - response, - 19, - List.of( - "Konta-Line MCHP", "1979-02-16 00:00:00.0", "", "", "", "", "2017-01-26 13:43:29.68")); - validateRow( - response, - 20, - List.of("Dibia MCHP", "1973-12-26 00:00:00.0", "", "", "", "", "2017-01-26 13:43:29.687")); - validateRow( - response, - 21, - List.of( - "Taninahun MCHP", "1975-08-14 00:00:00.0", "", "", "", "", "2017-01-26 13:43:29.693")); - validateRow( - response, - 22, - List.of( - "Ngelehun MCHP", "1972-07-26 00:00:00.0", "", "", "", "", "2017-01-26 13:43:29.703")); - validateRow( - response, - 23, - List.of("Sendugu CHC", "1990-06-18 00:00:00.0", "", "", "", "", "2017-01-26 13:43:29.707")); - validateRow( - response, - 24, - List.of( - "Kondiama MCHP", "1988-06-22 00:00:00.0", "", "", "", "", "2017-01-26 13:43:29.713")); - validateRow( - response, - 25, - List.of("Gbentu CHP", "1990-11-08 00:00:00.0", "", "", "", "", "2017-01-26 13:43:29.719")); - validateRow( - response, - 26, - List.of( - "Potehun MCHP", "1971-10-04 00:00:00.0", "", "", "", "", "2017-01-26 13:43:29.722")); - validateRow( - response, - 27, - List.of( - "Koakoyima CHC", "1977-05-27 00:00:00.0", "", "", "", "", "2017-01-26 13:43:29.727")); - validateRow( - response, - 28, - List.of( - "Rogbangba MCHP", "1978-01-15 00:00:00.0", "", "", "", "", "2017-01-26 13:43:29.733")); - validateRow( - response, - 29, - List.of( - "Bendu Mameima CHC", - "1987-07-29 00:00:00.0", - "", - "", - "", - "", - "2017-01-26 13:43:29.737")); - validateRow( - response, - 30, - List.of("Quarry MCHP", "1978-11-19 00:00:00.0", "", "", "", "", "2017-01-26 13:43:29.746")); - validateRow( - response, - 31, - List.of( - "Rosengbeh MCHP", "1975-04-29 00:00:00.0", "", "", "", "", "2017-01-26 13:43:29.754")); - validateRow( - response, - 32, - List.of( - "Bandajuma Sinneh MCHP", - "1983-11-02 00:00:00.0", - "", - "", - "", - "", - "2017-01-26 13:43:29.758")); - validateRow( - response, - 33, - List.of( - "Sahn Bumpe MCHP", "1988-02-11 00:00:00.0", "", "", "", "", "2017-01-26 13:43:29.762")); - validateRow( - response, - 34, - List.of( - "Bandasuma CHP", "1982-06-14 00:00:00.0", "", "", "", "", "2017-01-26 13:43:29.768")); - validateRow( - response, - 35, - List.of("Manna MCHP", "1974-04-13 00:00:00.0", "", "", "", "", "2017-01-26 13:43:29.775")); - validateRow( - response, - 36, - List.of( - "Hill Station MCHP", - "1986-11-24 00:00:00.0", - "", - "", - "", - "", - "2017-01-26 13:43:29.781")); - validateRow( - response, - 37, - List.of("Kensay MCHP", "1989-10-02 00:00:00.0", "", "", "", "", "2017-01-26 13:43:29.785")); - validateRow( - response, - 38, - List.of("Mabom CHP", "1972-05-23 00:00:00.0", "", "", "", "", "2017-01-26 13:43:29.791")); - validateRow( - response, - 39, - List.of( - "Mamalikie MCHP", "1982-09-02 00:00:00.0", "", "", "", "", "2017-01-26 13:43:29.797")); - validateRow( - response, - 40, - List.of("Masory MCHP", "1979-11-12 00:00:00.0", "", "", "", "", "2017-01-26 13:43:29.802")); - validateRow( - response, - 41, - List.of( - "Hill Station MCHP", - "1983-02-11 00:00:00.0", - "", - "", - "", - "", - "2017-01-26 13:43:29.807")); - validateRow( - response, - 42, - List.of("Lowoma MCHP", "1978-12-31 00:00:00.0", "", "", "", "", "2017-01-26 13:43:29.81")); - validateRow( - response, - 43, - List.of( - "UFC Magburaka", "1984-07-12 00:00:00.0", "", "", "", "", "2017-01-26 13:43:29.816")); - validateRow( - response, - 44, - List.of( - "Fintonia CHC", "1971-12-09 00:00:00.0", "", "", "", "", "2017-01-26 13:43:29.823")); - validateRow( - response, - 45, - List.of( - "Kaimunday CHP", "1981-12-10 00:00:00.0", "", "", "", "", "2017-01-26 13:43:29.828")); - validateRow( - response, - 46, - List.of( - "Fulamansa MCHP", "1975-10-19 00:00:00.0", "", "", "", "", "2017-01-26 13:43:29.833")); - validateRow( - response, - 47, - List.of("Samaia MCHP", "1971-03-16 00:00:00.0", "", "", "", "", "2017-01-26 13:43:29.835")); - validateRow( - response, - 48, - List.of( - "Magbolonthor MCHP", - "1984-09-27 00:00:00.0", - "", - "", - "", - "", - "2017-01-26 13:43:29.839")); - validateRow( - response, - 49, - List.of( - "Gondama MCHP", "1977-03-27 00:00:00.0", "", "", "", "", "2017-01-26 13:43:29.843")); - validateRow( - response, - 50, - List.of( - "Kamiendor MCHP", "1972-06-19 00:00:00.0", "", "", "", "", "2017-01-26 13:43:29.847")); - validateRow( - response, - 51, - List.of("Kaniya MCHP", "1979-05-12 00:00:00.0", "", "", "", "", "2017-01-26 13:43:29.851")); - validateRow( - response, - 52, - List.of( - "Kpandebu CHP", "1977-02-20 00:00:00.0", "", "", "", "", "2017-01-26 13:43:29.855")); - validateRow( - response, - 53, - List.of( - "Tambiama CHC", "1987-06-05 00:00:00.0", "", "", "", "", "2017-01-26 13:43:29.859")); - validateRow( - response, - 54, List.of( - "Levuma (Kandu Lep) CHC", - "1983-08-28 00:00:00.0", - "", - "", - "", - "", - "2017-01-26 13:43:29.867")); - validateRow( - response, - 55, - List.of("Rokonta CHC", "1971-12-24 00:00:00.0", "", "", "", "", "2017-01-26 13:43:29.873")); - validateRow( - response, - 56, - List.of( - "Kangama (Kangama) CHP", - "1971-08-03 00:00:00.0", - "", - "", - "", - "", - "2017-01-26 13:43:29.875")); - validateRow( - response, - 57, - List.of( - "Sellah Kafta MCHP", - "1971-09-03 00:00:00.0", - "", - "", - "", - "", - "2017-01-26 13:43:29.881")); - validateRow( - response, - 58, - List.of( - "Heremakono MCHP", "1987-11-02 00:00:00.0", "", "", "", "", "2017-01-26 13:43:29.885")); - validateRow( - response, - 59, - List.of("Tobanda CHC", "1990-04-15 00:00:00.0", "", "", "", "", "2017-01-26 13:43:29.889")); - validateRow( - response, - 60, - List.of("Yabaima CHP", "1970-02-25 00:00:00.0", "", "", "", "", "2017-01-26 13:43:29.894")); - validateRow( - response, - 61, - List.of( - "Kasongha MCHP", "1977-02-13 00:00:00.0", "", "", "", "", "2017-01-26 13:43:29.902")); - validateRow( - response, - 62, - List.of( - "Benguema MI Room", - "1989-07-02 00:00:00.0", - "", - "", - "", - "", - "2017-01-26 13:43:29.907")); - validateRow( - response, - 63, - List.of( - "Govt. Hosp. Makeni", - "1985-04-11 00:00:00.0", - "", - "", - "", - "", - "2017-01-26 13:43:29.91")); - validateRow( - response, - 64, - List.of("Rokulan CHC", "1989-10-27 00:00:00.0", "", "", "", "", "2017-01-26 13:43:29.914")); - validateRow( - response, - 65, - List.of( - "Blamawo MCHP", "1979-12-28 00:00:00.0", "", "", "", "", "2017-01-26 13:43:29.919")); - validateRow( - response, - 66, - List.of( - "Mano Menima CHP", "1980-08-14 00:00:00.0", "", "", "", "", "2017-01-26 13:43:29.923")); - validateRow( - response, - 67, - List.of("UNIMUS MCHP", "1986-02-06 00:00:00.0", "", "", "", "", "2017-01-26 13:43:29.928")); - validateRow( - response, - 68, - List.of( - "Koidu Under Five Clinic", - "1974-05-16 00:00:00.0", - "", - "", - "", - "", - "2017-01-26 13:43:29.932")); - validateRow( - response, - 69, - List.of( - "Leicester (RWA) CHP", - "1978-02-28 00:00:00.0", - "", - "", - "", - "", - "2017-01-26 13:43:29.937")); - validateRow( - response, - 70, - List.of( - "Wilberforce CHC", "1985-07-07 00:00:00.0", "", "", "", "", "2017-01-26 13:43:29.942")); - validateRow( - response, - 71, - List.of("Vaahun MCHP", "1985-06-08 00:00:00.0", "", "", "", "", "2017-01-26 13:43:29.948")); - validateRow( - response, - 72, - List.of("Gbamani CHP", "1980-12-08 00:00:00.0", "", "", "", "", "2017-01-26 13:43:29.954")); - validateRow( - response, - 73, - List.of( - "Kanekor MCHP", "1988-12-24 00:00:00.0", "", "", "", "", "2017-01-26 13:43:29.958")); - validateRow( - response, - 74, - List.of( - "Kpowubu MCHP", "1978-06-10 00:00:00.0", "", "", "", "", "2017-01-26 13:43:29.962")); - validateRow( - response, - 75, - List.of("Mbaoma CHP", "1971-10-28 00:00:00.0", "", "", "", "", "2017-01-26 13:43:29.966")); - validateRow( - response, - 76, - List.of( - "Nomo Faama CHP", "1990-08-16 00:00:00.0", "", "", "", "", "2017-01-26 13:43:29.971")); - validateRow( - response, - 77, - List.of("Rotawa CHP", "1984-03-01 00:00:00.0", "", "", "", "", "2017-01-26 13:43:29.978")); - validateRow( - response, - 78, - List.of("Bumbeh MCHP", "1979-02-15 00:00:00.0", "", "", "", "", "2017-01-26 13:43:29.982")); - validateRow( - response, - 79, - List.of( - "Baoma (Luawa) MCHP", - "1985-06-23 00:00:00.0", - "", - "", - "", - "", - "2017-01-26 13:43:29.99")); - validateRow( - response, - 80, - List.of( - "Maharie MCHP", "1979-03-17 00:00:00.0", "", "", "", "", "2017-01-26 13:43:29.995")); - validateRow( - response, - 81, - List.of("Bafodia CHC", "1979-05-31 00:00:00.0", "", "", "", "", "2017-01-26 13:43:30.003")); - validateRow( - response, - 82, - List.of( - "Bundulai MCHP", "1971-01-29 00:00:00.0", "", "", "", "", "2017-01-26 13:43:30.009")); - validateRow( - response, - 83, - List.of( - "Gbahama (P. Bongre) CHP", - "1985-11-26 00:00:00.0", - "", - "", - "", - "", - "2017-01-26 13:43:30.014")); - validateRow( - response, - 84, - List.of( - "Manjama Shellmingo CHC", - "1978-09-30 00:00:00.0", + "Kenema Gbandoma MCHP", + "1984-09-14 00:00:00.0", "", "", "", "", - "2017-01-26 13:43:30.021")); + "2017-01-26 13:48:13.355")); validateRow( response, - 85, + 9, List.of( - "Rokupa Govt. Hospital", - "1978-06-02 00:00:00.0", - "", - "", - "", - "", - "2017-01-26 13:43:30.028")); - validateRow( - response, - 86, - List.of("Alkalia CHP", "1984-01-06 00:00:00.0", "", "", "", "", "2017-01-26 13:43:30.031")); - validateRow( - response, - 87, - List.of("Laiya CHP", "1980-03-11 00:00:00.0", "", "", "", "", "2017-01-26 13:43:30.037")); - validateRow( - response, - 88, - List.of("Yambama MCHP", "1985-02-04 00:00:00.0", "", "", "", "", "2017-01-26 13:43:30.04")); + "Bangoma MCHP", "1989-02-22 00:00:00.0", "", "", "", "", "2017-01-26 13:48:13.353")); validateRow( response, - 89, + 10, List.of( - "Bendu (Kowa) MCHP", - "1970-12-11 00:00:00.0", + "Blessed Mokaka East Clinic", + "1979-11-04 00:00:00.0", "", "", "", "", - "2017-01-26 13:43:30.047")); + "2017-01-26 13:48:13.35")); validateRow( response, - 90, + 11, List.of( - "Mosenegor MCHP", "1973-07-27 00:00:00.0", "", "", "", "", "2017-01-26 13:43:30.052")); + "MCH Static/U5", "1981-10-03 00:00:00.0", "", "", "", "", "2017-01-26 13:48:13.349")); validateRow( response, - 91, + 12, List.of( - "Kambia Makama CHP", - "1984-11-11 00:00:00.0", - "", - "", - "", - "", - "2017-01-26 13:43:30.056")); + "Sembehun CHC", "1973-05-17 00:00:00.0", "", "", "", "", "2017-01-26 13:48:13.347")); validateRow( response, - 92, + 13, List.of( - "Sumbuya Bessima CHP", - "1987-01-26 00:00:00.0", + "Baoma (Koya) CHC", + "1976-07-07 00:00:00.0", "", "", "", "", - "2017-01-26 13:43:30.06")); + "2017-01-26 13:48:13.346")); validateRow( response, - 93, - List.of( - "SLC. RHC Port Loko", - "1971-05-28 00:00:00.0", - "", - "", - "", - "", - "2017-01-26 13:43:30.065")); + 14, + List.of("Konjo MCHP", "1980-09-30 00:00:00.0", "", "", "", "", "2017-01-26 13:48:13.344")); validateRow( response, - 94, - List.of( - "Kagbulor CHP", "1984-01-23 00:00:00.0", "", "", "", "", "2017-01-26 13:43:30.071")); + 15, + List.of("Fogbo CHP", "1985-08-09 00:00:00.0", "", "", "", "", "2017-01-26 13:48:13.343")); validateRow( response, - 95, + 16, List.of( - "Mangay Loko MCHP", - "1980-02-21 00:00:00.0", + "Lakka/Ogoo Farm CHC", + "1986-05-10 00:00:00.0", "", "", "", "", - "2017-01-26 13:43:30.074")); + "2017-01-26 13:48:13.34")); validateRow( response, - 96, + 17, List.of( - "Bandasuma Fiama MCHP", - "1984-08-02 00:00:00.0", - "", - "", - "", - "", - "2017-01-26 13:43:30.079")); + "Moriba Town CHC", "1980-03-18 00:00:00.0", "", "", "", "", "2017-01-26 13:48:13.339")); validateRow( response, - 97, + 18, List.of( - "Mangay Loko MCHP", - "1975-09-09 00:00:00.0", - "", - "", - "", - "", - "2017-01-26 13:43:30.084")); + "Makonkorie MCHP", "1978-08-12 00:00:00.0", "", "", "", "", "2017-01-26 13:48:13.336")); validateRow( response, - 98, + 19, List.of( - "Barmoi Luma MCHP", - "1988-06-20 00:00:00.0", + "Gbo-Kakajama 1 MCHP", + "1975-09-20 00:00:00.0", "", "", "", "", - "2017-01-26 13:43:30.089")); + "2017-01-26 13:48:13.334")); validateRow( response, - 99, - List.of( - "Mayakie MCHP", "1985-08-31 00:00:00.0", "", "", "", "", "2017-01-26 13:43:30.095")); + 20, + List.of("Babara CHC", "1976-12-16 00:00:00.0", "", "", "", "", "2017-01-26 13:48:13.332")); } @Test diff --git a/dhis-2/dhis-test-e2e/src/test/java/org/hisp/dhis/analytics/trackedentity/TrackedEntityQuery4AutoTest.java b/dhis-2/dhis-test-e2e/src/test/java/org/hisp/dhis/analytics/trackedentity/TrackedEntityQuery4AutoTest.java index e6c40431c5a5..ea187dd1ccab 100644 --- a/dhis-2/dhis-test-e2e/src/test/java/org/hisp/dhis/analytics/trackedentity/TrackedEntityQuery4AutoTest.java +++ b/dhis-2/dhis-test-e2e/src/test/java/org/hisp/dhis/analytics/trackedentity/TrackedEntityQuery4AutoTest.java @@ -1079,7 +1079,7 @@ public void sortByEnrollmentDateAscMultiProgram() throws JSONException { .add("page=1") .add( "dimension=ou:USER_ORGUNIT,cejWyOfXge6,w75KJ2mc4zz,IpHINAT79UW.A03MvHHogjR.a3kGcGDCuk6,ur1Edk5Oe2n.EPEcjy3FWmI.fTZFU8cWvb3") - .add("relativePeriodDate=2022-01-27"); + .add("relativePeriodDate=2028-01-27"); // When ApiResponse response = actions.query().get("nEenWmSyUEp", JSON, JSON, params); @@ -1089,14 +1089,14 @@ public void sortByEnrollmentDateAscMultiProgram() throws JSONException { .validate() .statusCode(200) .body("headers", hasSize(equalTo(7))) - .body("rows", hasSize(equalTo(7))) - .body("height", equalTo(7)) + .body("rows", hasSize(equalTo(2))) + .body("height", equalTo(2)) .body("width", equalTo(7)) .body("headerWidth", equalTo(7)); // Assert metaData. String expectedMetaData = - "{\"pager\":{\"page\":1,\"pageSize\":30,\"isLastPage\":true},\"items\":{\"fTZFU8cWvb3\":{\"uid\":\"fTZFU8cWvb3\",\"code\":\"DE_860002\",\"name\":\"TB lab Hemoglobin\",\"dimensionItemType\":\"DATA_ELEMENT\",\"valueType\":\"BOOLEAN\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"IpHINAT79UW.A03MvHHogjR.a3kGcGDCuk6\":{\"uid\":\"a3kGcGDCuk6\",\"code\":\"DE_2006098\",\"name\":\"MCH Apgar Score\",\"description\":\"Apgar is a quick test performed on a baby at 1 and 5 minutes after birth. The 1-minute score determines how well the baby tolerated the birthing process. The 5-minute score tells the doctor how well the baby is doing outside the mother's womb.\",\"dimensionItemType\":\"DATA_ELEMENT\",\"valueType\":\"NUMBER\",\"aggregationType\":\"AVERAGE\",\"totalAggregationType\":\"SUM\"},\"202109\":{\"uid\":\"202109\",\"code\":\"202109\",\"name\":\"September 2021\",\"dimensionItemType\":\"PERIOD\",\"valueType\":\"TEXT\",\"totalAggregationType\":\"SUM\",\"startDate\":\"2021-09-01T00:00:00.000\",\"endDate\":\"2021-09-30T00:00:00.000\"},\"202107\":{\"uid\":\"202107\",\"code\":\"202107\",\"name\":\"July 2021\",\"dimensionItemType\":\"PERIOD\",\"valueType\":\"TEXT\",\"totalAggregationType\":\"SUM\",\"startDate\":\"2021-07-01T00:00:00.000\",\"endDate\":\"2021-07-31T00:00:00.000\"},\"202108\":{\"uid\":\"202108\",\"code\":\"202108\",\"name\":\"August 2021\",\"dimensionItemType\":\"PERIOD\",\"valueType\":\"TEXT\",\"totalAggregationType\":\"SUM\",\"startDate\":\"2021-08-01T00:00:00.000\",\"endDate\":\"2021-08-31T00:00:00.000\"},\"202105\":{\"uid\":\"202105\",\"code\":\"202105\",\"name\":\"May 2021\",\"dimensionItemType\":\"PERIOD\",\"valueType\":\"TEXT\",\"totalAggregationType\":\"SUM\",\"startDate\":\"2021-05-01T00:00:00.000\",\"endDate\":\"2021-05-31T00:00:00.000\"},\"202106\":{\"uid\":\"202106\",\"code\":\"202106\",\"name\":\"June 2021\",\"dimensionItemType\":\"PERIOD\",\"valueType\":\"TEXT\",\"totalAggregationType\":\"SUM\",\"startDate\":\"2021-06-01T00:00:00.000\",\"endDate\":\"2021-06-30T00:00:00.000\"},\"202103\":{\"uid\":\"202103\",\"code\":\"202103\",\"name\":\"March 2021\",\"dimensionItemType\":\"PERIOD\",\"valueType\":\"TEXT\",\"totalAggregationType\":\"SUM\",\"startDate\":\"2021-03-01T00:00:00.000\",\"endDate\":\"2021-03-31T00:00:00.000\"},\"202104\":{\"uid\":\"202104\",\"code\":\"202104\",\"name\":\"April 2021\",\"dimensionItemType\":\"PERIOD\",\"valueType\":\"TEXT\",\"totalAggregationType\":\"SUM\",\"startDate\":\"2021-04-01T00:00:00.000\",\"endDate\":\"2021-04-30T00:00:00.000\"},\"LAST_12_MONTHS\":{\"name\":\"Last 12 months\"},\"IpHINAT79UW.ouname\":{\"name\":\"Organisation Unit Name\",\"dimensionType\":\"ORGANISATION_UNIT\"},\"202112\":{\"uid\":\"202112\",\"code\":\"202112\",\"name\":\"December 2021\",\"dimensionItemType\":\"PERIOD\",\"valueType\":\"TEXT\",\"totalAggregationType\":\"SUM\",\"startDate\":\"2021-12-01T00:00:00.000\",\"endDate\":\"2021-12-31T00:00:00.000\"},\"ImspTQPwCqd\":{\"uid\":\"ImspTQPwCqd\",\"code\":\"OU_525\",\"name\":\"Sierra Leone\",\"dimensionItemType\":\"ORGANISATION_UNIT\",\"valueType\":\"TEXT\",\"totalAggregationType\":\"SUM\"},\"202110\":{\"uid\":\"202110\",\"code\":\"202110\",\"name\":\"October 2021\",\"dimensionItemType\":\"PERIOD\",\"valueType\":\"TEXT\",\"totalAggregationType\":\"SUM\",\"startDate\":\"2021-10-01T00:00:00.000\",\"endDate\":\"2021-10-31T00:00:00.000\"},\"202111\":{\"uid\":\"202111\",\"code\":\"202111\",\"name\":\"November 2021\",\"dimensionItemType\":\"PERIOD\",\"valueType\":\"TEXT\",\"totalAggregationType\":\"SUM\",\"startDate\":\"2021-11-01T00:00:00.000\",\"endDate\":\"2021-11-30T00:00:00.000\"},\"EPEcjy3FWmI\":{\"uid\":\"EPEcjy3FWmI\",\"name\":\"Lab monitoring\",\"description\":\"Laboratory monitoring\"},\"ur1Edk5Oe2n\":{\"uid\":\"ur1Edk5Oe2n\",\"name\":\"TB program\"},\"A03MvHHogjR\":{\"uid\":\"A03MvHHogjR\",\"name\":\"Birth\",\"description\":\"Birth of the baby\"},\"pC3N9N77UmT\":{\"uid\":\"pC3N9N77UmT\",\"name\":\"Gender\",\"options\":[{\"uid\":\"rBvjJYbMCVx\",\"code\":\"Male\"},{\"uid\":\"Mnp3oXrpAbK\",\"code\":\"Female\"}]},\"Mnp3oXrpAbK\":{\"uid\":\"Mnp3oXrpAbK\",\"code\":\"Female\",\"name\":\"Female\"},\"rBvjJYbMCVx\":{\"uid\":\"rBvjJYbMCVx\",\"code\":\"Male\",\"name\":\"Male\"},\"IpHINAT79UW\":{\"uid\":\"IpHINAT79UW\",\"name\":\"Child Programme\"},\"ou\":{\"uid\":\"ou\",\"name\":\"Organisation unit\",\"dimensionType\":\"ORGANISATION_UNIT\"},\"w75KJ2mc4zz\":{\"uid\":\"w75KJ2mc4zz\",\"code\":\"MMD_PER_NAM\",\"name\":\"First name\",\"description\":\"First name\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"USER_ORGUNIT\":{\"organisationUnits\":[\"ImspTQPwCqd\"]},\"ur1Edk5Oe2n.pe\":{\"uid\":\"pe\",\"name\":\"Period\",\"dimensionType\":\"PERIOD\"},\"a3kGcGDCuk6\":{\"uid\":\"a3kGcGDCuk6\",\"code\":\"DE_2006098\",\"name\":\"MCH Apgar Score\",\"description\":\"Apgar is a quick test performed on a baby at 1 and 5 minutes after birth. The 1-minute score determines how well the baby tolerated the birthing process. The 5-minute score tells the doctor how well the baby is doing outside the mother's womb.\",\"dimensionItemType\":\"DATA_ELEMENT\",\"valueType\":\"NUMBER\",\"aggregationType\":\"AVERAGE\",\"totalAggregationType\":\"SUM\"},\"2021\":{\"uid\":\"2021\",\"code\":\"2021\",\"name\":\"2021\",\"dimensionItemType\":\"PERIOD\",\"valueType\":\"TEXT\",\"totalAggregationType\":\"SUM\",\"startDate\":\"2021-01-01T00:00:00.000\",\"endDate\":\"2021-12-31T00:00:00.000\"},\"2020\":{\"uid\":\"2020\",\"code\":\"2020\",\"name\":\"2020\",\"dimensionItemType\":\"PERIOD\",\"valueType\":\"TEXT\",\"totalAggregationType\":\"SUM\",\"startDate\":\"2020-01-01T00:00:00.000\",\"endDate\":\"2020-12-31T00:00:00.000\"},\"LAST_5_YEARS\":{\"name\":\"Last 5 years\"},\"cejWyOfXge6\":{\"uid\":\"cejWyOfXge6\",\"name\":\"Gender\",\"description\":\"Gender\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"202101\":{\"uid\":\"202101\",\"code\":\"202101\",\"name\":\"January 2021\",\"dimensionItemType\":\"PERIOD\",\"valueType\":\"TEXT\",\"totalAggregationType\":\"SUM\",\"startDate\":\"2021-01-01T00:00:00.000\",\"endDate\":\"2021-01-31T00:00:00.000\"},\"202102\":{\"uid\":\"202102\",\"code\":\"202102\",\"name\":\"February 2021\",\"dimensionItemType\":\"PERIOD\",\"valueType\":\"TEXT\",\"totalAggregationType\":\"SUM\",\"startDate\":\"2021-02-01T00:00:00.000\",\"endDate\":\"2021-02-28T00:00:00.000\"},\"2019\":{\"uid\":\"2019\",\"code\":\"2019\",\"name\":\"2019\",\"dimensionItemType\":\"PERIOD\",\"valueType\":\"TEXT\",\"totalAggregationType\":\"SUM\",\"startDate\":\"2019-01-01T00:00:00.000\",\"endDate\":\"2019-12-31T00:00:00.000\"},\"ur1Edk5Oe2n.enrollmentdate\":{\"name\":\"Start of treatment date\",\"dimensionType\":\"PERIOD\"},\"2018\":{\"uid\":\"2018\",\"code\":\"2018\",\"name\":\"2018\",\"dimensionItemType\":\"PERIOD\",\"valueType\":\"TEXT\",\"totalAggregationType\":\"SUM\",\"startDate\":\"2018-01-01T00:00:00.000\",\"endDate\":\"2018-12-31T00:00:00.000\"},\"2017\":{\"uid\":\"2017\",\"code\":\"2017\",\"name\":\"2017\",\"dimensionItemType\":\"PERIOD\",\"valueType\":\"TEXT\",\"totalAggregationType\":\"SUM\",\"startDate\":\"2017-01-01T00:00:00.000\",\"endDate\":\"2017-12-31T00:00:00.000\"},\"pe\":{\"uid\":\"pe\",\"name\":\"Period\",\"dimensionType\":\"PERIOD\"},\"ur1Edk5Oe2n.EPEcjy3FWmI.fTZFU8cWvb3\":{\"uid\":\"fTZFU8cWvb3\",\"code\":\"DE_860002\",\"name\":\"TB lab Hemoglobin\",\"dimensionItemType\":\"DATA_ELEMENT\",\"valueType\":\"BOOLEAN\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"ouname\":{\"name\":\"Organisation Unit Name\",\"dimensionType\":\"ORGANISATION_UNIT\"}},\"dimensions\":{\"fTZFU8cWvb3\":[],\"zDhUuAYrxNC\":[],\"lw1SqmMlnfh\":[],\"Qo571yj6Zcn\":[],\"DODgdr5Oo2v\":[],\"iESIqZ0R0R0\":[],\"n9nUvfpTsxQ\":[],\"kyIzQsj96BD\":[],\"xs8A6tQJY0s\":[],\"A4xFHyieXys\":[],\"OvY4VVhSDeJ\":[],\"RG7uGl4w5Jq\":[],\"spFvx9FndA4\":[],\"GUOBQt5K2WI\":[],\"Agywv2JGwuq\":[],\"lZGmxYbs97q\":[],\"VqEFza8wbwA\":[],\"ciq2USN94oJ\":[\"wfkKVdPBzho\",\"Yjte6foKMny\"],\"ou\":[\"ImspTQPwCqd\"],\"w75KJ2mc4zz\":[],\"KmEUg2hHEtx\":[],\"G7vUx908SwP\":[],\"o9odfev2Ty5\":[],\"a3kGcGDCuk6\":[],\"FO4sWYJ64LQ\":[],\"NDXw0cluzSw\":[],\"ruQQnf6rswq\":[],\"cejWyOfXge6\":[\"rBvjJYbMCVx\",\"Mnp3oXrpAbK\"],\"P2cwLGskgxn\":[],\"gHGyrwKPzej\":[],\"pe\":[\"202101\",\"202102\",\"202103\",\"202104\",\"202105\",\"202106\",\"202107\",\"202108\",\"202109\",\"202110\",\"202111\",\"202112\",\"2017\",\"2018\",\"2019\",\"2020\",\"2021\"],\"VHfUeXpawmE\":[],\"AuPLng5hLbE\":[],\"ZcBPrXKahq2\":[],\"H9IlTX2X6SL\":[]}}"; + "{\"pager\":{\"page\":1,\"pageSize\":30,\"isLastPage\":true},\"items\":{\"fTZFU8cWvb3\":{\"uid\":\"fTZFU8cWvb3\",\"code\":\"DE_860002\",\"name\":\"TB lab Hemoglobin\",\"dimensionItemType\":\"DATA_ELEMENT\",\"valueType\":\"BOOLEAN\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"lw1SqmMlnfh\":{\"uid\":\"lw1SqmMlnfh\",\"code\":\"Height in cm\",\"name\":\"Height in cm\",\"description\":\"Height in cm\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"NUMBER\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"DODgdr5Oo2v\":{\"uid\":\"DODgdr5Oo2v\",\"code\":\"Provider ID\",\"name\":\"Provider ID\",\"description\":\"Provider ID\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"iESIqZ0R0R0\":{\"uid\":\"iESIqZ0R0R0\",\"name\":\"Date of birth\",\"description\":\"Date of birth\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"DATE\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"n9nUvfpTsxQ\":{\"uid\":\"n9nUvfpTsxQ\",\"code\":\"Zip code\",\"name\":\"Zip code\",\"description\":\"Zip code\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"NUMBER\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"LAST_12_MONTHS\":{\"name\":\"Last 12 months\"},\"2027\":{\"uid\":\"2027\",\"code\":\"2027\",\"name\":\"2027\",\"dimensionItemType\":\"PERIOD\",\"valueType\":\"TEXT\",\"totalAggregationType\":\"SUM\",\"startDate\":\"2027-01-01T00:00:00.000\",\"endDate\":\"2027-12-31T00:00:00.000\"},\"2026\":{\"uid\":\"2026\",\"code\":\"2026\",\"name\":\"2026\",\"dimensionItemType\":\"PERIOD\",\"valueType\":\"TEXT\",\"totalAggregationType\":\"SUM\",\"startDate\":\"2026-01-01T00:00:00.000\",\"endDate\":\"2026-12-31T00:00:00.000\"},\"2025\":{\"uid\":\"2025\",\"code\":\"2025\",\"name\":\"2025\",\"dimensionItemType\":\"PERIOD\",\"valueType\":\"TEXT\",\"totalAggregationType\":\"SUM\",\"startDate\":\"2025-01-01T00:00:00.000\",\"endDate\":\"2025-12-31T00:00:00.000\"},\"2024\":{\"uid\":\"2024\",\"code\":\"2024\",\"name\":\"2024\",\"dimensionItemType\":\"PERIOD\",\"valueType\":\"TEXT\",\"totalAggregationType\":\"SUM\",\"startDate\":\"2024-01-01T00:00:00.000\",\"endDate\":\"2024-12-31T00:00:00.000\"},\"RG7uGl4w5Jq\":{\"uid\":\"RG7uGl4w5Jq\",\"code\":\"Longitude\",\"name\":\"Longitude\",\"description\":\"Longitude\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"GUOBQt5K2WI\":{\"uid\":\"GUOBQt5K2WI\",\"code\":\"State\",\"name\":\"State\",\"description\":\"State\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"Mnp3oXrpAbK\":{\"uid\":\"Mnp3oXrpAbK\",\"code\":\"Female\",\"name\":\"Female\"},\"VqEFza8wbwA\":{\"uid\":\"VqEFza8wbwA\",\"code\":\"MMD_PER_ADR1\",\"name\":\"Address\",\"description\":\"Country\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"AVERAGE\",\"totalAggregationType\":\"SUM\"},\"w75KJ2mc4zz\":{\"uid\":\"w75KJ2mc4zz\",\"code\":\"MMD_PER_NAM\",\"name\":\"First name\",\"description\":\"First name\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"KmEUg2hHEtx\":{\"uid\":\"KmEUg2hHEtx\",\"name\":\"Email address\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"USER_ORGUNIT\":{\"organisationUnits\":[\"ImspTQPwCqd\"]},\"G7vUx908SwP\":{\"uid\":\"G7vUx908SwP\",\"name\":\"Residence location\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"COORDINATE\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"o9odfev2Ty5\":{\"uid\":\"o9odfev2Ty5\",\"code\":\"Mother maiden name\",\"name\":\"Mother maiden name\",\"description\":\"Mother maiden name\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"a3kGcGDCuk6\":{\"uid\":\"a3kGcGDCuk6\",\"code\":\"DE_2006098\",\"name\":\"MCH Apgar Score\",\"description\":\"Apgar is a quick test performed on a baby at 1 and 5 minutes after birth. The 1-minute score determines how well the baby tolerated the birthing process. The 5-minute score tells the doctor how well the baby is doing outside the mother's womb.\",\"dimensionItemType\":\"DATA_ELEMENT\",\"valueType\":\"NUMBER\",\"aggregationType\":\"AVERAGE\",\"totalAggregationType\":\"SUM\"},\"FO4sWYJ64LQ\":{\"uid\":\"FO4sWYJ64LQ\",\"code\":\"City\",\"name\":\"City\",\"description\":\"City\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"NDXw0cluzSw\":{\"uid\":\"NDXw0cluzSw\",\"name\":\"Email\",\"description\":\"Email address\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"ruQQnf6rswq\":{\"uid\":\"ruQQnf6rswq\",\"name\":\"TB number\",\"description\":\"TB number\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"cejWyOfXge6\":{\"uid\":\"cejWyOfXge6\",\"name\":\"Gender\",\"description\":\"Gender\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"ur1Edk5Oe2n.enrollmentdate\":{\"name\":\"Start of treatment date\",\"dimensionType\":\"PERIOD\"},\"VHfUeXpawmE\":{\"uid\":\"VHfUeXpawmE\",\"code\":\"Vehicle\",\"name\":\"Vehicle\",\"description\":\"Vehicle\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"ZcBPrXKahq2\":{\"uid\":\"ZcBPrXKahq2\",\"name\":\"Postal code\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"H9IlTX2X6SL\":{\"uid\":\"H9IlTX2X6SL\",\"code\":\"Blood type\",\"name\":\"Blood type\",\"description\":\"Blood type\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"zDhUuAYrxNC\":{\"uid\":\"zDhUuAYrxNC\",\"name\":\"Last name\",\"description\":\"Last name\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"202709\":{\"uid\":\"202709\",\"code\":\"202709\",\"name\":\"September 2027\",\"dimensionItemType\":\"PERIOD\",\"valueType\":\"TEXT\",\"totalAggregationType\":\"SUM\",\"startDate\":\"2027-09-01T00:00:00.000\",\"endDate\":\"2027-09-30T00:00:00.000\"},\"IpHINAT79UW.A03MvHHogjR.a3kGcGDCuk6\":{\"uid\":\"a3kGcGDCuk6\",\"code\":\"DE_2006098\",\"name\":\"MCH Apgar Score\",\"description\":\"Apgar is a quick test performed on a baby at 1 and 5 minutes after birth. The 1-minute score determines how well the baby tolerated the birthing process. The 5-minute score tells the doctor how well the baby is doing outside the mother's womb.\",\"dimensionItemType\":\"DATA_ELEMENT\",\"valueType\":\"NUMBER\",\"aggregationType\":\"AVERAGE\",\"totalAggregationType\":\"SUM\"},\"202707\":{\"uid\":\"202707\",\"code\":\"202707\",\"name\":\"July 2027\",\"dimensionItemType\":\"PERIOD\",\"valueType\":\"TEXT\",\"totalAggregationType\":\"SUM\",\"startDate\":\"2027-07-01T00:00:00.000\",\"endDate\":\"2027-07-31T00:00:00.000\"},\"202708\":{\"uid\":\"202708\",\"code\":\"202708\",\"name\":\"August 2027\",\"dimensionItemType\":\"PERIOD\",\"valueType\":\"TEXT\",\"totalAggregationType\":\"SUM\",\"startDate\":\"2027-08-01T00:00:00.000\",\"endDate\":\"2027-08-31T00:00:00.000\"},\"202705\":{\"uid\":\"202705\",\"code\":\"202705\",\"name\":\"May 2027\",\"dimensionItemType\":\"PERIOD\",\"valueType\":\"TEXT\",\"totalAggregationType\":\"SUM\",\"startDate\":\"2027-05-01T00:00:00.000\",\"endDate\":\"2027-05-31T00:00:00.000\"},\"202706\":{\"uid\":\"202706\",\"code\":\"202706\",\"name\":\"June 2027\",\"dimensionItemType\":\"PERIOD\",\"valueType\":\"TEXT\",\"totalAggregationType\":\"SUM\",\"startDate\":\"2027-06-01T00:00:00.000\",\"endDate\":\"2027-06-30T00:00:00.000\"},\"202703\":{\"uid\":\"202703\",\"code\":\"202703\",\"name\":\"March 2027\",\"dimensionItemType\":\"PERIOD\",\"valueType\":\"TEXT\",\"totalAggregationType\":\"SUM\",\"startDate\":\"2027-03-01T00:00:00.000\",\"endDate\":\"2027-03-31T00:00:00.000\"},\"202704\":{\"uid\":\"202704\",\"code\":\"202704\",\"name\":\"April 2027\",\"dimensionItemType\":\"PERIOD\",\"valueType\":\"TEXT\",\"totalAggregationType\":\"SUM\",\"startDate\":\"2027-04-01T00:00:00.000\",\"endDate\":\"2027-04-30T00:00:00.000\"},\"202701\":{\"uid\":\"202701\",\"code\":\"202701\",\"name\":\"January 2027\",\"dimensionItemType\":\"PERIOD\",\"valueType\":\"TEXT\",\"totalAggregationType\":\"SUM\",\"startDate\":\"2027-01-01T00:00:00.000\",\"endDate\":\"2027-01-31T00:00:00.000\"},\"fDd25txQckK\":{\"uid\":\"fDd25txQckK\",\"name\":\"Provider Follow-up and Support Tool\"},\"Qo571yj6Zcn\":{\"uid\":\"Qo571yj6Zcn\",\"code\":\"Latitude\",\"name\":\"Latitude\",\"description\":\"Latitude\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"202702\":{\"uid\":\"202702\",\"code\":\"202702\",\"name\":\"February 2027\",\"dimensionItemType\":\"PERIOD\",\"valueType\":\"TEXT\",\"totalAggregationType\":\"SUM\",\"startDate\":\"2027-02-01T00:00:00.000\",\"endDate\":\"2027-02-28T00:00:00.000\"},\"kyIzQsj96BD\":{\"uid\":\"kyIzQsj96BD\",\"code\":\"Company\",\"name\":\"Company\",\"description\":\"Company\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"IpHINAT79UW.ouname\":{\"name\":\"Organisation Unit Name\",\"dimensionType\":\"ORGANISATION_UNIT\"},\"A4xFHyieXys\":{\"uid\":\"A4xFHyieXys\",\"code\":\"Occupation\",\"name\":\"Occupation\",\"description\":\"Occupation\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"xs8A6tQJY0s\":{\"uid\":\"xs8A6tQJY0s\",\"name\":\"TB identifier\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"ImspTQPwCqd\":{\"uid\":\"ImspTQPwCqd\",\"code\":\"OU_525\",\"name\":\"Sierra Leone\",\"dimensionItemType\":\"ORGANISATION_UNIT\",\"valueType\":\"TEXT\",\"totalAggregationType\":\"SUM\"},\"OvY4VVhSDeJ\":{\"uid\":\"OvY4VVhSDeJ\",\"name\":\"Weight in kg\",\"description\":\"Weight in kg\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"NUMBER\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"EPEcjy3FWmI\":{\"uid\":\"EPEcjy3FWmI\",\"name\":\"Lab monitoring\",\"description\":\"Laboratory monitoring\"},\"ur1Edk5Oe2n\":{\"uid\":\"ur1Edk5Oe2n\",\"name\":\"TB program\"},\"A03MvHHogjR\":{\"uid\":\"A03MvHHogjR\",\"name\":\"Birth\",\"description\":\"Birth of the baby\"},\"pC3N9N77UmT\":{\"uid\":\"pC3N9N77UmT\",\"name\":\"Gender\",\"options\":[{\"uid\":\"Mnp3oXrpAbK\",\"code\":\"Female\"}]},\"spFvx9FndA4\":{\"uid\":\"spFvx9FndA4\",\"name\":\"Age\",\"description\":\"Age\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"DATE\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"Agywv2JGwuq\":{\"uid\":\"Agywv2JGwuq\",\"code\":\"MMD_PER_MOB\",\"name\":\"Mobile number\",\"description\":\"Mobile number\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"lZGmxYbs97q\":{\"uid\":\"lZGmxYbs97q\",\"code\":\"MMD_PER_ID\",\"name\":\"Unique ID\",\"description\":\"Unique identiifer\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"IpHINAT79UW\":{\"uid\":\"IpHINAT79UW\",\"name\":\"Child Programme\"},\"ciq2USN94oJ\":{\"uid\":\"ciq2USN94oJ\",\"code\":\"MMD_PER_STA\",\"name\":\"Civil status\",\"description\":\"Civil status\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"ou\":{\"uid\":\"ou\",\"name\":\"Organisation unit\",\"dimensionType\":\"ORGANISATION_UNIT\"},\"2023\":{\"uid\":\"2023\",\"code\":\"2023\",\"name\":\"2023\",\"dimensionItemType\":\"PERIOD\",\"valueType\":\"TEXT\",\"totalAggregationType\":\"SUM\",\"startDate\":\"2023-01-01T00:00:00.000\",\"endDate\":\"2023-12-31T00:00:00.000\"},\"ur1Edk5Oe2n.pe\":{\"uid\":\"pe\",\"name\":\"Period\",\"dimensionType\":\"PERIOD\"},\"202712\":{\"uid\":\"202712\",\"code\":\"202712\",\"name\":\"December 2027\",\"dimensionItemType\":\"PERIOD\",\"valueType\":\"TEXT\",\"totalAggregationType\":\"SUM\",\"startDate\":\"2027-12-01T00:00:00.000\",\"endDate\":\"2027-12-31T00:00:00.000\"},\"202710\":{\"uid\":\"202710\",\"code\":\"202710\",\"name\":\"October 2027\",\"dimensionItemType\":\"PERIOD\",\"valueType\":\"TEXT\",\"totalAggregationType\":\"SUM\",\"startDate\":\"2027-10-01T00:00:00.000\",\"endDate\":\"2027-10-31T00:00:00.000\"},\"LAST_5_YEARS\":{\"name\":\"Last 5 years\"},\"202711\":{\"uid\":\"202711\",\"code\":\"202711\",\"name\":\"November 2027\",\"dimensionItemType\":\"PERIOD\",\"valueType\":\"TEXT\",\"totalAggregationType\":\"SUM\",\"startDate\":\"2027-11-01T00:00:00.000\",\"endDate\":\"2027-11-30T00:00:00.000\"},\"P2cwLGskgxn\":{\"uid\":\"P2cwLGskgxn\",\"name\":\"Phone number\",\"description\":\"Phone number\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"gHGyrwKPzej\":{\"uid\":\"gHGyrwKPzej\",\"code\":\"MMD_PER_DOB\",\"name\":\"Birth date\",\"description\":\"Birth date\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"DATE\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"pe\":{\"uid\":\"pe\",\"name\":\"Period\",\"dimensionType\":\"PERIOD\"},\"uy2gU8kT1jF\":{\"uid\":\"uy2gU8kT1jF\",\"name\":\"MNCH / PNC (Adult Woman)\"},\"AuPLng5hLbE\":{\"uid\":\"AuPLng5hLbE\",\"code\":\"National identifier\",\"name\":\"National identifier\",\"description\":\"National identifier\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"WSGAb5XwJ3Y\":{\"uid\":\"WSGAb5XwJ3Y\",\"name\":\"WHO RMNCH Tracker\"},\"ur1Edk5Oe2n.EPEcjy3FWmI.fTZFU8cWvb3\":{\"uid\":\"fTZFU8cWvb3\",\"code\":\"DE_860002\",\"name\":\"TB lab Hemoglobin\",\"dimensionItemType\":\"DATA_ELEMENT\",\"valueType\":\"BOOLEAN\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"ouname\":{\"name\":\"Organisation Unit Name\",\"dimensionType\":\"ORGANISATION_UNIT\"}},\"dimensions\":{\"fTZFU8cWvb3\":[],\"zDhUuAYrxNC\":[],\"lw1SqmMlnfh\":[],\"DODgdr5Oo2v\":[],\"Qo571yj6Zcn\":[],\"iESIqZ0R0R0\":[],\"n9nUvfpTsxQ\":[],\"kyIzQsj96BD\":[],\"A4xFHyieXys\":[],\"xs8A6tQJY0s\":[],\"OvY4VVhSDeJ\":[],\"RG7uGl4w5Jq\":[],\"spFvx9FndA4\":[],\"Agywv2JGwuq\":[],\"GUOBQt5K2WI\":[],\"lZGmxYbs97q\":[],\"VqEFza8wbwA\":[],\"ciq2USN94oJ\":[\"wfkKVdPBzho\",\"Yjte6foKMny\"],\"ou\":[\"ImspTQPwCqd\"],\"w75KJ2mc4zz\":[],\"KmEUg2hHEtx\":[],\"G7vUx908SwP\":[],\"o9odfev2Ty5\":[],\"a3kGcGDCuk6\":[],\"FO4sWYJ64LQ\":[],\"NDXw0cluzSw\":[],\"ruQQnf6rswq\":[],\"cejWyOfXge6\":[\"Mnp3oXrpAbK\"],\"P2cwLGskgxn\":[],\"gHGyrwKPzej\":[],\"pe\":[\"202701\",\"202702\",\"202703\",\"202704\",\"202705\",\"202706\",\"202707\",\"202708\",\"202709\",\"202710\",\"202711\",\"202712\",\"2023\",\"2024\",\"2025\",\"2026\",\"2027\"],\"VHfUeXpawmE\":[],\"AuPLng5hLbE\":[],\"ZcBPrXKahq2\":[],\"H9IlTX2X6SL\":[]}}"; String actualMetaData = new JSONObject((Map) response.extract("metaData")).toString(); assertEquals(expectedMetaData, actualMetaData, false); @@ -1147,28 +1147,10 @@ public void sortByEnrollmentDateAscMultiProgram() throws JSONException { validateRow( response, 0, - List.of("Ngelehun CHC", "Male", "Berhane", "", "", "", "2021-05-14 12:35:24.03")); + List.of("Ngelehun CHC", "Female", "Geraldine", "", "", "", "2023-01-15 01:00:00.0")); validateRow( response, 1, - List.of("Ngelehun CHC", "Male", "Scott", "", "", "", "2021-05-19 12:27:48.317")); - validateRow( - response, - 2, - List.of("Ngelehun CHC", "Male", "Johnathan", "", "", "", "2021-06-17 12:27:48.595")); - validateRow( - response, - 3, - List.of("Ngelehun CHC", "Female", "Lynn", "", "", "", "2021-09-11 12:27:48.552")); - validateRow( - response, - 4, - List.of("Ngelehun CHC", "Male", "Yusef", "", "", "", "2021-10-15 12:34:17.849")); - validateRow( - response, - 5, - List.of("Ngelehun CHC", "Female", "Drew", "", "", "", "2021-11-11 12:27:48.386")); - validateRow( - response, 6, List.of("Ngelehun CHC", "Male", "Tom", "", "", "", "2021-11-14 12:27:48.61")); + List.of("Ngelehun CHC", "FEMALE", "Inés", "", "", "", "2023-03-03 01:00:00.0")); } } diff --git a/dhis-2/dhis-test-e2e/src/test/java/org/hisp/dhis/analytics/trackedentity/TrackedEntityQuery6AutoTest.java b/dhis-2/dhis-test-e2e/src/test/java/org/hisp/dhis/analytics/trackedentity/TrackedEntityQuery6AutoTest.java index 37dcdfb780ca..a056ea5be4a8 100644 --- a/dhis-2/dhis-test-e2e/src/test/java/org/hisp/dhis/analytics/trackedentity/TrackedEntityQuery6AutoTest.java +++ b/dhis-2/dhis-test-e2e/src/test/java/org/hisp/dhis/analytics/trackedentity/TrackedEntityQuery6AutoTest.java @@ -60,7 +60,7 @@ public void singleOrgUnitLongitudeAsc() throws JSONException { .add("rowContext=true") .add("pageSize=100") .add("page=1") - .add("dimension=ou:ImspTQPwCqd,RG7uGl4w5Jq,lw1SqmMlnfh:GT:169") + .add("dimension=ou:ImspTQPwCqd,RG7uGl4w5Jq,lw1SqmMlnfh:GE:190") .add("relativePeriodDate=2024-06-13"); // When @@ -71,14 +71,14 @@ public void singleOrgUnitLongitudeAsc() throws JSONException { .validate() .statusCode(200) .body("headers", hasSize(equalTo(3))) - .body("rows", hasSize(equalTo(2))) - .body("height", equalTo(2)) + .body("rows", hasSize(equalTo(100))) + .body("height", equalTo(100)) .body("width", equalTo(3)) .body("headerWidth", equalTo(3)); // Assert metaData. String expectedMetaData = - "{\"pager\":{\"page\":1,\"pageSize\":100,\"isLastPage\":true},\"items\":{\"ImspTQPwCqd\":{\"uid\":\"ImspTQPwCqd\",\"code\":\"OU_525\",\"name\":\"Sierra Leone\",\"dimensionItemType\":\"ORGANISATION_UNIT\",\"valueType\":\"TEXT\",\"totalAggregationType\":\"SUM\"},\"lw1SqmMlnfh\":{\"uid\":\"lw1SqmMlnfh\",\"code\":\"Height in cm\",\"name\":\"Height in cm\",\"description\":\"Height in cm\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"NUMBER\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"ou\":{\"uid\":\"ou\",\"name\":\"Organisation unit\",\"dimensionType\":\"ORGANISATION_UNIT\"},\"RG7uGl4w5Jq\":{\"uid\":\"RG7uGl4w5Jq\",\"code\":\"Longitude\",\"name\":\"Longitude\",\"description\":\"Longitude\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"ouname\":{\"name\":\"Organisation Unit Name\",\"dimensionType\":\"ORGANISATION_UNIT\"}},\"dimensions\":{\"zDhUuAYrxNC\":[],\"lw1SqmMlnfh\":[],\"Qo571yj6Zcn\":[],\"DODgdr5Oo2v\":[],\"iESIqZ0R0R0\":[],\"n9nUvfpTsxQ\":[],\"kyIzQsj96BD\":[],\"xs8A6tQJY0s\":[],\"A4xFHyieXys\":[],\"OvY4VVhSDeJ\":[],\"RG7uGl4w5Jq\":[],\"spFvx9FndA4\":[],\"GUOBQt5K2WI\":[],\"Agywv2JGwuq\":[],\"lZGmxYbs97q\":[],\"VqEFza8wbwA\":[],\"ciq2USN94oJ\":[\"wfkKVdPBzho\",\"Yjte6foKMny\"],\"ou\":[\"ImspTQPwCqd\"],\"w75KJ2mc4zz\":[],\"KmEUg2hHEtx\":[],\"G7vUx908SwP\":[],\"o9odfev2Ty5\":[],\"FO4sWYJ64LQ\":[],\"NDXw0cluzSw\":[],\"ruQQnf6rswq\":[],\"cejWyOfXge6\":[\"rBvjJYbMCVx\",\"Mnp3oXrpAbK\"],\"P2cwLGskgxn\":[],\"gHGyrwKPzej\":[],\"pe\":[],\"VHfUeXpawmE\":[],\"AuPLng5hLbE\":[],\"ZcBPrXKahq2\":[],\"H9IlTX2X6SL\":[]}}"; + "{\"pager\":{\"page\":1,\"pageSize\":100,\"isLastPage\":false},\"items\":{\"lw1SqmMlnfh\":{\"uid\":\"lw1SqmMlnfh\",\"code\":\"Height in cm\",\"name\":\"Height in cm\",\"description\":\"Height in cm\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"NUMBER\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"ZzYYXq4fJie\":{\"uid\":\"ZzYYXq4fJie\",\"name\":\"Baby Postnatal\",\"description\":\"Baby Postnatal\"},\"jdRD35YwbRH\":{\"uid\":\"jdRD35YwbRH\",\"name\":\"Sputum smear microscopy test\",\"description\":\"Sputum smear microscopy test\"},\"DODgdr5Oo2v\":{\"uid\":\"DODgdr5Oo2v\",\"code\":\"Provider ID\",\"name\":\"Provider ID\",\"description\":\"Provider ID\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"iESIqZ0R0R0\":{\"uid\":\"iESIqZ0R0R0\",\"name\":\"Date of birth\",\"description\":\"Date of birth\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"DATE\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"n9nUvfpTsxQ\":{\"uid\":\"n9nUvfpTsxQ\",\"code\":\"Zip code\",\"name\":\"Zip code\",\"description\":\"Zip code\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"NUMBER\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"PFDfvmGpsR3\":{\"uid\":\"PFDfvmGpsR3\",\"name\":\"Care at birth\",\"description\":\"Intrapartum care / Childbirth / Labour and delivery\"},\"lST1OZ5BDJ2\":{\"uid\":\"lST1OZ5BDJ2\",\"name\":\"Provider Follow-up and Support Tool\",\"description\":\"Provider Follow-up and Support Tool\"},\"PUZaKR0Jh2k\":{\"uid\":\"PUZaKR0Jh2k\",\"name\":\"Previous deliveries\",\"description\":\"Table for recording earlier deliveries\"},\"RG7uGl4w5Jq\":{\"uid\":\"RG7uGl4w5Jq\",\"code\":\"Longitude\",\"name\":\"Longitude\",\"description\":\"Longitude\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"WZbXY0S00lP\":{\"uid\":\"WZbXY0S00lP\",\"name\":\"First antenatal care visit\",\"description\":\"First antenatal care visit\"},\"Xgk8Wvl0jHr\":{\"uid\":\"Xgk8Wvl0jHr\",\"name\":\"Delivery\",\"description\":\"Delivery phase\"},\"GUOBQt5K2WI\":{\"uid\":\"GUOBQt5K2WI\",\"code\":\"State\",\"name\":\"State\",\"description\":\"State\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"VqEFza8wbwA\":{\"uid\":\"VqEFza8wbwA\",\"code\":\"MMD_PER_ADR1\",\"name\":\"Address\",\"description\":\"Country\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"AVERAGE\",\"totalAggregationType\":\"SUM\"},\"w75KJ2mc4zz\":{\"uid\":\"w75KJ2mc4zz\",\"code\":\"MMD_PER_NAM\",\"name\":\"First name\",\"description\":\"First name\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"KmEUg2hHEtx\":{\"uid\":\"KmEUg2hHEtx\",\"name\":\"Email address\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"G7vUx908SwP\":{\"uid\":\"G7vUx908SwP\",\"name\":\"Residence location\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"COORDINATE\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"o9odfev2Ty5\":{\"uid\":\"o9odfev2Ty5\",\"code\":\"Mother maiden name\",\"name\":\"Mother maiden name\",\"description\":\"Mother maiden name\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"FO4sWYJ64LQ\":{\"uid\":\"FO4sWYJ64LQ\",\"code\":\"City\",\"name\":\"City\",\"description\":\"City\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"NDXw0cluzSw\":{\"uid\":\"NDXw0cluzSw\",\"name\":\"Email\",\"description\":\"Email address\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"oRySG82BKE6\":{\"uid\":\"oRySG82BKE6\",\"name\":\"PNC Visit\",\"description\":\"Post Natal Care Visit\"},\"ruQQnf6rswq\":{\"uid\":\"ruQQnf6rswq\",\"name\":\"TB number\",\"description\":\"TB number\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"grIfo3oOf4Y\":{\"uid\":\"grIfo3oOf4Y\",\"name\":\"ANC Visit (2-4+)\",\"description\":\"ANC visits 2 to 4+\"},\"cejWyOfXge6\":{\"uid\":\"cejWyOfXge6\",\"name\":\"Gender\",\"description\":\"Gender\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"VHfUeXpawmE\":{\"uid\":\"VHfUeXpawmE\",\"code\":\"Vehicle\",\"name\":\"Vehicle\",\"description\":\"Vehicle\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"ZcBPrXKahq2\":{\"uid\":\"ZcBPrXKahq2\",\"name\":\"Postal code\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"H9IlTX2X6SL\":{\"uid\":\"H9IlTX2X6SL\",\"code\":\"Blood type\",\"name\":\"Blood type\",\"description\":\"Blood type\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"zDhUuAYrxNC\":{\"uid\":\"zDhUuAYrxNC\",\"name\":\"Last name\",\"description\":\"Last name\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"fDd25txQckK\":{\"uid\":\"fDd25txQckK\",\"name\":\"Provider Follow-up and Support Tool\"},\"Qo571yj6Zcn\":{\"uid\":\"Qo571yj6Zcn\",\"code\":\"Latitude\",\"name\":\"Latitude\",\"description\":\"Latitude\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"kyIzQsj96BD\":{\"uid\":\"kyIzQsj96BD\",\"code\":\"Company\",\"name\":\"Company\",\"description\":\"Company\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"A4xFHyieXys\":{\"uid\":\"A4xFHyieXys\",\"code\":\"Occupation\",\"name\":\"Occupation\",\"description\":\"Occupation\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"xs8A6tQJY0s\":{\"uid\":\"xs8A6tQJY0s\",\"name\":\"TB identifier\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"ImspTQPwCqd\":{\"uid\":\"ImspTQPwCqd\",\"code\":\"OU_525\",\"name\":\"Sierra Leone\",\"dimensionItemType\":\"ORGANISATION_UNIT\",\"valueType\":\"TEXT\",\"totalAggregationType\":\"SUM\"},\"OvY4VVhSDeJ\":{\"uid\":\"OvY4VVhSDeJ\",\"name\":\"Weight in kg\",\"description\":\"Weight in kg\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"NUMBER\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"EPEcjy3FWmI\":{\"uid\":\"EPEcjy3FWmI\",\"name\":\"Lab monitoring\",\"description\":\"Laboratory monitoring\"},\"ur1Edk5Oe2n\":{\"uid\":\"ur1Edk5Oe2n\",\"name\":\"TB program\"},\"A03MvHHogjR\":{\"uid\":\"A03MvHHogjR\",\"name\":\"Birth\",\"description\":\"Birth of the baby\"},\"spFvx9FndA4\":{\"uid\":\"spFvx9FndA4\",\"name\":\"Age\",\"description\":\"Age\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"DATE\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"Agywv2JGwuq\":{\"uid\":\"Agywv2JGwuq\",\"code\":\"MMD_PER_MOB\",\"name\":\"Mobile number\",\"description\":\"Mobile number\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"lZGmxYbs97q\":{\"uid\":\"lZGmxYbs97q\",\"code\":\"MMD_PER_ID\",\"name\":\"Unique ID\",\"description\":\"Unique identiifer\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"bbKtnxRZKEP\":{\"uid\":\"bbKtnxRZKEP\",\"name\":\"Postpartum care visit\",\"description\":\"Provision of care for the mother for some weeks after delivery\"},\"IpHINAT79UW\":{\"uid\":\"IpHINAT79UW\",\"name\":\"Child Programme\"},\"ciq2USN94oJ\":{\"uid\":\"ciq2USN94oJ\",\"code\":\"MMD_PER_STA\",\"name\":\"Civil status\",\"description\":\"Civil status\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"ou\":{\"uid\":\"ou\",\"name\":\"Organisation unit\",\"dimensionType\":\"ORGANISATION_UNIT\"},\"edqlbukwRfQ\":{\"uid\":\"edqlbukwRfQ\",\"name\":\"Second antenatal care visit\",\"description\":\"Antenatal care visit\"},\"ZkbAXlQUYJG\":{\"uid\":\"ZkbAXlQUYJG\",\"name\":\"TB visit\",\"description\":\"Routine TB visit\"},\"P2cwLGskgxn\":{\"uid\":\"P2cwLGskgxn\",\"name\":\"Phone number\",\"description\":\"Phone number\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"gHGyrwKPzej\":{\"uid\":\"gHGyrwKPzej\",\"code\":\"MMD_PER_DOB\",\"name\":\"Birth date\",\"description\":\"Birth date\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"DATE\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"eaDHS084uMp\":{\"uid\":\"eaDHS084uMp\",\"name\":\"ANC 1st visit\",\"description\":\"ANC 1st visit\"},\"uy2gU8kT1jF\":{\"uid\":\"uy2gU8kT1jF\",\"name\":\"MNCH / PNC (Adult Woman)\"},\"AuPLng5hLbE\":{\"uid\":\"AuPLng5hLbE\",\"code\":\"National identifier\",\"name\":\"National identifier\",\"description\":\"National identifier\",\"dimensionItemType\":\"PROGRAM_ATTRIBUTE\",\"valueType\":\"TEXT\",\"aggregationType\":\"NONE\",\"totalAggregationType\":\"NONE\"},\"WSGAb5XwJ3Y\":{\"uid\":\"WSGAb5XwJ3Y\",\"name\":\"WHO RMNCH Tracker\"},\"ouname\":{\"name\":\"Organisation Unit Name\",\"dimensionType\":\"ORGANISATION_UNIT\"}},\"dimensions\":{\"zDhUuAYrxNC\":[],\"lw1SqmMlnfh\":[],\"DODgdr5Oo2v\":[],\"Qo571yj6Zcn\":[],\"iESIqZ0R0R0\":[],\"n9nUvfpTsxQ\":[],\"kyIzQsj96BD\":[],\"A4xFHyieXys\":[],\"xs8A6tQJY0s\":[],\"OvY4VVhSDeJ\":[],\"RG7uGl4w5Jq\":[],\"spFvx9FndA4\":[],\"Agywv2JGwuq\":[],\"GUOBQt5K2WI\":[],\"lZGmxYbs97q\":[],\"VqEFza8wbwA\":[],\"ciq2USN94oJ\":[\"wfkKVdPBzho\",\"Yjte6foKMny\"],\"ou\":[\"ImspTQPwCqd\"],\"w75KJ2mc4zz\":[],\"KmEUg2hHEtx\":[],\"G7vUx908SwP\":[],\"o9odfev2Ty5\":[],\"FO4sWYJ64LQ\":[],\"NDXw0cluzSw\":[],\"ruQQnf6rswq\":[],\"cejWyOfXge6\":[\"rBvjJYbMCVx\",\"Mnp3oXrpAbK\"],\"P2cwLGskgxn\":[],\"gHGyrwKPzej\":[],\"pe\":[],\"VHfUeXpawmE\":[],\"AuPLng5hLbE\":[],\"ZcBPrXKahq2\":[],\"H9IlTX2X6SL\":[]}}"; String actualMetaData = new JSONObject((Map) response.extract("metaData")).toString(); assertEquals(expectedMetaData, actualMetaData, false); @@ -90,9 +90,18 @@ public void singleOrgUnitLongitudeAsc() throws JSONException { validateHeader( response, 2, "lw1SqmMlnfh", "Height in cm", "NUMBER", "java.lang.Double", false, true); - // Assert rows. - validateRow(response, 0, List.of("Ngelehun CHC", "28.132946", "170.0")); - validateRow(response, 1, List.of("Ngelehun CHC", "30.552797", "183.0")); + // Assert only first 10 rows. + validateRow(response, 0, List.of("Benguima Grassfield MCHP", "17.906012", "190.0")); + validateRow(response, 1, List.of("Gbainty Wallah CHP", "18.19718", "190.0")); + validateRow(response, 2, List.of("Mabai MCHP", "18.320731", "190.0")); + validateRow(response, 3, List.of("Philip Street Clinic", "18.322645", "190.0")); + validateRow(response, 4, List.of("Karina MCHP", "18.377376", "190.0")); + validateRow(response, 5, List.of("Kayima CHC", "18.381248", "190.0")); + validateRow(response, 6, List.of("Boroma MCHP", "18.401014", "190.0")); + validateRow(response, 7, List.of("Kormende MCHP", "18.411597", "190.0")); + validateRow(response, 8, List.of("Magbassabana MCHP", "18.412926", "190.0")); + validateRow(response, 9, List.of("Small Sefadu MCHP", "18.415899", "190.0")); + validateRow(response, 10, List.of("Niayahun CHP", "18.424439", "190.0")); } @Test diff --git a/dhis-2/dhis-test-e2e/src/test/java/org/hisp/dhis/analytics/trackedentity/TrackedEntityQueryTest.java b/dhis-2/dhis-test-e2e/src/test/java/org/hisp/dhis/analytics/trackedentity/TrackedEntityQueryTest.java index 25b3674ff957..bac1c4e07847 100644 --- a/dhis-2/dhis-test-e2e/src/test/java/org/hisp/dhis/analytics/trackedentity/TrackedEntityQueryTest.java +++ b/dhis-2/dhis-test-e2e/src/test/java/org/hisp/dhis/analytics/trackedentity/TrackedEntityQueryTest.java @@ -320,19 +320,19 @@ void queryWithProgramOnly() { } @Test - void queryWithProgramAndPagination() { + void queryWithProgramAndPagination() throws JSONException { // Given QueryParamsBuilder params = new QueryParamsBuilder() - .add("program=IpHINAT79UW") + .add("asc=lastupdated") .add("lastUpdated=LAST_10_YEARS") - .add("pageSize=10") + .add( + "headers=trackedentity,lastupdated,createdbydisplayname,lastupdatedbydisplayname,geometry,longitude,latitude,ouname,oucode,ounamehierarchy,w75KJ2mc4zz,zDhUuAYrxNC,cejWyOfXge6,lZGmxYbs97q") .add("totalPages=true") - .add("asc=lastupdated") + .add("pageSize=10") + .add("program=IpHINAT79UW") .add("relativePeriodDate=2022-09-27"); - params = withDefaultHeaders(params); - // When ApiResponse response = analyticsTrackedEntityActions.query().get("nEenWmSyUEp", JSON, JSON, params); @@ -343,26 +343,17 @@ void queryWithProgramAndPagination() { .statusCode(200) .body("headers", hasSize(equalTo(14))) .body("rows", hasSize(equalTo(10))) - .body("metaData.pager.page", equalTo(1)) - .body("metaData.pager.pageSize", equalTo(10)) - .body("metaData.pager", not(hasKey("isLastPage"))) - .body("metaData.pager.total", equalTo(19023)) - .body("metaData.pager.pageCount", equalTo(1903)) - .body("metaData.items.ImspTQPwCqd.name", equalTo(null)) - .body("metaData.items.lZGmxYbs97q.name", equalTo("Unique ID")) - .body("metaData.items.zDhUuAYrxNC.name", equalTo("Last name")) - .body("metaData.items.ou.name", equalTo(null)) - .body("metaData.dimensions", hasKey("lZGmxYbs97q")) - .body("metaData.dimensions", hasKey("zDhUuAYrxNC")) - .body("metaData.dimensions", hasKey("pe")) - .body("metaData.dimensions", hasKey("w75KJ2mc4zz")) - .body("metaData.dimensions", hasKey("cejWyOfXge6")) - .body("metaData.dimensions", not(hasKey("ou"))) .body("height", equalTo(10)) .body("width", equalTo(14)) .body("headerWidth", equalTo(14)); - // Validate headers + // Assert metaData. + String expectedMetaData = + "{\"pager\":{\"page\":1,\"total\":19029,\"pageSize\":10,\"pageCount\":1903},\"items\":{\"lZGmxYbs97q\":{\"name\":\"Unique ID\"},\"zDhUuAYrxNC\":{\"name\":\"Last name\"},\"Mnp3oXrpAbK\":{\"code\":\"Female\",\"name\":\"Female\"},\"rBvjJYbMCVx\":{\"code\":\"Male\",\"name\":\"Male\"},\"IpHINAT79UW\":{\"name\":\"Child Programme\"},\"ZzYYXq4fJie\":{\"name\":\"Baby Postnatal\"},\"w75KJ2mc4zz\":{\"name\":\"First name\"},\"2012\":{\"name\":\"2012\"},\"2021\":{\"name\":\"2021\"},\"2020\":{\"name\":\"2020\"},\"cejWyOfXge6\":{\"name\":\"Gender\"},\"2019\":{\"name\":\"2019\"},\"2018\":{\"name\":\"2018\"},\"2017\":{\"name\":\"2017\"},\"LAST_10_YEARS\":{\"name\":\"Last 10 years\"},\"2016\":{\"name\":\"2016\"},\"2015\":{\"name\":\"2015\"},\"pe\":{\"name\":\"Period\"},\"2014\":{\"name\":\"2014\"},\"2013\":{\"name\":\"2013\"},\"A03MvHHogjR\":{\"name\":\"Birth\"},\"pC3N9N77UmT\":{\"uid\":\"pC3N9N77UmT\",\"name\":\"Gender\",\"options\":[{\"uid\":\"rBvjJYbMCVx\",\"code\":\"Male\"},{\"uid\":\"Mnp3oXrpAbK\",\"code\":\"Female\"}]},\"ouname\":{\"name\":\"Organisation Unit Name\",\"dimensionType\":\"ORGANISATION_UNIT\"}},\"dimensions\":{\"lZGmxYbs97q\":[],\"zDhUuAYrxNC\":[],\"pe\":[\"2012\",\"2013\",\"2014\",\"2015\",\"2016\",\"2017\",\"2018\",\"2019\",\"2020\",\"2021\"],\"w75KJ2mc4zz\":[],\"cejWyOfXge6\":[\"rBvjJYbMCVx\",\"Mnp3oXrpAbK\"]}}"; + String actualMetaData = new JSONObject((Map) response.extract("metaData")).toString(); + assertEquals(expectedMetaData, actualMetaData, false); + + // Assert headers. validateHeader( response, 0, "trackedentity", "Tracked entity", "TEXT", "java.lang.String", false, true); validateHeader( @@ -410,7 +401,7 @@ void queryWithProgramAndPagination() { validateHeader( response, 13, "lZGmxYbs97q", "Unique ID", "TEXT", "java.lang.String", false, true); - // Validate the first three rows, as samples. + // Assert rows. validateRow( response, 0, @@ -429,7 +420,6 @@ void queryWithProgramAndPagination() { "Jackson", "Female", "")); - validateRow( response, 1, @@ -448,7 +438,6 @@ void queryWithProgramAndPagination() { "Thomson", "Female", "")); - validateRow( response, 2, @@ -467,6 +456,132 @@ void queryWithProgramAndPagination() { "Johson", "", "")); + validateRow( + response, + 3, + List.of( + "AivS67mcmKY", + "2014-11-15 17:48:49.114", + "", + "", + "", + "", + "", + "Ngelehun CHC", + "OU_559", + "Sierra Leone / Bo / Badjia / Ngelehun CHC", + "Sophia", + "Jackson", + "Female", + "")); + validateRow( + response, + 4, + List.of( + "cBoQxg16B6R", + "2014-11-15 17:56:30.892", + "", + "", + "", + "", + "", + "Ngelehun CHC", + "OU_559", + "Sierra Leone / Bo / Badjia / Ngelehun CHC", + "Emma", + "Thompson", + "Female", + "")); + validateRow( + response, + 5, + List.of( + "SHnmavBQu72", + "2014-11-15 18:00:47.824", + "", + "", + "", + "", + "", + "Ngelehun CHC", + "OU_559", + "Sierra Leone / Bo / Badjia / Ngelehun CHC", + "Olvia", + "Watts", + "Female", + "")); + validateRow( + response, + 6, + List.of( + "PgkxEogQBnX", + "2014-11-15 19:12:23.235", + "", + "", + "", + "", + "", + "Ngelehun CHC", + "OU_559", + "Sierra Leone / Bo / Badjia / Ngelehun CHC", + "Lily", + "Matthews", + "Female", + "")); + validateRow( + response, + 7, + List.of( + "FcA5liuWG0x", + "2014-11-15 19:51:08.162", + "", + "", + "", + "", + "", + "Ngelehun CHC", + "OU_559", + "Sierra Leone / Bo / Badjia / Ngelehun CHC", + "Noah", + "Thompson", + "Male", + "")); + validateRow( + response, + 8, + List.of( + "nRcbpL1q9KL", + "2014-11-15 21:19:09.35", + "", + "", + "", + "", + "", + "Ngelehun CHC", + "OU_559", + "Sierra Leone / Bo / Badjia / Ngelehun CHC", + "James", + "Dunn", + "Male", + "")); + validateRow( + response, + 9, + List.of( + "UtDZmrX5lSd", + "2014-11-15 21:20:06.375", + "", + "", + "", + "", + "", + "Ngelehun CHC", + "OU_559", + "Sierra Leone / Bo / Badjia / Ngelehun CHC", + "Tim", + "Johnson", + "Male", + "")); } @Test @@ -1486,17 +1601,17 @@ public void queryWithProgramAndFilterByEventDate() { } @Test - public void queryWithProgramAndFilterByEnrollmentDate() { + public void queryWithProgramAndFilterByEnrollmentDate() throws JSONException { // Given QueryParamsBuilder params = new QueryParamsBuilder() - .add("program=IpHINAT79UW") + .add( + "headers=trackedentity,lastupdated,createdbydisplayname,lastupdatedbydisplayname,geometry,longitude,latitude,ouname,oucode,ounamehierarchy,w75KJ2mc4zz,zDhUuAYrxNC,cejWyOfXge6,lZGmxYbs97q") .add("enrollmentDate=IpHINAT79UW.LAST_5_YEARS") + .add("program=IpHINAT79UW") .add("desc=lastupdated") .add("relativePeriodDate=2023-09-27"); - params = withDefaultHeaders(params); - // When ApiResponse response = analyticsTrackedEntityActions.query().get("nEenWmSyUEp", JSON, JSON, params); @@ -1507,29 +1622,86 @@ public void queryWithProgramAndFilterByEnrollmentDate() { .statusCode(200) .body("headers", hasSize(equalTo(14))) .body("rows", hasSize(equalTo(50))) - .body("metaData.dimensions", not(hasKey("ou"))) - .body("metaData.dimensions", hasKey("pe")) - .body("metaData.dimensions.pe", hasSize(equalTo(5))) - .body("metaData.dimensions.pe", hasItem("2018")) - .body("metaData.dimensions.pe", hasItem("2019")) - .body("metaData.dimensions.pe", hasItem("2020")) - .body("metaData.dimensions.pe", hasItem("2021")) - .body("metaData.dimensions.pe", hasItem("2022")) - .body("metaData.items.pe.name", equalTo("Period")) - .body("metaData.items.2018.name", equalTo("2018")) - .body("metaData.items.2019.name", equalTo("2019")) - .body("metaData.items.2020.name", equalTo("2020")) - .body("metaData.items.2021.name", equalTo("2021")) - .body("metaData.items.2022.name", equalTo("2022")) - .body("metaData.items.LAST_5_YEARS.name", equalTo("Last 5 years")) .body("height", equalTo(50)) .body("width", equalTo(14)) .body("headerWidth", equalTo(14)); - // Validate the first three rows, as samples. + // Assert metaData. + String expectedMetaData = + "{\"pager\":{\"page\":1,\"pageSize\":50,\"isLastPage\":false},\"items\":{\"lZGmxYbs97q\":{\"name\":\"Unique ID\"},\"zDhUuAYrxNC\":{\"name\":\"Last name\"},\"Mnp3oXrpAbK\":{\"code\":\"Female\",\"name\":\"Female\"},\"rBvjJYbMCVx\":{\"code\":\"Male\",\"name\":\"Male\"},\"IpHINAT79UW\":{\"name\":\"Child Programme\"},\"ZzYYXq4fJie\":{\"name\":\"Baby Postnatal\"},\"w75KJ2mc4zz\":{\"name\":\"First name\"},\"2022\":{\"name\":\"2022\"},\"2021\":{\"name\":\"2021\"},\"2020\":{\"name\":\"2020\"},\"LAST_5_YEARS\":{\"name\":\"Last 5 years\"},\"cejWyOfXge6\":{\"name\":\"Gender\"},\"2019\":{\"name\":\"2019\"},\"2018\":{\"name\":\"2018\"},\"pe\":{\"name\":\"Period\"},\"IpHINAT79UW.pe\":{\"name\":\"Period\"},\"A03MvHHogjR\":{\"name\":\"Birth\"},\"pC3N9N77UmT\":{\"uid\":\"pC3N9N77UmT\",\"name\":\"Gender\",\"options\":[{\"uid\":\"rBvjJYbMCVx\",\"code\":\"Male\"},{\"uid\":\"Mnp3oXrpAbK\",\"code\":\"Female\"}]},\"ouname\":{\"name\":\"Organisation Unit Name\",\"dimensionType\":\"ORGANISATION_UNIT\"}},\"dimensions\":{\"lZGmxYbs97q\":[],\"zDhUuAYrxNC\":[],\"pe\":[\"2018\",\"2019\",\"2020\",\"2021\",\"2022\"],\"w75KJ2mc4zz\":[],\"cejWyOfXge6\":[\"rBvjJYbMCVx\",\"Mnp3oXrpAbK\"]}}"; + String actualMetaData = new JSONObject((Map) response.extract("metaData")).toString(); + assertEquals(expectedMetaData, actualMetaData, false); + + // Assert headers. + validateHeader( + response, 0, "trackedentity", "Tracked entity", "TEXT", "java.lang.String", false, true); + validateHeader( + response, + 1, + "lastupdated", + "Last updated", + "DATETIME", + "java.time.LocalDateTime", + false, + true); + validateHeader( + response, 2, "createdbydisplayname", "Created by", "TEXT", "java.lang.String", false, true); + validateHeader( + response, + 3, + "lastupdatedbydisplayname", + "Last updated by", + "TEXT", + "java.lang.String", + false, + true); + validateHeader(response, 4, "geometry", "Geometry", "TEXT", "java.lang.String", false, true); + validateHeader( + response, 5, "longitude", "Longitude", "NUMBER", "java.lang.Double", false, true); + validateHeader(response, 6, "latitude", "Latitude", "NUMBER", "java.lang.Double", false, true); + validateHeader( + response, 7, "ouname", "Organisation unit name", "TEXT", "java.lang.String", false, true); + validateHeader( + response, 8, "oucode", "Organisation unit code", "TEXT", "java.lang.String", false, true); + validateHeader( + response, + 9, + "ounamehierarchy", + "Organisation unit hierarchy", + "TEXT", + "java.lang.String", + false, + true); + validateHeader( + response, 10, "w75KJ2mc4zz", "First name", "TEXT", "java.lang.String", false, true); + validateHeader( + response, 11, "zDhUuAYrxNC", "Last name", "TEXT", "java.lang.String", false, true); + validateHeader(response, 12, "cejWyOfXge6", "Gender", "TEXT", "java.lang.String", false, true); + validateHeader( + response, 13, "lZGmxYbs97q", "Unique ID", "TEXT", "java.lang.String", false, true); + + // Assert only first three rows, as samples. validateRow( response, 0, + List.of( + "PQfMcpmXeFE", + "2016-08-03 23:49:43.309", + "", + "", + "", + "", + "", + "Ngelehun CHC", + "OU_559", + "Sierra Leone / Bo / Badjia / Ngelehun CHC", + "John", + "Kelly", + "Male", + "")); + validateRow( + response, + 1, List.of( "EaOyKGOIGRp", "2016-08-03 23:47:14.517", @@ -1545,10 +1717,9 @@ public void queryWithProgramAndFilterByEnrollmentDate() { "Jones", "Female", "")); - validateRow( response, - 1, + 2, List.of( "lSxhGlVaTvy", "2016-04-21 16:01:20.435", @@ -1564,25 +1735,6 @@ public void queryWithProgramAndFilterByEnrollmentDate() { "Bryant", "Female", "")); - - validateRow( - response, - 2, - List.of( - "jdQTFA9gpvc", - "2015-08-06 21:20:52.781", - "", - "", - "", - "", - "", - "Kunsho CHP", - "OU_193254", - "Sierra Leone / Bombali / Makari Gbanti / Kunsho CHP", - "Chris", - "Mendoza", - "Male", - "")); } @Test @@ -1745,15 +1897,15 @@ public void queryWithProgramAndFilterByEventDataValue() { } @Test - public void queryWithProgramAndEnrollmentDateAndNegativeEnrollmentOffset() { + public void queryWithProgramAndEnrollmentDateAndNegativeEnrollmentOffset() throws JSONException { // Given QueryParamsBuilder params = new QueryParamsBuilder() - .add("program=IpHINAT79UW") + .add("headers=ouname,w75KJ2mc4zz,zDhUuAYrxNC") .add("enrollmentDate=IpHINAT79UW[1].LAST_YEAR") + .add("program=IpHINAT79UW") .add("desc=lastupdated") - .add("relativePeriodDate=2023-04-03") - .add("headers=ouname,w75KJ2mc4zz,zDhUuAYrxNC"); + .add("relativePeriodDate=2023-04-03"); // When ApiResponse response = @@ -1769,7 +1921,13 @@ public void queryWithProgramAndEnrollmentDateAndNegativeEnrollmentOffset() { .body("width", equalTo(3)) .body("headerWidth", equalTo(3)); - // Validate headers + // Assert metaData. + String expectedMetaData = + "{\"pager\":{\"page\":1,\"pageSize\":50,\"isLastPage\":false},\"items\":{\"lZGmxYbs97q\":{\"name\":\"Unique ID\"},\"zDhUuAYrxNC\":{\"name\":\"Last name\"},\"pe\":{\"name\":\"Period\"},\"IpHINAT79UW\":{\"name\":\"Child Programme\"},\"ZzYYXq4fJie\":{\"name\":\"Baby Postnatal\"},\"IpHINAT79UW.pe\":{\"name\":\"Period\"},\"w75KJ2mc4zz\":{\"name\":\"First name\"},\"A03MvHHogjR\":{\"name\":\"Birth\"},\"2022\":{\"name\":\"2022\"},\"LAST_YEAR\":{\"name\":\"Last year\"},\"cejWyOfXge6\":{\"name\":\"Gender\"},\"ouname\":{\"name\":\"Organisation Unit Name\",\"dimensionType\":\"ORGANISATION_UNIT\"}},\"dimensions\":{\"lZGmxYbs97q\":[],\"zDhUuAYrxNC\":[],\"pe\":[\"2022\"],\"w75KJ2mc4zz\":[],\"cejWyOfXge6\":[\"rBvjJYbMCVx\",\"Mnp3oXrpAbK\"]}}"; + String actualMetaData = new JSONObject((Map) response.extract("metaData")).toString(); + assertEquals(expectedMetaData, actualMetaData, false); + + // Assert headers. validateHeader( response, 0, "ouname", "Organisation unit name", "TEXT", "java.lang.String", false, true); validateHeader( @@ -1777,10 +1935,10 @@ public void queryWithProgramAndEnrollmentDateAndNegativeEnrollmentOffset() { validateHeader( response, 2, "zDhUuAYrxNC", "Last name", "TEXT", "java.lang.String", false, true); - // Validate the first three rows, as samples. - validateRow(response, 0, List.of("Ngelehun CHC", "Anna", "Jones")); - validateRow(response, 1, List.of("Masoko MCHP", "Diane", "Bryant")); - validateRow(response, 2, List.of("Kunsho CHP", "Chris", "Mendoza")); + // Assert first three rows, as samples. + validateRow(response, 0, List.of("Ngelehun CHC", "John", "Kelly")); + validateRow(response, 1, List.of("Ngelehun CHC", "Anna", "Jones")); + validateRow(response, 2, List.of("Masoko MCHP", "Diane", "Bryant")); } @Test