Skip to content

Commit

Permalink
Merge development and solve conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
anagperal committed Oct 18, 2024
2 parents 8746261 + ab15fe6 commit d641ed1
Show file tree
Hide file tree
Showing 43 changed files with 2,434 additions and 326 deletions.
9 changes: 9 additions & 0 deletions i18n/en.pot
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ msgstr ""
msgid "7-1-7 performance"
msgstr ""

msgid "events"
msgstr ""

msgid "Performance overview"
msgstr ""

Expand All @@ -156,6 +159,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
9 changes: 9 additions & 0 deletions i18n/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,9 @@ msgstr ""
msgid "7-1-7 performance"
msgstr ""

msgid "events"
msgstr ""

msgid "Performance overview"
msgstr ""

Expand All @@ -155,6 +158,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 @@ -45,6 +46,15 @@ import { RoleRepository } from "./domain/repositories/RoleRepository";
import { RoleD2Repository } from "./data/repositories/RoleD2Repository";
import { RoleTestRepository } from "./data/repositories/test/RoleTestRepository";
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 @@ -60,6 +70,8 @@ type Repositories = {
mapConfigRepository: MapConfigRepository;
performanceOverviewRepository: PerformanceOverviewRepository;
roleRepository: RoleRepository;
chartConfigRepository: ChartConfigRepository;
systemRepository: SystemRepository;
};

function getCompositionRoot(repositories: Repositories) {
Expand All @@ -85,6 +97,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 @@ -93,6 +110,9 @@ function getCompositionRoot(repositories: Repositories) {
getAll: new GetAllOrgUnitsUseCase(repositories.orgUnitRepository),
getProvinces: new GetProvincesOrgUnits(repositories.orgUnitRepository),
},
charts: {
getCases: new GetChartConfigByTypeUseCase(repositories.chartConfigRepository),
},
};
}

Expand All @@ -110,6 +130,8 @@ export function getWebappCompositionRoot(api: D2Api) {
mapConfigRepository: new MapConfigD2Repository(api),
performanceOverviewRepository: new PerformanceOverviewD2Repository(api, dataStoreClient),
roleRepository: new RoleD2Repository(api),
chartConfigRepository: new ChartConfigD2Repository(dataStoreClient),
systemRepository: new SystemD2Repository(api),
};

return getCompositionRoot(repositories);
Expand All @@ -128,6 +150,8 @@ export function getTestCompositionRoot() {
mapConfigRepository: new MapConfigTestRepository(),
performanceOverviewRepository: new PerformanceOverviewTestRepository(),
roleRepository: new RoleTestRepository(),
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 @@ -36,7 +36,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 d641ed1

Please sign in to comment.