From abd1350efa23abd0c94608e80b4d09078e979dd1 Mon Sep 17 00:00:00 2001 From: mutesasira Date: Wed, 12 Jul 2023 09:15:06 +0300 Subject: [PATCH] First Release --- setupProxy.js | 5 +++-- src/Queries.ts | 60 +++++++++++++++++++++++++------------------------- 2 files changed, 33 insertions(+), 32 deletions(-) diff --git a/setupProxy.js b/setupProxy.js index 2abab86..eef1a81 100644 --- a/setupProxy.js +++ b/setupProxy.js @@ -18,9 +18,10 @@ const onProxyRes = (proxyRes) => { // proxy middleware options const options = { // target: "https://eidsr.health.go.ug", // target host - target: "https://dev.ndpme.go.ug/ndpdb", // target host + // target: "https://dev.ndpme.go.ug/ndpdb", // target host + // target: "https://dev.ndpme.go.ug/ndpdb", // target host // target: "http://localhost:8080", // target host - + target: "https://tests.dhis2.hispuganda.org/hmis/", // target host // target: "https://hmis-repo.health.go.ug/repo", // target host // target: "https://tests.dhis2.stephocay.com/sia", // target host // target: "https://etracker.moh.gov.rw/individualrecords", // target host diff --git a/src/Queries.ts b/src/Queries.ts index 1b07769..54a084d 100644 --- a/src/Queries.ts +++ b/src/Queries.ts @@ -311,16 +311,16 @@ export const useInitials = (storage: "data-store" | "es") => { systemInfo: { resource: "system/info", }, - directives: { - resource: - "analytics.json?dimension=dx:B04qyv8sHLZ;Et0jLLFoPiQ;FJ1pjZ5Edzf;HolY9bB9ndg;I8NkRKchMoU;N7r57cuvssW;PQxdLS3vke3;Q18G7d3DPOg;QYISgIjXTJC;QgvBHBb5xcS;UEDzAaR5GpB;WdilrXx08R4;gjqIp8H7948;gypjprrtiKV;h4lJWKnqnxx;lYoAOhykYUW;m3xNIoQ2esR;nOnQwK1sDaN;tWRpQ8HFWk4;um8prFWwCYU;w6VmDxFste0;wRshJ7SJcHq;wXeABLEj9Vj&dimension=pe:2020July;2021July;2022July;2023July;2024July&dimension=ou:qjk1ujdzlss&aggregationType=MAX", - }, + // directives: { + // resource: + // "analytics.json?dimension=dx:B04qyv8sHLZ;Et0jLLFoPiQ;FJ1pjZ5Edzf;HolY9bB9ndg;I8NkRKchMoU;N7r57cuvssW;PQxdLS3vke3;Q18G7d3DPOg;QYISgIjXTJC;QgvBHBb5xcS;UEDzAaR5GpB;WdilrXx08R4;gjqIp8H7948;gypjprrtiKV;h4lJWKnqnxx;lYoAOhykYUW;m3xNIoQ2esR;nOnQwK1sDaN;tWRpQ8HFWk4;um8prFWwCYU;w6VmDxFste0;wRshJ7SJcHq;wXeABLEj9Vj&dimension=pe:2020July;2021July;2022July;2023July;2024July&dimension=ou:qjk1ujdzlss&aggregationType=MAX", + // }, }; return useQuery( ["initialing"], async ({ signal }) => { const { - directives: { rows, headers }, + //directives: { rows, headers }, systemInfo: { systemId, systemName, instanceBaseUrl }, me: { organisationUnits, authorities }, levels: { organisationUnitLevels }, @@ -328,31 +328,31 @@ export const useInitials = (storage: "data-store" | "es") => { dataSets: { dataSets }, }: any = await engine.query(ouQuery); - const processed = flattenDHIS2Data( - rows.map((row: string[]) => { - return fromPairs( - row.map((value, index) => { - const header = headers?.[index]; - return [header.name, value]; - }) - ); - }), - "processDirectives" - ); - - const maxPe = max(processed.map((d: any) => d.pe)); - - Object.entries( - groupBy( - processed.filter((d: any) => d.pe === maxPe), - "label" - ) - ).forEach(([id, values]) => - calculatedApi.add({ - id, - value: uniqBy(values, "dx").length, - }) - ); + // const processed = flattenDHIS2Data( + // rows.map((row: string[]) => { + // return fromPairs( + // row.map((value, index) => { + // const header = headers?.[index]; + // return [header.name, value]; + // }) + // ); + // }), + // "processDirectives" + // ); + + //const maxPe = max(processed.map((d: any) => d.pe)); + + // Object.entries( + // groupBy( + // processed.filter((d: any) => d.pe === maxPe), + // "label" + // ) + // ).forEach(([id, values]) => + // calculatedApi.add({ + // id, + // value: uniqBy(values, "dx").length, + // }) + // ); const isAdmin = authorities.indexOf("IDVT_ADMINISTRATION") !== -1; const facilities: string[] = organisationUnits.map(