Skip to content

Commit

Permalink
Merge pull request #21 from EyeSeeTea/feature/717-performance-section
Browse files Browse the repository at this point in the history
feature: 717 performance section
  • Loading branch information
bhavananarayanan authored Oct 15, 2024
2 parents 41973df + ea0e609 commit 6a19d64
Show file tree
Hide file tree
Showing 43 changed files with 2,440 additions and 332 deletions.
16 changes: 11 additions & 5 deletions i18n/en.pot
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ msgstr ""
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"POT-Creation-Date: 2024-09-30T07:39:32.843Z\n"
"PO-Revision-Date: 2024-09-30T07:39:32.843Z\n"
"POT-Creation-Date: 2024-10-06T18:13:02.378Z\n"
"PO-Revision-Date: 2024-10-06T18:13:02.378Z\n"

msgid "Low"
msgstr ""
Expand Down Expand Up @@ -90,9 +90,6 @@ msgstr ""
msgid "Notes"
msgstr ""

msgid "Notes"
msgstr ""

msgid "Create Event"
msgstr ""

Expand Down Expand Up @@ -138,6 +135,9 @@ msgstr ""
msgid "7-1-7 performance"
msgstr ""

msgid "events"
msgstr ""

msgid "Performance overview"
msgstr ""

Expand All @@ -153,6 +153,12 @@ msgstr ""
msgid "Add new Assessment"
msgstr ""

msgid "Risk assessment incomplete"
msgstr ""

msgid "Risks associated with this event have not yet been assessed."
msgstr ""

msgid "N/A"
msgstr ""

Expand Down
14 changes: 13 additions & 1 deletion i18n/es.po
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
msgid ""
msgstr ""
"Project-Id-Version: i18next-conv\n"
"POT-Creation-Date: 2024-09-12T14:10:04.460Z\n"
"POT-Creation-Date: 2024-10-06T18:13:02.378Z\n"
"PO-Revision-Date: 2018-10-25T09:02:35.143Z\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
Expand Down Expand Up @@ -86,6 +86,9 @@ msgstr ""
msgid "Edit Details"
msgstr ""

msgid "Notes"
msgstr ""

msgid "Create Event"
msgstr ""

Expand Down Expand Up @@ -131,6 +134,9 @@ msgstr ""
msgid "7-1-7 performance"
msgstr ""

msgid "events"
msgstr ""

msgid "Performance overview"
msgstr ""

Expand All @@ -146,6 +152,12 @@ msgstr ""
msgid "Add new Assessment"
msgstr ""

msgid "Risk assessment incomplete"
msgstr ""

msgid "Risks associated with this event have not yet been assessed."
msgstr ""

msgid "N/A"
msgstr ""

Expand Down
24 changes: 24 additions & 0 deletions src/CompositionRoot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { GetAllDiseaseOutbreaksUseCase } from "./domain/usecases/GetAllDiseaseOu
import { MapDiseaseOutbreakToAlertsUseCase } from "./domain/usecases/MapDiseaseOutbreakToAlertsUseCase";
import { AlertRepository } from "./domain/repositories/AlertRepository";
import { AlertTestRepository } from "./data/repositories/test/AlertTestRepository";
import { Get717PerformanceUseCase } from "./domain/usecases/Get717PerformanceUseCase";
import { GetEntityWithOptionsUseCase } from "./domain/usecases/GetEntityWithOptionsUseCase";
import { SaveEntityUseCase } from "./domain/usecases/SaveEntityUseCase";
import { RiskAssessmentRepository } from "./domain/repositories/RiskAssessmentRepository";
Expand All @@ -41,6 +42,15 @@ import { AlertSyncDataStoreTestRepository } from "./data/repositories/test/Alert
import { AlertSyncRepository } from "./domain/repositories/AlertSyncRepository";
import { DataStoreClient } from "./data/DataStoreClient";
import { GetTotalCardCountsUseCase } from "./domain/usecases/GetTotalCardCountsUseCase";
import { ChartConfigRepository } from "./domain/repositories/ChartConfigRepository";
import { GetChartConfigByTypeUseCase } from "./domain/usecases/GetChartConfigByTypeUseCase";
import { ChartConfigTestRepository } from "./data/repositories/test/ChartConfigTestRepository";
import { ChartConfigD2Repository } from "./data/repositories/ChartConfigD2Repository";
import { GetAnalyticsRuntimeUseCase } from "./domain/usecases/GetAnalyticsRuntimeUseCase";
import { SystemRepository } from "./domain/repositories/SystemRepository";
import { SystemD2Repository } from "./data/repositories/SystemD2Repository";
import { SystemTestRepository } from "./data/repositories/test/SystemTestRepository";
import { GetOverviewCardsUseCase } from "./domain/usecases/GetOverviewCardsUseCase";

export type CompositionRoot = ReturnType<typeof getCompositionRoot>;

Expand All @@ -55,6 +65,8 @@ type Repositories = {
riskAssessmentRepository: RiskAssessmentRepository;
mapConfigRepository: MapConfigRepository;
performanceOverviewRepository: PerformanceOverviewRepository;
chartConfigRepository: ChartConfigRepository;
systemRepository: SystemRepository;
};

function getCompositionRoot(repositories: Repositories) {
Expand All @@ -81,6 +93,11 @@ function getCompositionRoot(repositories: Repositories) {
repositories
),
getTotalCardCounts: new GetTotalCardCountsUseCase(repositories),
get717Performance: new Get717PerformanceUseCase(repositories),
getAnalyticsRuntime: new GetAnalyticsRuntimeUseCase(repositories),
getOverviewCards: new GetOverviewCardsUseCase(
repositories.performanceOverviewRepository
),
},
maps: {
getConfig: new GetMapConfigUseCase(repositories.mapConfigRepository),
Expand All @@ -89,6 +106,9 @@ function getCompositionRoot(repositories: Repositories) {
getAll: new GetAllOrgUnitsUseCase(repositories.orgUnitRepository),
getProvinces: new GetProvincesOrgUnits(repositories.orgUnitRepository),
},
charts: {
getCases: new GetChartConfigByTypeUseCase(repositories.chartConfigRepository),
},
};
}

Expand All @@ -105,6 +125,8 @@ export function getWebappCompositionRoot(api: D2Api) {
riskAssessmentRepository: new RiskAssessmentD2Repository(api),
mapConfigRepository: new MapConfigD2Repository(api),
performanceOverviewRepository: new PerformanceOverviewD2Repository(api, dataStoreClient),
chartConfigRepository: new ChartConfigD2Repository(dataStoreClient),
systemRepository: new SystemD2Repository(api),
};

return getCompositionRoot(repositories);
Expand All @@ -122,6 +144,8 @@ export function getTestCompositionRoot() {
riskAssessmentRepository: new RiskAssessmentTestRepository(),
mapConfigRepository: new MapConfigTestRepository(),
performanceOverviewRepository: new PerformanceOverviewTestRepository(),
chartConfigRepository: new ChartConfigTestRepository(),
systemRepository: new SystemTestRepository(),
};

return getCompositionRoot(repositories);
Expand Down
53 changes: 53 additions & 0 deletions src/data/repositories/ChartConfigD2Repository.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import { DataStoreClient } from "../DataStoreClient";
import { FutureData } from "../api-futures";
import { ChartConfigRepository } from "../../domain/repositories/ChartConfigRepository";
import { Id } from "../../domain/entities/Ref";

type ChartConfig = {
key: string;
casesId: Id;
deathsId: Id;
riskAssessmentHistoryId: Id;
};

const chartConfigDatastoreKey = "charts-config";

export class ChartConfigD2Repository implements ChartConfigRepository {
constructor(private dataStoreClient: DataStoreClient) {}

public getCases(chartKey: string): FutureData<string> {
return this.dataStoreClient
.getObject<ChartConfig[]>(chartConfigDatastoreKey)
.map(chartConfigs => {
const currentChart = chartConfigs?.find(
chartConfig => chartConfig.key === chartKey
);
if (currentChart) return currentChart.casesId;
else throw new Error(`Chart id not found for ${chartKey}`);
});
}

public getDeaths(chartKey: string): FutureData<string> {
return this.dataStoreClient
.getObject<ChartConfig[]>(chartConfigDatastoreKey)
.map(chartConfigs => {
const currentChart = chartConfigs?.find(
chartConfig => chartConfig.key === chartKey
);
if (currentChart) return currentChart.deathsId;
else throw new Error(`Chart id not found for ${chartKey}`);
});
}

public getRiskAssessmentHistory(chartKey: string): FutureData<string> {
return this.dataStoreClient
.getObject<ChartConfig[]>(chartConfigDatastoreKey)
.map(chartConfigs => {
const currentChart = chartConfigs?.find(
chartConfig => chartConfig.key === chartKey
);
if (currentChart) return currentChart.riskAssessmentHistoryId;
else throw new Error(`Chart id not found for ${chartKey}`);
});
}
}
2 changes: 1 addition & 1 deletion src/data/repositories/DiseaseOutbreakEventD2Repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class DiseaseOutbreakEventD2Repository implements DiseaseOutbreakEventRep
program: RTSL_ZEBRA_PROGRAM_ID,
orgUnit: RTSL_ZEBRA_ORG_UNIT_ID,
trackedEntity: id,
fields: { attributes: true, trackedEntity: true },
fields: { attributes: true, trackedEntity: true, updatedAt: true },
})
)
.flatMap(response => assertOrError(response.instances[0], "Tracked entity"))
Expand Down
Loading

0 comments on commit 6a19d64

Please sign in to comment.