Skip to content

Commit

Permalink
Merge branch 'development' of https://github.com/EyeSeeTea/zebra-dev
Browse files Browse the repository at this point in the history
…into feat/d2-logger
  • Loading branch information
deeonwuli committed Oct 18, 2024
2 parents df2d1ea + ab15fe6 commit f564237
Show file tree
Hide file tree
Showing 91 changed files with 4,987 additions and 427 deletions.
35 changes: 31 additions & 4 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-09T10:56:24.909Z\n"
"PO-Revision-Date: 2024-10-09T10:56:24.909Z\n"

msgid "Low"
msgstr ""
Expand Down Expand Up @@ -90,7 +90,10 @@ msgstr ""
msgid "Notes"
msgstr ""

msgid "Notes"
msgid "Edit Profile"
msgstr ""

msgid "Currently assigned:"
msgstr ""

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

msgid "events"
msgstr ""

msgid "Performance overview"
msgstr ""

Expand All @@ -153,13 +159,19 @@ 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 ""

msgid "Add another"
msgstr ""

msgid "Create Event form cannot be loaded"
msgid "Form cannot be loaded"
msgstr ""

msgid "Disease Outbreak saved successfully"
Expand All @@ -174,6 +186,9 @@ msgstr ""
msgid "Risk Assessment Questionnaire saved successfully"
msgstr ""

msgid "Incident Management Team Member saved successfully"
msgstr ""

msgid "Incident Action Plan"
msgstr ""

Expand All @@ -183,5 +198,17 @@ msgstr ""
msgid "Incident Management Team Builder"
msgstr ""

msgid "Edit Role"
msgstr ""

msgid "Assign Role"
msgstr ""

msgid "Delete Role"
msgstr ""

msgid "Delete team role"
msgstr ""

msgid "Resources"
msgstr ""
37 changes: 35 additions & 2 deletions 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-09T10:56:24.909Z\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,15 @@ msgstr ""
msgid "Edit Details"
msgstr ""

msgid "Notes"
msgstr ""

msgid "Edit Profile"
msgstr ""

msgid "Currently assigned:"
msgstr ""

msgid "Create Event"
msgstr ""

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

msgid "events"
msgstr ""

msgid "Performance overview"
msgstr ""

Expand All @@ -146,13 +158,19 @@ 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 ""

msgid "Add another"
msgstr ""

msgid "Create Event form cannot be loaded"
msgid "Form cannot be loaded"
msgstr ""

msgid "Disease Outbreak saved successfully"
Expand All @@ -167,6 +185,9 @@ msgstr ""
msgid "Risk Assessment Questionnaire saved successfully"
msgstr ""

msgid "Incident Management Team Member saved successfully"
msgstr ""

msgid "Incident Action Plan"
msgstr ""

Expand All @@ -176,6 +197,18 @@ msgstr ""
msgid "Incident Management Team Builder"
msgstr ""

msgid "Edit Role"
msgstr ""

msgid "Assign Role"
msgstr ""

msgid "Delete Role"
msgstr ""

msgid "Delete team role"
msgstr ""

msgid "Resources"
msgstr ""

Expand Down
48 changes: 44 additions & 4 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,23 @@ 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 { RoleRepository } from "./domain/repositories/RoleRepository";
import { RoleD2Repository } from "./data/repositories/RoleD2Repository";
import { RoleTestRepository } from "./data/repositories/test/RoleTestRepository";
import { IncidentManagementTeamTestRepository } from "./data/repositories/test/IncidentManagementTeamTestRepository";
import { IncidentManagementTeamD2Repository } from "./data/repositories/IncidentManagementTeamD2Repository";
import { IncidentManagementTeamRepository } from "./domain/repositories/IncidentManagementTeamRepository";
import { GetIncidentManagementTeamByIdUseCase } from "./domain/usecases/GetIncidentManagementTeamByIdUseCase";
import { DeleteIncidentManagementTeamMemberRoleUseCase } from "./domain/usecases/DeleteIncidentManagementTeamMemberRoleUseCase";
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,15 +73,16 @@ type Repositories = {
riskAssessmentRepository: RiskAssessmentRepository;
mapConfigRepository: MapConfigRepository;
performanceOverviewRepository: PerformanceOverviewRepository;
roleRepository: RoleRepository;
incidentManagementTeamRepository: IncidentManagementTeamRepository;
chartConfigRepository: ChartConfigRepository;
systemRepository: SystemRepository;
};

function getCompositionRoot(repositories: Repositories) {
return {
getWithOptions: new GetEntityWithOptionsUseCase(repositories),
save: new SaveEntityUseCase(
repositories.diseaseOutbreakEventRepository,
repositories.riskAssessmentRepository
),
save: new SaveEntityUseCase(repositories),
users: {
getCurrent: new GetCurrentUserUseCase(repositories.usersRepository),
},
Expand All @@ -76,11 +95,21 @@ function getCompositionRoot(repositories: Repositories) {
repositories.optionsRepository
),
},
incidentManagementTeam: {
get: new GetIncidentManagementTeamByIdUseCase(repositories),
deleteIncidentManagementTeamMemberRole:
new DeleteIncidentManagementTeamMemberRoleUseCase(repositories),
},
performanceOverview: {
getPerformanceOverviewMetrics: new GetAllPerformanceOverviewMetricsUseCase(
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 +118,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 +137,10 @@ export function getWebappCompositionRoot(api: D2Api) {
riskAssessmentRepository: new RiskAssessmentD2Repository(api),
mapConfigRepository: new MapConfigD2Repository(api),
performanceOverviewRepository: new PerformanceOverviewD2Repository(api, dataStoreClient),
roleRepository: new RoleD2Repository(api),
incidentManagementTeamRepository: new IncidentManagementTeamD2Repository(api),
chartConfigRepository: new ChartConfigD2Repository(dataStoreClient),
systemRepository: new SystemD2Repository(api),
};

return getCompositionRoot(repositories);
Expand All @@ -122,6 +158,10 @@ export function getTestCompositionRoot() {
riskAssessmentRepository: new RiskAssessmentTestRepository(),
mapConfigRepository: new MapConfigTestRepository(),
performanceOverviewRepository: new PerformanceOverviewTestRepository(),
roleRepository: new RoleTestRepository(),
incidentManagementTeamRepository: new IncidentManagementTeamTestRepository(),
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 @@ -24,7 +24,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 f564237

Please sign in to comment.