From 95058688511ece2c4cf1acc80e2419ab28a88cbe Mon Sep 17 00:00:00 2001 From: 9sneha-n <9sneha.n@gmail.com> Date: Wed, 17 Jul 2024 12:30:58 +0530 Subject: [PATCH] feat: initial draft --- .../DiseaseOutbreakEventD2Repository.ts | 2 +- .../repositories/utils/getPopulatedEntity.ts | 158 ++++++++ .../utils/getTrackedEntityInstances.ts | 369 +++++++----------- .../DiseaseOutbreakEvent.ts | 93 ++++- yarn.lock | 6 +- 5 files changed, 397 insertions(+), 231 deletions(-) create mode 100644 src/data/repositories/utils/getPopulatedEntity.ts diff --git a/src/data/repositories/DiseaseOutbreakEventD2Repository.ts b/src/data/repositories/DiseaseOutbreakEventD2Repository.ts index 9dfd2945..f49b8a9b 100644 --- a/src/data/repositories/DiseaseOutbreakEventD2Repository.ts +++ b/src/data/repositories/DiseaseOutbreakEventD2Repository.ts @@ -3,7 +3,7 @@ import { DiseaseOutbreakEventRepository } from "../../domain/repositories/Diseas import { FutureData } from "../api-futures"; import { DiseaseOutbreakEvent } from "../../domain/entities/disease-outbreak-event/DiseaseOutbreakEvent"; import { Id, ConfigLabel } from "../../domain/entities/Ref"; -import { getTrackerEntityAttributes as getTrackedEntityAttributes } from "./utils/getTrackedEntityInstances"; +import { getTrackedEntityAttributes } from "./utils/getTrackedEntityInstances"; import { DiseaseOutbreakEventOption } from "../../domain/entities/disease-outbreak-event/DiseaseOutbreakEventOptions"; const RTSL_ZEBRA_PROGRAM_ID = "qkOTdxkte8V"; diff --git a/src/data/repositories/utils/getPopulatedEntity.ts b/src/data/repositories/utils/getPopulatedEntity.ts new file mode 100644 index 00000000..cd3a9a6c --- /dev/null +++ b/src/data/repositories/utils/getPopulatedEntity.ts @@ -0,0 +1,158 @@ +import { D2TrackerTrackedEntity } from "@eyeseetea/d2-api/api/trackerTrackedEntities"; +import { DiseaseOutbreakEvent } from "../../../domain/entities/disease-outbreak-event/DiseaseOutbreakEvent"; + +type NestedKeyOf = { + [Key in keyof ObjectType & (string | number)]: ObjectType[Key] extends object + ? `${Key}` | `${Key}.${NestedKeyOf}` + : Key; +}[keyof ObjectType & (string | number)]; + +type PropertyKeyAttributeCodeMap = { + propertyKey: NestedKeyOf; + code: string; + type: "string" | "boolean" | "date" | "object" | "option" | "enum" | "id"; + subtype?: "string" | "boolean" | "date" | "object" | "option" | "enum" | "id"; +}; + +const DISEASEOUTBREAKEVENT_PROPERTY_MAP: PropertyKeyAttributeCodeMap[] = [ + { propertyKey: "id", code: "", type: "id" }, + { propertyKey: "name", code: "RTSL_ZEB_TEA_EVENT_NAME", type: "string" }, + { propertyKey: "hazardType", code: "RTSL_ZEB_TEA_HAZARD_TYPE", type: "enum" }, + { propertyKey: "mainSyndrome", code: "RTSL_ZEB_TEA_MAIN_SYNDROME", type: "option" }, + { propertyKey: "suspectedDisease", code: "RTSL_ZEB_TEA_SUSPECTED_DISEASE", type: "option" }, + { propertyKey: "notificationSource", code: "RTSL_ZEB_TEA_NOTIFICATION_SOURCE", type: "option" }, + { + propertyKey: "areasAffectedProvinces", + code: "RTSL_ZEB_TEA_AREAS_AFFECTED_PROVINCES", + type: "object", + }, + { + propertyKey: "areasAffectedDistricts", + code: "RTSL_ZEB_TEA_AREAS_AFFECTED_DISTRICTS", + type: "object", + }, + { propertyKey: "incidentStatus", code: "RTSL_ZEB_TEA_INCIDENT_STATUS", type: "enum" }, + { propertyKey: "emerged.date", code: "RTSL_ZEB_TEA_DATE_EMERGED", type: "date" }, + { + propertyKey: "emerged.narrative", + code: "RTSL_ZEB_TEA_DATE_EMERGED_NARRATIVE", + type: "string", + }, + { propertyKey: "detected.date", code: "RTSL_ZEB_TEA_DATE_DETECTED", type: "date" }, + { + propertyKey: "detected.narrative", + code: "RTSL_ZEB_TEA_DATE_DETECTED_NARRATIVE", + type: "string", + }, + { propertyKey: "notified.date", code: "RTSL_ZEB_TEA_DATE_NOTIFIED", type: "date" }, + { + propertyKey: "notified.narrative", + code: "RTSL_ZEB_TEA_DATE_NOTIFIED_NARRATIVE", + type: "string", + }, + { + propertyKey: "earlyResponseActions.initiateInvestigation", + code: "RTSL_ZEB_TEA_INITIATE_INVESTIGATION", + type: "date", + }, + { + propertyKey: "earlyResponseActions.conductEpidemiologicalAnalysis", + code: "RTSL_ZEB_TEA_CONDUCT_EPIDEMIOLOGICAL_ANALYSIS", + type: "date", + }, + { + propertyKey: "earlyResponseActions.laboratoryConfirmation.na", + code: "RTSL_ZEB_TEA_LABORATORY_CONFIRMATION", + type: "boolean", + }, + { + propertyKey: "earlyResponseActions.laboratoryConfirmation.date", + code: "RTSL_ZEB_TEA_SPECIFY_DATE1", + type: "date", + }, + { + propertyKey: "earlyResponseActions.appropriateCaseManagement.na", + code: "RTSL_ZEB_TEA_APPROPRIATE_CASE_MANAGEMENT", + type: "boolean", + }, + { + propertyKey: "earlyResponseActions.appropriateCaseManagement.date", + code: "RTSL_ZEB_TEA_SPECIFY_DATE2", + type: "date", + }, + { + propertyKey: "earlyResponseActions.initiateRiskCommunication.na", + code: "RTSL_ZEB_TEA_APPROPRIATE_RISK_COMMUNICATION", + type: "boolean", + }, + { + propertyKey: "earlyResponseActions.initiateRiskCommunication.date", + code: "RTSL_ZEB_TEA_SPECIFY_DATE4", + type: "date", + }, + { + propertyKey: "earlyResponseActions.establishCoordination", + code: "RTSL_ZEB_TEA_ESTABLISH_COORDINATION_MECHANISM", + type: "date", + }, + { + propertyKey: "earlyResponseActions.responseNarrative", + code: "RTSL_ZEB_TEA_RESPONSE_NARRATIVE", + type: "string", + }, + { + propertyKey: "incidentManager", + code: "RTSL_ZEB_TEA_ASSIGN_INCIDENT_MANAGER", + type: "object", + }, + { + propertyKey: "notes", + code: "RTSL_ZEB_TEA_NOTES", + type: "string", + }, +]; +export function getPopulatedEntity(trackedEntity: D2TrackerTrackedEntity): DiseaseOutbreakEvent { + const populatedDiseaseOutbreak: DiseaseOutbreakEvent = DiseaseOutbreakEvent.createEmpty(); + DISEASEOUTBREAKEVENT_PROPERTY_MAP.forEach(metadata => { + const value = getValueFromMap(metadata.propertyKey, trackedEntity); + switch (metadata.type) { + case "id": + // @ts-ignore + populatedDiseaseOutbreak[metadata.propertyKey] = trackedEntity.trackedEntity; + break; + case "string": + // @ts-ignore + populatedDiseaseOutbreak[metadata.propertyKey] = value; + break; + case "boolean": + // @ts-ignore + populatedDiseaseOutbreak[metadata.propertyKey] = value === "true"; + break; + case "date": + // @ts-ignore + populatedDiseaseOutbreak[metadata.propertyKey] = new Date(value); + break; + case "object": + break; + case "option": + // @ts-ignore + populatedDiseaseOutbreak[metadata.propertyKey]["id"] = value; + break; + case "enum": + // @ts-ignore + populatedDiseaseOutbreak[metadata.propertyKey] = value; + break; + } + }); + + // @ts-ignore + return populatedDiseaseOutbreak; +} +export function getValueFromMap( + key: NestedKeyOf, + trackedEntity: D2TrackerTrackedEntity +): string { + const propertyMap = DISEASEOUTBREAKEVENT_PROPERTY_MAP.find(map => map.propertyKey === key); + if (!propertyMap) return ""; + return trackedEntity.attributes?.find(a => a.code === propertyMap.code)?.value ?? ""; +} diff --git a/src/data/repositories/utils/getTrackedEntityInstances.ts b/src/data/repositories/utils/getTrackedEntityInstances.ts index 2502426d..e8fe7519 100644 --- a/src/data/repositories/utils/getTrackedEntityInstances.ts +++ b/src/data/repositories/utils/getTrackedEntityInstances.ts @@ -8,84 +8,9 @@ import { } from "../../../domain/entities/disease-outbreak-event/DiseaseOutbreakEvent"; import { D2TrackerTrackedEntity } from "@eyeseetea/d2-api/api/trackerTrackedEntities"; import { TeamMember } from "../../../domain/entities/incident-management-team/TeamMember"; +import { getPopulatedEntity, getValueFromMap } from "./getPopulatedEntity"; -type NestedKeyOf = { - [Key in keyof ObjectType & (string | number)]: ObjectType[Key] extends object - ? `${Key}` | `${Key}.${NestedKeyOf}` - : Key; -}[keyof ObjectType & (string | number)]; - -type PropertyKeyAttributeCodeMap = { - propertyKey: NestedKeyOf; - code: string; -}; - -const DISEASEOUTBREAKEVENT_PROPERTY_MAP: PropertyKeyAttributeCodeMap[] = [ - { propertyKey: "name", code: "RTSL_ZEB_TEA_EVENT_NAME" }, - { propertyKey: "hazardType", code: "RTSL_ZEB_TEA_HAZARD_TYPE" }, - { propertyKey: "mainSyndrome", code: "RTSL_ZEB_TEA_MAIN_SYNDROME" }, - { propertyKey: "suspectedDisease", code: "RTSL_ZEB_TEA_SUSPECTED_DISEASE" }, - { propertyKey: "notificationSource", code: "RTSL_ZEB_TEA_NOTIFICATION_SOURCE" }, - { propertyKey: "areasAffectedProvinces", code: "RTSL_ZEB_TEA_AREAS_AFFECTED_PROVINCES" }, - { propertyKey: "areasAffectedDistricts", code: "RTSL_ZEB_TEA_AREAS_AFFECTED_DISTRICTS" }, - { propertyKey: "incidentStatus", code: "RTSL_ZEB_TEA_INCIDENT_STATUS" }, - { propertyKey: "emerged.date", code: "RTSL_ZEB_TEA_DATE_EMERGED" }, - { propertyKey: "emerged.narrative", code: "RTSL_ZEB_TEA_DATE_EMERGED_NARRATIVE" }, - { propertyKey: "detected.date", code: "RTSL_ZEB_TEA_DATE_DETECTED" }, - { propertyKey: "detected.narrative", code: "RTSL_ZEB_TEA_DATE_DETECTED_NARRATIVE" }, - { propertyKey: "notified.date", code: "RTSL_ZEB_TEA_DATE_NOTIFIED" }, - { propertyKey: "notified.narrative", code: "RTSL_ZEB_TEA_DATE_NOTIFIED_NARRATIVE" }, - { - propertyKey: "earlyResponseActions.initiateInvestigation", - code: "RTSL_ZEB_TEA_INITIATE_INVESTIGATION", - }, - { - propertyKey: "earlyResponseActions.conductEpidemiologicalAnalysis", - code: "RTSL_ZEB_TEA_CONDUCT_EPIDEMIOLOGICAL_ANALYSIS", - }, - { - propertyKey: "earlyResponseActions.laboratoryConfirmation.na", - code: "RTSL_ZEB_TEA_LABORATORY_CONFIRMATION", - }, - { - propertyKey: "earlyResponseActions.laboratoryConfirmation.date", - code: "RTSL_ZEB_TEA_SPECIFY_DATE1", - }, - { - propertyKey: "earlyResponseActions.appropriateCaseManagement.na", - code: "RTSL_ZEB_TEA_APPROPRIATE_CASE_MANAGEMENT", - }, - { - propertyKey: "earlyResponseActions.appropriateCaseManagement.date", - code: "RTSL_ZEB_TEA_SPECIFY_DATE2", - }, - { - propertyKey: "earlyResponseActions.initiateRiskCommunication.na", - code: "RTSL_ZEB_TEA_APPROPRIATE_RISK_COMMUNICATION", - }, - { - propertyKey: "earlyResponseActions.initiateRiskCommunication.date", - code: "RTSL_ZEB_TEA_SPECIFY_DATE4", - }, - { - propertyKey: "earlyResponseActions.establishCoordination", - code: "RTSL_ZEB_TEA_ESTABLISH_COORDINATION_MECHANISM", - }, - { - propertyKey: "earlyResponseActions.responseNarrative", - code: "RTSL_ZEB_TEA_RESPONSE_NARRATIVE", - }, - { - propertyKey: "incidentManager", - code: "RTSL_ZEB_TEA_ASSIGN_INCIDENT_MANAGER", - }, - { - propertyKey: "notes", - code: "RTSL_ZEB_TEA_NOTES", - }, -]; - -export function getTrackerEntityAttributes( +export function getTrackedEntityAttributes( api: D2Api, programId: Id, orgUnitId: Id, @@ -109,155 +34,147 @@ function mapTrackedEntityAttributesToDiseaseOutbreak( ): DiseaseOutbreakEvent { if (!trackedEntity.trackedEntity) throw new Error("Tracked entity not found"); - const diseaseOutbreak: DiseaseOutbreakEvent = new DiseaseOutbreakEvent({ - // Hardcoded values for DiseaseOutbreakEvent properties - id: trackedEntity.trackedEntity, - name: getValueFromMap("name", trackedEntity) || "", - created: new Date(getValueFromMap("created", trackedEntity) || ""), - lastUpdated: new Date(getValueFromMap("lastUpdated", trackedEntity) || ""), - createdBy: undefined, - hazardType: getValueFromMap("hazardType", trackedEntity) as HazardType, - mainSyndrome: { - id: getValueFromMap("mainSyndrome", trackedEntity) || "", - code: "", - name: "", - }, //TO DO : Option set not yet created - suspectedDisease: { - id: getValueFromMap("suspectedDisease", trackedEntity) || "", - code: "", - name: "", - }, //TO DO : Option set not yet created - notificationSource: { - id: getValueFromMap("notificationSource", trackedEntity) || "", - code: "", - name: "", - }, //TO DO : Option set not yet created - areasAffectedProvinces: [ - { - id: getValueFromMap("areasAffectedProvinces", trackedEntity) || "", - code: "", - name: "", - }, - ], - areasAffectedDistricts: [ - { - id: getValueFromMap("areasAffectedDistricts", trackedEntity) || "", - code: "", - name: "", - }, - ], - incidentStatus: getValueFromMap("incidentStatus", trackedEntity) as IncidentStatusType, - emerged: { - date: new Date(getValueFromMap("emerged.date", trackedEntity) || ""), - narrative: getValueFromMap("emerged.narrative", trackedEntity) || "", - }, - detected: { - date: new Date(getValueFromMap("detected.date", trackedEntity) || ""), - narrative: getValueFromMap("detected.narrative", trackedEntity) || "", - }, - notified: { - date: new Date(getValueFromMap("notified.date", trackedEntity) || ""), - narrative: getValueFromMap("notified.narrative", trackedEntity) || "", - }, - incidentManager: new TeamMember({ - id: getValueFromMap("incidentManager", trackedEntity) || "", - name: "", - phone: undefined, - email: undefined, - status: undefined, - role: undefined, - photo: undefined, - }), - earlyResponseActions: { - initiateInvestigation: new Date( - getValueFromMap("earlyResponseActions.initiateInvestigation", trackedEntity) || "" - ), - conductEpidemiologicalAnalysis: new Date( - getValueFromMap( - "earlyResponseActions.conductEpidemiologicalAnalysis", - trackedEntity - ) || "" - ), - laboratoryConfirmation: { - date: new Date( - getValueFromMap( - "earlyResponseActions.laboratoryConfirmation.date", - trackedEntity - ) || "" - ), - na: - getValueFromMap( - "earlyResponseActions.laboratoryConfirmation.na", - trackedEntity - ) === "true" - ? true - : false || false, - }, - appropriateCaseManagement: { - date: new Date( - getValueFromMap( - "earlyResponseActions.appropriateCaseManagement.date", - trackedEntity - ) || "" - ), - na: - getValueFromMap( - "earlyResponseActions.appropriateCaseManagement.na", - trackedEntity - ) === "true" - ? true - : false || false, - }, - initiatePublicHealthCounterMeasures: { - date: new Date( - getValueFromMap( - "earlyResponseActions.initiatePublicHealthCounterMeasures.date", - trackedEntity - ) || "" - ), - na: - getValueFromMap( - "earlyResponseActions.initiatePublicHealthCounterMeasures.na", - trackedEntity - ) === "true" - ? true - : false || false, - }, - initiateRiskCommunication: { - date: new Date( - getValueFromMap( - "earlyResponseActions.initiateRiskCommunication.date", - trackedEntity - ) || "" - ), - na: - getValueFromMap( - "earlyResponseActions.initiateRiskCommunication.na", - trackedEntity - ) === "true" - ? true - : false || false, - }, - establishCoordination: new Date( - getValueFromMap("earlyResponseActions.establishCoordination", trackedEntity) || "" - ), - responseNarrative: - getValueFromMap("earlyResponseActions.responseNarrative", trackedEntity) || "", - }, - notes: getValueFromMap("notes", trackedEntity) || "", - riskAssessments: undefined, - incidentActionPlan: undefined, - incidentManagementTeam: undefined, - }); + // const diseaseOutbreak: DiseaseOutbreakEvent = new DiseaseOutbreakEvent({ + // // Hardcoded values for DiseaseOutbreakEvent properties + // id: trackedEntity.trackedEntity, + // name: getValueFromMap("name", trackedEntity) || "", + // created: new Date(getValueFromMap("created", trackedEntity) || ""), + // lastUpdated: new Date(getValueFromMap("lastUpdated", trackedEntity) || ""), + // createdBy: undefined, + // hazardType: getValueFromMap("hazardType", trackedEntity) as HazardType, + // mainSyndrome: { + // id: getValueFromMap("mainSyndrome", trackedEntity) || "", + // code: "", + // name: "", + // }, //TO DO : Option set not yet created + // suspectedDisease: { + // id: getValueFromMap("suspectedDisease", trackedEntity) || "", + // code: "", + // name: "", + // }, //TO DO : Option set not yet created + // notificationSource: { + // id: getValueFromMap("notificationSource", trackedEntity) || "", + // code: "", + // name: "", + // }, //TO DO : Option set not yet created + // areasAffectedProvinces: [ + // { + // id: getValueFromMap("areasAffectedProvinces", trackedEntity) || "", + // code: "", + // name: "", + // }, + // ], + // areasAffectedDistricts: [ + // { + // id: getValueFromMap("areasAffectedDistricts", trackedEntity) || "", + // code: "", + // name: "", + // }, + // ], + // incidentStatus: getValueFromMap("incidentStatus", trackedEntity) as IncidentStatusType, + // emerged: { + // date: new Date(getValueFromMap("emerged.date", trackedEntity) || ""), + // narrative: getValueFromMap("emerged.narrative", trackedEntity) || "", + // }, + // detected: { + // date: new Date(getValueFromMap("detected.date", trackedEntity) || ""), + // narrative: getValueFromMap("detected.narrative", trackedEntity) || "", + // }, + // notified: { + // date: new Date(getValueFromMap("notified.date", trackedEntity) || ""), + // narrative: getValueFromMap("notified.narrative", trackedEntity) || "", + // }, + // incidentManager: new TeamMember({ + // id: getValueFromMap("incidentManager", trackedEntity) || "", + // name: "", + // phone: undefined, + // email: undefined, + // status: undefined, + // role: undefined, + // photo: undefined, + // }), + // earlyResponseActions: { + // initiateInvestigation: new Date( + // getValueFromMap("earlyResponseActions.initiateInvestigation", trackedEntity) || "" + // ), + // conductEpidemiologicalAnalysis: new Date( + // getValueFromMap( + // "earlyResponseActions.conductEpidemiologicalAnalysis", + // trackedEntity + // ) || "" + // ), + // laboratoryConfirmation: { + // date: new Date( + // getValueFromMap( + // "earlyResponseActions.laboratoryConfirmation.date", + // trackedEntity + // ) || "" + // ), + // na: + // getValueFromMap( + // "earlyResponseActions.laboratoryConfirmation.na", + // trackedEntity + // ) === "true" + // ? true + // : false || false, + // }, + // appropriateCaseManagement: { + // date: new Date( + // getValueFromMap( + // "earlyResponseActions.appropriateCaseManagement.date", + // trackedEntity + // ) || "" + // ), + // na: + // getValueFromMap( + // "earlyResponseActions.appropriateCaseManagement.na", + // trackedEntity + // ) === "true" + // ? true + // : false || false, + // }, + // initiatePublicHealthCounterMeasures: { + // date: new Date( + // getValueFromMap( + // "earlyResponseActions.initiatePublicHealthCounterMeasures.date", + // trackedEntity + // ) || "" + // ), + // na: + // getValueFromMap( + // "earlyResponseActions.initiatePublicHealthCounterMeasures.na", + // trackedEntity + // ) === "true" + // ? true + // : false || false, + // }, + // initiateRiskCommunication: { + // date: new Date( + // getValueFromMap( + // "earlyResponseActions.initiateRiskCommunication.date", + // trackedEntity + // ) || "" + // ), + // na: + // getValueFromMap( + // "earlyResponseActions.initiateRiskCommunication.na", + // trackedEntity + // ) === "true" + // ? true + // : false || false, + // }, + // establishCoordination: new Date( + // getValueFromMap("earlyResponseActions.establishCoordination", trackedEntity) || "" + // ), + // responseNarrative: + // getValueFromMap("earlyResponseActions.responseNarrative", trackedEntity) || "", + // }, + // notes: getValueFromMap("notes", trackedEntity) || "", + // riskAssessments: undefined, + // incidentActionPlan: undefined, + // incidentManagementTeam: undefined, + // }); + const diseaseOutbreak: DiseaseOutbreakEvent = getPopulatedEntity(trackedEntity); return diseaseOutbreak; } - -function getValueFromMap( - key: NestedKeyOf, - trackedEntity: D2TrackerTrackedEntity -) { - const propertyMap = DISEASEOUTBREAKEVENT_PROPERTY_MAP.find(map => map.propertyKey === key); - if (!propertyMap) return undefined; - return trackedEntity.attributes?.find(a => a.code === propertyMap.code)?.value; -} diff --git a/src/domain/entities/disease-outbreak-event/DiseaseOutbreakEvent.ts b/src/domain/entities/disease-outbreak-event/DiseaseOutbreakEvent.ts index 7a5b989c..6c22ff7d 100644 --- a/src/domain/entities/disease-outbreak-event/DiseaseOutbreakEvent.ts +++ b/src/domain/entities/disease-outbreak-event/DiseaseOutbreakEvent.ts @@ -37,7 +37,7 @@ type EarlyResponseActions = { responseNarrative: string; }; -type DiseaseOutbreakEventAttrs = NamedRef & { +export type DiseaseOutbreakEventAttrs = NamedRef & { created: Date; lastUpdated: Date; createdBy: Maybe; @@ -64,6 +64,97 @@ type DiseaseOutbreakEventAttrs = NamedRef & { **/ export class DiseaseOutbreakEvent extends Struct() { + static createEmpty(): DiseaseOutbreakEvent { + return new DiseaseOutbreakEvent({ + // Hardcoded values for DiseaseOutbreakEvent properties + id: "", + name: "", + created: new Date(""), + lastUpdated: new Date(""), + createdBy: undefined, + hazardType: "" as HazardType, + mainSyndrome: { + id: "", + code: "", + name: "", + }, //TO DO : Option set not yet created + suspectedDisease: { + id: "", + code: "", + name: "", + }, //TO DO : Option set not yet created + notificationSource: { + id: "", + code: "", + name: "", + }, //TO DO : Option set not yet created + areasAffectedProvinces: [ + { + id: "", + code: "", + name: "", + }, + ], + areasAffectedDistricts: [ + { + id: "", + code: "", + name: "", + }, + ], + incidentStatus: "" as IncidentStatusType, + emerged: { + date: new Date(""), + narrative: "", + }, + detected: { + date: new Date(""), + narrative: "", + }, + notified: { + date: new Date(""), + narrative: "", + }, + incidentManager: new TeamMember({ + id: "", + name: "", + phone: undefined, + email: undefined, + status: undefined, + role: undefined, + photo: undefined, + }), + earlyResponseActions: { + initiateInvestigation: new Date(""), + conductEpidemiologicalAnalysis: new Date(""), + laboratoryConfirmation: { + date: new Date(""), + na: false, + }, + appropriateCaseManagement: { + date: new Date(""), + na: false, + }, + initiatePublicHealthCounterMeasures: { + date: new Date(""), + na: false, + }, + initiateRiskCommunication: { + date: new Date(""), + na: false, + }, + establishCoordination: new Date(""), + responseNarrative: "", + }, + notes: "", + riskAssessments: undefined, + incidentActionPlan: undefined, + incidentManagementTeam: undefined, + }); + } + static isKeyOfDiseaseOutbreakEvent(key: string): key is keyof DiseaseOutbreakEvent { + return key in DiseaseOutbreakEvent.prototype; + } static validateEventName() { //TO DO : Ensure event name is unique on event creation. } diff --git a/yarn.lock b/yarn.lock index 61d79c4a..68034cf7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5428,9 +5428,9 @@ camelize@^1.0.0: integrity sha512-dU+Tx2fsypxTgtLoE36npi3UqcjSSMNYfkqgmoEhtZrraP5VWq0K7FkWVTYa8eMPtnU/G2txVsfdCJTn9uzpuQ== caniuse-lite@^1.0.30001517: - version "1.0.30001535" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001535.tgz#908a5b7ef11172f51f0b88f3d850aef1c6a3cf7b" - integrity sha512-48jLyUkiWFfhm/afF7cQPqPjaUmSraEhK4j+FCTJpgnGGEZHqyLe3hmWH7lIooZdSzXL0ReMvHz0vKDoTBsrwg== + version "1.0.30001642" + resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001642.tgz" + integrity sha512-3XQ0DoRgLijXJErLSl+bLnJ+Et4KqV1PY6JJBGAFlsNsz31zeAIncyeZfLCabHK/jtSh+671RM9YMldxjUPZtA== chai@^4.3.7: version "4.3.8"