generated from EyeSeeTea/dhis2-app-skeleton
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from EyeSeeTea/feature/domain
feat: Domain entities for zebra
- Loading branch information
Showing
20 changed files
with
560 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import { Struct } from "./generic/Struct"; | ||
import { IncidentActionPlan } from "./incident-action-plan/IncidentActionPlan"; | ||
import { IncidentManagementTeam } from "./incident-management-team/IncidentManagementTeam"; | ||
import { TeamMember } from "./incident-management-team/TeamMember"; | ||
import { OrgUnit } from "./OrgUnit"; | ||
import { CodedNamedRef, NamedRef } from "./Ref"; | ||
import { RiskAssessment } from "./risk-assessment/RiskAssessment"; | ||
import { Maybe } from "../../utils/ts-utils"; | ||
|
||
type HazardType = | ||
| "Biological:Human" | ||
| "Biological:Animal" | ||
| "Chemical" | ||
| "Environmental" | ||
| "Unknown"; | ||
|
||
type IncidentStatusType = "Watch" | "Alert" | "Respond" | "Closed" | "Discarded"; | ||
|
||
type DateWithNarrative = { | ||
date: Date; | ||
narrative: string; | ||
}; | ||
|
||
type Syndrome = CodedNamedRef; | ||
type Disease = CodedNamedRef; | ||
type NotificationSource = CodedNamedRef; | ||
|
||
type DiseaseOutbreakEventAttrs = NamedRef & { | ||
created: Date; | ||
lastUpdated: Date; | ||
createdBy: TeamMember; | ||
hazardType: HazardType; | ||
mainSyndrome: Syndrome; | ||
suspectedDisease: Disease; | ||
notificationSource: NotificationSource; | ||
areasAffected: { | ||
provinces: OrgUnit[]; | ||
districts: OrgUnit[]; | ||
}; | ||
incidentStatus: IncidentStatusType; | ||
emerged: DateWithNarrative; | ||
detected: DateWithNarrative; | ||
notified: DateWithNarrative; | ||
responseNarrative: string; | ||
incidentManager: TeamMember; | ||
notes: Maybe<string>; | ||
riskAssessments: RiskAssessment[]; | ||
IncidentActionPlan: IncidentActionPlan; | ||
IncidentManagementTeam: IncidentManagementTeam; | ||
}; | ||
/** | ||
* Note: DiseaseOutbreakEvent represents Event in the Figma. | ||
* Not using event as it is a keyword and can also be confused with dhis event | ||
**/ | ||
|
||
export class DiseaseOutbreakEvent extends Struct<DiseaseOutbreakEventAttrs>() { | ||
static validateEventName() { | ||
//TO DO : Ensure event name is unique on event creation. | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { CodedNamedRef } from "./Ref"; | ||
|
||
type OrgUnitLevelType = "Province" | "District"; | ||
|
||
export type OrgUnit = CodedNamedRef & { | ||
level: OrgUnitLevelType; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { CodedNamedRef } from "./Ref"; | ||
|
||
type PropertTypes = "string" | "date" | "number" | "boolean"; | ||
|
||
type BaseProperty = CodedNamedRef & { | ||
type: PropertTypes; | ||
}; | ||
|
||
type StringProperty = BaseProperty & { | ||
type: "string"; | ||
value: string; | ||
}; | ||
|
||
type DateProperty = BaseProperty & { | ||
type: "date"; | ||
value: Date; | ||
}; | ||
|
||
type NumberProperty = BaseProperty & { | ||
type: "number"; | ||
value: number; | ||
}; | ||
|
||
type BooleanProperty = BaseProperty & { | ||
type: "boolean"; | ||
value: boolean; | ||
}; | ||
|
||
export type Property = StringProperty | DateProperty | NumberProperty | BooleanProperty; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { Property } from "../Properties"; | ||
import { Struct } from "../generic/Struct"; | ||
|
||
interface ActionPlanAttrs { | ||
properties: Property[]; | ||
} | ||
|
||
export class ActionPlan extends Struct<ActionPlanAttrs>() {} |
12 changes: 12 additions & 0 deletions
12
src/domain/entities/incident-action-plan/IncidentActionPlan.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { ActionPlan } from "./ActionPlan"; | ||
import { Ref } from "../Ref"; | ||
import { Struct } from "../generic/Struct"; | ||
import { ResponseAction } from "./ResponseAction"; | ||
|
||
interface IncidentActionPlanAttrs extends Ref { | ||
lastUpdated: Date; | ||
actionPlan: ActionPlan; | ||
responseActions: ResponseAction[]; | ||
} | ||
|
||
export class IncidentActionPlan extends Struct<IncidentActionPlanAttrs>() {} |
22 changes: 22 additions & 0 deletions
22
src/domain/entities/incident-action-plan/ResponseAction.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { CodedNamedRef } from "../Ref"; | ||
import { Struct } from "../generic/Struct"; | ||
import { TeamMember } from "../incident-management-team/TeamMember"; | ||
|
||
type ResponseActionStatusType = "NotDone" | "Pending" | "InProgress" | "Complete"; | ||
type ResponseActionVerificationType = "Verified" | "Unverified"; | ||
type MainTask = CodedNamedRef; | ||
type SubPillar = CodedNamedRef; | ||
type TimeLine = CodedNamedRef; | ||
|
||
interface ResponseActionAttrs { | ||
mainTask: MainTask; | ||
subActivities: string; | ||
subPillar: SubPillar; | ||
responsibleOfficer: TeamMember; | ||
dueDate: Date; | ||
timeLine: TimeLine; | ||
status: ResponseActionStatusType; | ||
verification: ResponseActionVerificationType; | ||
} | ||
|
||
export class ResponseAction extends Struct<ResponseActionAttrs>() {} |
8 changes: 8 additions & 0 deletions
8
src/domain/entities/incident-management-team/IncidentManagementTeam.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { Struct } from "../generic/Struct"; | ||
import { TeamMember } from "./TeamMember"; | ||
|
||
interface IncidentManagementTeamAttrs { | ||
teamHierarchy: TeamMember[]; | ||
} | ||
|
||
export class IncidentManagementTeam extends Struct<IncidentManagementTeamAttrs>() {} |
Oops, something went wrong.