Skip to content

Commit

Permalink
Merge pull request #48 from EyeSeeTea/feat/nested-menu-mortality
Browse files Browse the repository at this point in the history
Nested menu, add mortality forms, map pathogen isolate to patient
  • Loading branch information
MiquelAdell authored May 22, 2024
2 parents 066847b + 41f5e16 commit 9946502
Show file tree
Hide file tree
Showing 16 changed files with 413 additions and 106 deletions.
13 changes: 11 additions & 2 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-04-30T16:29:46.275Z\n"
"PO-Revision-Date: 2024-04-30T16:29:46.275Z\n"
"POT-Creation-Date: 2024-05-20T17:45:48.260Z\n"
"PO-Revision-Date: 2024-05-20T17:45:48.260Z\n"

msgid "Facilities"
msgstr ""
Expand All @@ -23,6 +23,15 @@ msgstr ""
msgid "Supranational Ref Results"
msgstr ""

msgid "D28 Follow-up"
msgstr ""

msgid "Discharge"
msgstr ""

msgid "Cohort enrolment"
msgstr ""

msgid "Countries"
msgstr ""

Expand Down
11 changes: 10 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-05-14T07:10:22.779Z\n"
"POT-Creation-Date: 2024-05-20T17:45:48.260Z\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 All @@ -23,6 +23,15 @@ msgstr ""
msgid "Supranational Ref Results"
msgstr ""

msgid "D28 Follow-up"
msgstr ""

msgid "Discharge"
msgstr ""

msgid "Cohort enrolment"
msgstr ""

msgid "Countries"
msgstr ""

Expand Down
13 changes: 13 additions & 0 deletions src/data/entities/D2Survey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ export const PREVALENCE_SAMPLE_SHIP_TRACK_FORM_ID = "ew0mOwKdcJp";
export const PREVALENCE_CENTRAL_REF_LAB_FORM_ID = "aaAzYmn5vBG";
export const PREVALENCE_PATHOGEN_ISO_STORE_TRACK_ID = "KActa6iTwIM";
export const PREVALENCE_SUPRANATIONAL_REF_LAB_ID = "igEDINFwytu";
export const PREVALENCE_MORTALITY_FOLLOWUP_FORM_D28 = "OMrD1jbnhxr";
export const PREVALENCE_MORTALITY_DISCHARGE_FORM = "GSmQGiIkUGh";
export const PREVALENCE_MORTALITY_COHORT_ENORL_FORM = "e4Yp0x3cgZF";

//Prevalence Data element Ids

export const AMR_SURVEYS_PREVALENCE_DEA_SURVEY_ID = "o6oNnIbpPDH";
Expand All @@ -41,13 +45,21 @@ export const AMR_SURVEYS_PREVALENCE_TEA_SURVEY_ID_SRL = "mcY57Zn7FFl";
export const AMR_SURVEYS_PREVALENCE_TEA_SURVEY_ID_CRF = "tlRPoWumrSa";
export const AMR_SURVEYS_PREVALENCE_TEA_UNIQUE_PATIENT_ID = "yEkJlUFeJdP";

export const AMR_SURVEYS_MORTALITY_TEA_SURVEY_ID_FUP = "HIrhj9B0fOf";
export const AMR_SURVEYS_MORTALITY_TEA_SURVEY_ID_DF = "C8Lhx4ozGEP";
export const AMR_SURVEYS_MORTALITY_TEA_SURVEY_ID_COH = "fI1qhkRwwm7";
export const AMR_SURVEYS_MORTALITY_TEA_PAT_ID_FUP2 = "l4Y96YlhYyF";
export const AMR_SURVEYS_MORTALITY_TEA_PAT_ID_DF2 = "oT6f0BG74xs";
export const AMR_SURVEYS_MORTALITY_TEA_PAT_ID_COH2 = "mGYxog3at84";

export const PREVALENCE_START_DATE_DATAELEMENT_ID = "xlvLBmg9Mkg";
export const PREVALENCE_SURVEY_COMPLETED_DATAELEMENT_ID = "xiFcLr23IbW";
export const PREVALENCE_SURVEY_NAME_DATAELEMENT_ID = "HXnhZ8rsDts";
export const AMR_SURVEYS_PREVALENCE_DEA_AST_GUIDELINES = "SmuESJHyhC2";
export const AMR_SURVEYS_PREVALENCE_DEA_CUSTOM_AST_GUIDE = "lyeNV8Ag6lp";

export const AMR_SURVEYS_PREVALENCE_TEA_PATIENT_ID = "mUaaSzbeMmj";
export const AMR_SURVEYS_PREVALENCE_TEA_AMRPATIENT_IDPREVALENCE = "M1D2XXokPWl";
export const AMR_SURVEYS_PREVALENCE_TEA_PATIENT_IDA19 = "yq8en6ZkENB";

//Prevalence Tracked Entity Attribute types
Expand All @@ -57,6 +69,7 @@ export const PREVALENCE_SAMPLE_SHIPMENT_TET = "ukqXKDH1cqP";
export const PREVALENCE_CENTRAL_REF_LAB_TET = "yqa88gKCdV8";
export const PREVALENCE_PATHOGEN_ISOLATES_TET = "aWIdBmjFWF0";
export const PREVALENCE_SUPRANATIONAL_TET = "KQMBM3q32FC";
export const PREVALENCE_MORTALITY_FOLLOW_UP_TET = "m8YpTxNjHbn";

type SURVEY_DATA_ELEMENT_KEYS =
| "startDate"
Expand Down
16 changes: 15 additions & 1 deletion src/data/utils/questionHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,14 @@ import {
import { Id } from "../../domain/entities/Ref";
import { Option, ProgramDataElement, TrackedEntityAttibute } from "../entities/D2Program";
import {
AMR_SURVEYS_MORTALITY_TEA_PAT_ID_COH2,
AMR_SURVEYS_MORTALITY_TEA_PAT_ID_DF2,
AMR_SURVEYS_MORTALITY_TEA_PAT_ID_FUP2,
AMR_SURVEYS_MORTALITY_TEA_SURVEY_ID_COH,
AMR_SURVEYS_MORTALITY_TEA_SURVEY_ID_DF,
AMR_SURVEYS_MORTALITY_TEA_SURVEY_ID_FUP,
AMR_SURVEYS_PREVALENCE_DEA_SURVEY_ID,
AMR_SURVEYS_PREVALENCE_TEA_AMRPATIENT_IDPREVALENCE,
AMR_SURVEYS_PREVALENCE_TEA_PATIENT_ID,
AMR_SURVEYS_PREVALENCE_TEA_PATIENT_IDA19,
AMR_SURVEYS_PREVALENCE_TEA_SURVEY_ID_CRF,
Expand Down Expand Up @@ -355,8 +362,15 @@ export const mapTrackedAttributesToQuestions = (
currentQuestion.id === AMR_SURVEYS_PREVALENCE_TEA_SURVEY_ID_PIS ||
currentQuestion.id === AMR_SURVEYS_PREVALENCE_TEA_SURVEY_ID_SRL ||
currentQuestion.id === AMR_SURVEYS_PREVALENCE_TEA_SURVEY_ID_CRF ||
currentQuestion.id === AMR_SURVEYS_MORTALITY_TEA_SURVEY_ID_FUP ||
currentQuestion.id === AMR_SURVEYS_MORTALITY_TEA_SURVEY_ID_DF ||
currentQuestion.id === AMR_SURVEYS_MORTALITY_TEA_SURVEY_ID_COH ||
currentQuestion.id === AMR_SURVEYS_PREVALENCE_TEA_PATIENT_ID ||
currentQuestion.id === AMR_SURVEYS_PREVALENCE_TEA_PATIENT_IDA19)
currentQuestion.id === AMR_SURVEYS_PREVALENCE_TEA_AMRPATIENT_IDPREVALENCE ||
currentQuestion.id === AMR_SURVEYS_PREVALENCE_TEA_PATIENT_IDA19 ||
currentQuestion.id === AMR_SURVEYS_MORTALITY_TEA_PAT_ID_FUP2 ||
currentQuestion.id === AMR_SURVEYS_MORTALITY_TEA_PAT_ID_DF2 ||
currentQuestion.id === AMR_SURVEYS_MORTALITY_TEA_PAT_ID_COH2)
) {
currentQuestion.disabled = true;
}
Expand Down
31 changes: 30 additions & 1 deletion src/data/utils/surveyProgramHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,16 @@ import {
SURVEY_ID_DATAELEMENT_ID,
SURVEY_ID_FACILITY_LEVEL_DATAELEMENT_ID,
WARD_ID_DATAELEMENT_ID,
PREVALENCE_MORTALITY_FOLLOWUP_FORM_D28,
PREVALENCE_MORTALITY_DISCHARGE_FORM,
PREVALENCE_MORTALITY_COHORT_ENORL_FORM,
PREVALENCE_MORTALITY_FOLLOW_UP_TET,
AMR_SURVEYS_PREVALENCE_TEA_PATIENT_ID,
AMR_SURVEYS_PREVALENCE_TEA_PATIENT_IDA19,
AMR_SURVEYS_MORTALITY_TEA_PAT_ID_FUP2,
AMR_SURVEYS_MORTALITY_TEA_PAT_ID_DF2,
AMR_SURVEYS_MORTALITY_TEA_PAT_ID_COH2,
AMR_SURVEYS_PREVALENCE_TEA_AMRPATIENT_IDPREVALENCE,
} from "../entities/D2Survey";

export const isTrackerProgram = (programId: Id) => {
Expand All @@ -35,6 +43,9 @@ export const isTrackerProgram = (programId: Id) => {
case PREVALENCE_CENTRAL_REF_LAB_FORM_ID:
case PREVALENCE_PATHOGEN_ISO_STORE_TRACK_ID:
case PREVALENCE_SUPRANATIONAL_REF_LAB_ID:
case PREVALENCE_MORTALITY_FOLLOWUP_FORM_D28:
case PREVALENCE_MORTALITY_DISCHARGE_FORM:
case PREVALENCE_MORTALITY_COHORT_ENORL_FORM:
return true;
default:
return false;
Expand All @@ -55,6 +66,10 @@ export const getTrackedEntityAttributeType = (programId: Id) => {
return PREVALENCE_SUPRANATIONAL_TET;
case PREVALENCE_FACILITY_LEVEL_FORM_ID:
return PREVALENCE_FACILITY_LEVEL_TET;
case PREVALENCE_MORTALITY_FOLLOWUP_FORM_D28:
case PREVALENCE_MORTALITY_DISCHARGE_FORM:
case PREVALENCE_MORTALITY_COHORT_ENORL_FORM:
return PREVALENCE_MORTALITY_FOLLOW_UP_TET;

default:
return "";
Expand Down Expand Up @@ -92,14 +107,22 @@ export const getSurveyNameBySurveyFormType = (

export const getParentDataElementForProgram = (programId: Id): Id => {
switch (programId) {
case PREVALENCE_MORTALITY_FOLLOWUP_FORM_D28:
return AMR_SURVEYS_MORTALITY_TEA_PAT_ID_FUP2;
case PREVALENCE_MORTALITY_DISCHARGE_FORM:
return AMR_SURVEYS_MORTALITY_TEA_PAT_ID_DF2;
case PREVALENCE_MORTALITY_COHORT_ENORL_FORM:
return AMR_SURVEYS_MORTALITY_TEA_PAT_ID_COH2;

case PREVALENCE_FACILITY_LEVEL_FORM_ID:
return SURVEY_ID_FACILITY_LEVEL_DATAELEMENT_ID;
case PREVALENCE_CASE_REPORT_FORM_ID:
return AMR_SURVEYS_PREVALENCE_TEA_SURVEY_ID_CRF;
case PREVALENCE_SAMPLE_SHIP_TRACK_FORM_ID:
case PREVALENCE_CENTRAL_REF_LAB_FORM_ID:
case PREVALENCE_PATHOGEN_ISO_STORE_TRACK_ID:
return AMR_SURVEYS_PREVALENCE_TEA_PATIENT_ID;
case PREVALENCE_PATHOGEN_ISO_STORE_TRACK_ID:
return AMR_SURVEYS_PREVALENCE_TEA_AMRPATIENT_IDPREVALENCE;
case PREVALENCE_SUPRANATIONAL_REF_LAB_ID:
return AMR_SURVEYS_PREVALENCE_TEA_PATIENT_IDA19;
case PPS_COUNTRY_QUESTIONNAIRE_ID:
Expand Down Expand Up @@ -139,6 +162,9 @@ export const getChildProgramId = (
PREVALENCE_CENTRAL_REF_LAB_FORM_ID,
PREVALENCE_PATHOGEN_ISO_STORE_TRACK_ID,
PREVALENCE_SUPRANATIONAL_REF_LAB_ID,
PREVALENCE_MORTALITY_FOLLOWUP_FORM_D28,
PREVALENCE_MORTALITY_DISCHARGE_FORM,
PREVALENCE_MORTALITY_COHORT_ENORL_FORM,
],
};
default:
Expand All @@ -161,6 +187,9 @@ export const getSurveyType = (surveyFormType: SURVEY_FORM_TYPES): "PPS" | "Preva
case "PrevalenceCentralRefLabForm":
case "PrevalencePathogenIsolatesLog":
case "PrevalenceSupranationalRefLabForm":
case "PrevalenceD28FollowUp":
case "PrevalenceDischarge":
case "PrevalenceCohortEnrolment":
default:
return "Prevalence";
}
Expand Down
5 changes: 4 additions & 1 deletion src/domain/entities/Survey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ export type SURVEY_FORM_TYPES =
| "PrevalenceSampleShipTrackForm"
| "PrevalenceCentralRefLabForm"
| "PrevalencePathogenIsolatesLog"
| "PrevalenceSupranationalRefLabForm";
| "PrevalenceSupranationalRefLabForm"
| "PrevalenceD28FollowUp"
| "PrevalenceDischarge"
| "PrevalenceCohortEnrolment";

export type SURVEY_STATUSES = "FUTURE" | "ACTIVE" | "COMPLETED";
export type SURVEY_TYPES = "SUPRANATIONAL" | "NATIONAL" | "HOSP";
Expand Down
18 changes: 16 additions & 2 deletions src/domain/usecases/GetSurveyUseCase.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
import { FutureData } from "../../data/api-futures";
import {
AMR_SURVEYS_MORTALITY_TEA_PAT_ID_COH2,
AMR_SURVEYS_MORTALITY_TEA_PAT_ID_DF2,
AMR_SURVEYS_MORTALITY_TEA_PAT_ID_FUP2,
AMR_SURVEYS_MORTALITY_TEA_SURVEY_ID_COH,
AMR_SURVEYS_MORTALITY_TEA_SURVEY_ID_DF,
AMR_SURVEYS_MORTALITY_TEA_SURVEY_ID_FUP,
AMR_SURVEYS_PREVALENCE_TEA_AMRPATIENT_IDPREVALENCE,
AMR_SURVEYS_PREVALENCE_TEA_PATIENT_ID,
AMR_SURVEYS_PREVALENCE_TEA_PATIENT_IDA19,
AMR_SURVEYS_PREVALENCE_TEA_SURVEY_ID_CRF,
Expand Down Expand Up @@ -142,11 +149,18 @@ export class GetSurveyUseCase {
question.id === AMR_SURVEYS_PREVALENCE_TEA_SURVEY_ID_CRL ||
question.id === AMR_SURVEYS_PREVALENCE_TEA_SURVEY_ID_PIS ||
question.id === AMR_SURVEYS_PREVALENCE_TEA_SURVEY_ID_SRL ||
question.id === AMR_SURVEYS_PREVALENCE_TEA_SURVEY_ID_CRF;
question.id === AMR_SURVEYS_PREVALENCE_TEA_SURVEY_ID_CRF ||
question.id === AMR_SURVEYS_MORTALITY_TEA_SURVEY_ID_FUP ||
question.id === AMR_SURVEYS_MORTALITY_TEA_SURVEY_ID_DF ||
question.id === AMR_SURVEYS_MORTALITY_TEA_SURVEY_ID_COH;

const isPatientIdQuestion =
question.id === AMR_SURVEYS_PREVALENCE_TEA_PATIENT_ID ||
question.id === AMR_SURVEYS_PREVALENCE_TEA_PATIENT_IDA19;
question.id === AMR_SURVEYS_PREVALENCE_TEA_AMRPATIENT_IDPREVALENCE ||
question.id === AMR_SURVEYS_PREVALENCE_TEA_PATIENT_IDA19 ||
question.id === AMR_SURVEYS_MORTALITY_TEA_PAT_ID_FUP2 ||
question.id === AMR_SURVEYS_MORTALITY_TEA_PAT_ID_DF2 ||
question.id === AMR_SURVEYS_MORTALITY_TEA_PAT_ID_COH2;

if (isSurveyIdQuestion && question.type === "text") {
return {
Expand Down
37 changes: 37 additions & 0 deletions src/domain/utils/PPSProgramsHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ import {
PREVALENCE_CASE_REPORT_FORM_ID,
PREVALENCE_CENTRAL_REF_LAB_FORM_ID,
PREVALENCE_FACILITY_LEVEL_FORM_ID,
PREVALENCE_MORTALITY_COHORT_ENORL_FORM,
PREVALENCE_MORTALITY_DISCHARGE_FORM,
PREVALENCE_MORTALITY_FOLLOWUP_FORM_D28,
PREVALENCE_PATHOGEN_ISO_STORE_TRACK_ID,
PREVALENCE_SAMPLE_SHIP_TRACK_FORM_ID,
PREVALENCE_SUPRANATIONAL_REF_LAB_ID,
Expand Down Expand Up @@ -64,6 +67,12 @@ export const getProgramId = (surveyFormType: SURVEY_FORM_TYPES): string => {
return PREVALENCE_PATHOGEN_ISO_STORE_TRACK_ID;
case "PrevalenceSupranationalRefLabForm":
return PREVALENCE_SUPRANATIONAL_REF_LAB_ID;
case "PrevalenceD28FollowUp":
return PREVALENCE_MORTALITY_FOLLOWUP_FORM_D28;
case "PrevalenceDischarge":
return PREVALENCE_MORTALITY_DISCHARGE_FORM;
case "PrevalenceCohortEnrolment":
return PREVALENCE_MORTALITY_COHORT_ENORL_FORM;

default:
throw new Error("Unknown Survey Type");
Expand Down Expand Up @@ -113,6 +122,19 @@ export const getChildSurveyType = (
case option === "Add New Supranational Ref Results":
case option?.startsWith("List Supranational Refs Results"):
return "PrevalenceSupranationalRefLabForm";

case option === "Add New D28 Follow-up":
case option?.startsWith("List D28 Follow-up"):
return "PrevalenceD28FollowUp";

case option === "Add New Discharge":
case option?.startsWith("List Discharge"):
return "PrevalenceDischarge";

case option === "Add New Cohort enrolment":
case option?.startsWith("List Cohort enrolment"):
return "PrevalenceCohortEnrolment";

default:
return undefined;
}
Expand Down Expand Up @@ -161,6 +183,9 @@ export const getSurveyOptions = (
case "PrevalencePathogenIsolatesLog":
case "PrevalenceSupranationalRefLabForm":
case "PPSPatientRegister":
case "PrevalenceD28FollowUp":
case "PrevalenceDischarge":
case "PrevalenceCohortEnrolment":
default:
return DefaultFormOptions(hasReadAccess, hasCaptureAccess);
}
Expand Down Expand Up @@ -194,6 +219,12 @@ export const getSurveyDisplayName = (surveyFormType: SURVEY_FORM_TYPES): string
return "Pathogen Isolate";
case "PrevalenceSupranationalRefLabForm":
return "Supranational Result";
case "PrevalenceD28FollowUp":
return "D28 Follow-up";
case "PrevalenceDischarge":
return "Discharge";
case "PrevalenceCohortEnrolment":
return "Cohort Enrolment";
default:
return "Survey";
}
Expand Down Expand Up @@ -234,6 +265,9 @@ export const isPaginatedSurveyList = (surveyFormType: SURVEY_FORM_TYPES): boolea
case "PrevalencePathogenIsolatesLog":
case "PrevalenceSampleShipTrackForm":
case "PrevalenceSupranationalRefLabForm":
case "PrevalenceD28FollowUp":
case "PrevalenceCohortEnrolment":
case "PrevalenceDischarge":
return true;
default:
return false;
Expand All @@ -246,6 +280,9 @@ export const isPrevalencePatientChild = (surveyFormType: SURVEY_FORM_TYPES): boo
case "PrevalencePathogenIsolatesLog":
case "PrevalenceSampleShipTrackForm":
case "PrevalenceSupranationalRefLabForm":
case "PrevalenceD28FollowUp":
case "PrevalenceDischarge":
case "PrevalenceCohortEnrolment":
return true;
default:
return false;
Expand Down
18 changes: 18 additions & 0 deletions src/domain/utils/getChildCountHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ import { SurveyRepository } from "../repositories/SurveyRepository";
import { getProgramId } from "./PPSProgramsHelper";
import {
PREVALENCE_CENTRAL_REF_LAB_FORM_ID,
PREVALENCE_MORTALITY_COHORT_ENORL_FORM,
PREVALENCE_MORTALITY_DISCHARGE_FORM,
PREVALENCE_MORTALITY_FOLLOWUP_FORM_D28,
PREVALENCE_PATHOGEN_ISO_STORE_TRACK_ID,
PREVALENCE_SAMPLE_SHIP_TRACK_FORM_ID,
PREVALENCE_SUPRANATIONAL_REF_LAB_ID,
Expand Down Expand Up @@ -76,6 +79,21 @@ export const getChildCount = ({
option: { label: `List Supranational Refs Results (${pc.count})` },
count: pc.count,
};
} else if (pc.id === PREVALENCE_MORTALITY_FOLLOWUP_FORM_D28) {
return {
option: { label: `List D28 Follow-up (${pc.count})` },
count: pc.count,
};
} else if (pc.id === PREVALENCE_MORTALITY_DISCHARGE_FORM) {
return {
option: { label: `List Discharge (${pc.count})` },
count: pc.count,
};
} else if (pc.id === PREVALENCE_MORTALITY_COHORT_ENORL_FORM) {
return {
option: { label: `List Cohort enrolment (${pc.count})` },
count: pc.count,
};
} else {
return {
option: { label: "" },
Expand Down
3 changes: 3 additions & 0 deletions src/domain/utils/getChildrenName.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ export const getChildrenName = (surveyFormType: SURVEY_FORM_TYPES): string[] =>
i18n.t("Central Ref Lab Results"),
i18n.t("Pathogen Isolates Logs"),
i18n.t("Supranational Ref Results"),
i18n.t("D28 Follow-up"),
i18n.t("Discharge"),
i18n.t("Cohort enrolment"),
];
case "PPSSurveyForm":
return [i18n.t("Countries")];
Expand Down
Loading

0 comments on commit 9946502

Please sign in to comment.