Skip to content

Commit

Permalink
Merge pull request #106 from mutesasira/main
Browse files Browse the repository at this point in the history
First Release
  • Loading branch information
mutesasira authored Jul 12, 2023
2 parents a1872a3 + abd1350 commit d72db68
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 32 deletions.
5 changes: 3 additions & 2 deletions setupProxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
60 changes: 30 additions & 30 deletions src/Queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -311,48 +311,48 @@ 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<string, Error>(
["initialing"],
async ({ signal }) => {
const {
directives: { rows, headers },
//directives: { rows, headers },
systemInfo: { systemId, systemName, instanceBaseUrl },
me: { organisationUnits, authorities },
levels: { organisationUnitLevels },
groups: { organisationUnitGroups },
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(
Expand Down

0 comments on commit d72db68

Please sign in to comment.