Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
sevenreup committed Jul 17, 2024
1 parent 6a8b8c5 commit d4462c3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
12 changes: 9 additions & 3 deletions src/app/(dashboard)/stats/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,20 @@ export async function fetchData(formData: FormData) {
baseFilter,
false
),
createPatientFilters(["newly-diagnosed-client"], null, baseFilter, true),
createPatientFilters(["client-already-on-art"], null, baseFilter, true),
createPatientFilters(["exposed-infant"], null, baseFilter, true),
]);
const summary: string[] = [
"Total visits",
"Newly diagnosed clients (created)",
"Already on Art (created)",
"Exposed infant (created)",
"Newly diagnosed clients (new)",
"Already on Art (new)",
"Exposed infant (new)",
"Milestone answered",
"VL collected answered",
"Newly diagnosed clients (all)",
"Already on Art (all)",
"Exposed infant (all)",
];

return {
Expand Down
9 changes: 6 additions & 3 deletions src/app/(dashboard)/stats/filters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const createQuestionnaireResponseFilters = (
questionnaire: string,
date: string | string[] | null,
baseFilter: Record<string, string>[],
hasCount = true,
hasCount = true
) => {
const query = new QueryParam({
questionnaire: questionnaire,
Expand Down Expand Up @@ -45,13 +45,16 @@ export const createQuestionnaireResponseFilters = (
export const createPatientFilters = (
types: PatientType[] | undefined = undefined,
date: string | string[] | null,
baseFilter: Record<string, string>[]
baseFilter: Record<string, string>[],
onlyActive = false
) => {
const query = new QueryParam({
_summary: "count",
});
query.fromArray(baseFilter);

if (onlyActive) {
query.add("active", true);
}
query.remove("date");
query.remove("dateRange");
if (date) {
Expand Down

0 comments on commit d4462c3

Please sign in to comment.