From 0f3332f75bbcbd763106c4c81280adbc54507526 Mon Sep 17 00:00:00 2001 From: Amit W Date: Wed, 18 Sep 2024 18:58:00 -0700 Subject: [PATCH 01/14] attempt to add new flood report form fields --- .../tablesConfig/Agriculture.tsx | 19 +++++++++++++++++++ apps/frontend/translations/en.json | 5 +++++ packages/interfaces/src/kobo/FloodDto.ts | 3 +++ 3 files changed, 27 insertions(+) diff --git a/apps/frontend/components/FormValidation/FloodFormValidation/tablesConfig/Agriculture.tsx b/apps/frontend/components/FormValidation/FloodFormValidation/tablesConfig/Agriculture.tsx index f28f1594..4ca25804 100644 --- a/apps/frontend/components/FormValidation/FloodFormValidation/tablesConfig/Agriculture.tsx +++ b/apps/frontend/components/FormValidation/FloodFormValidation/tablesConfig/Agriculture.tsx @@ -11,6 +11,16 @@ import { const colWidth = 8 * 9; const AgricultureColumns: GridColDef[] = [ + getColumnSetup({ + field: FloodSpecific.ToNamAgriAff, + disaster: FLOOD, + width: colWidth + 8 * 2, + }), + getColumnSetup({ + field: FloodSpecific.NumFarmCroAff, + disaster: FLOOD, + width: colWidth + 8 * 2, + }), getColumnSetup({ field: FloodSpecific.FarmAff, disaster: FLOOD, @@ -23,6 +33,7 @@ const AgricultureColumns: GridColDef[] = [ }), getColumnSetup({ field: FloodSpecific.SamNabAff, disaster: FLOOD }), getColumnSetup({ field: FloodSpecific.SamNabDam, disaster: FLOOD }), + getColumnSetup({ field: FloodSpecific.NumFarmPaddyAff, disaster: FLOOD }), getColumnSetup({ field: FloodSpecific.PaddyAff, disaster: FLOOD }), getColumnSetup({ field: FloodSpecific.PaddyDam, disaster: FLOOD }), getColumnSetup({ field: FloodSpecific.CowEva, disaster: FLOOD }), @@ -37,6 +48,13 @@ const AgricultureColumns: GridColDef[] = [ ]; const AgricultureColumnGroup: GridColumnGroupingModel = [ + { + ...getGroupSetup('families', FLOOD), + children: [ + { field: FloodSpecific.ToNamAgriAff }, + { field: FloodSpecific.NumFarmCroAff }, + ], + }, { ...getGroupSetup('plantation', FLOOD), children: [ @@ -47,6 +65,7 @@ const AgricultureColumnGroup: GridColumnGroupingModel = [ { ...getGroupSetup('seedling', FLOOD), children: [ + { field: FloodSpecific.NumFarmPaddyAff }, { field: FloodSpecific.SamNabAff }, { field: FloodSpecific.SamNabDam }, ], diff --git a/apps/frontend/translations/en.json b/apps/frontend/translations/en.json index 4109a1ca..97a429f5 100644 --- a/apps/frontend/translations/en.json +++ b/apps/frontend/translations/en.json @@ -211,8 +211,11 @@ "NumWareHDam": "Damaged", "NumCraftAff": "Affected", "NumCraftDam": "Damaged", + "ToNamAgriAff": "Affected", + "NumFarmCroAff": "Affected", "FarmAff": "Affected", "FarmDam": "Damaged", + "NumFarmPaddyAff": "Affected", "SamNabAff": "Affected", "SamNabDam": "Damaged", "PaddyAff": "Affected", @@ -548,6 +551,8 @@ "NumFe": "Women Missing Water", "TNumDeath": "Total Death Toll", "FamAgriAff": "Families with Affected Plantations", + "ToNamAgriAff": "Total number of households affecting farmland", + "NumFarmCroAff": "Number of households affected by mixed crops", "FarmAff": "Crop/Subsidiary plants Affected (ha)", "FarmDam": "Crop/Subsidiary plants Damaged (ha)", "SamNabAff": "Seedlings Affected (ha)", diff --git a/packages/interfaces/src/kobo/FloodDto.ts b/packages/interfaces/src/kobo/FloodDto.ts index f17f24f1..d4c78651 100644 --- a/packages/interfaces/src/kobo/FloodDto.ts +++ b/packages/interfaces/src/kobo/FloodDto.ts @@ -85,6 +85,9 @@ export class FloodDto { @IsOptional() @IsNumberString() readonly 'g10/g10_8/NumCraftDam'?: string; @IsOptional() @IsNumberString() readonly 'g11/g11_1/FarmAff'?: string; @IsOptional() @IsNumberString() readonly 'g11/g11_1/FarmDam'?: string; + @IsOptional() @IsNumberString() readonly 'g11/g11_1/ToNamAgriAff'?: string; + @IsOptional() @IsNumberString() readonly 'g11/g11_1/NumFarmCroAff'?: string; + @IsOptional() @IsNumberString() readonly 'g11/g11_2/NumFarmPaddyAff'?: string; @IsOptional() @IsNumberString() readonly 'g11/g11_2/SamNabAff'?: string; @IsOptional() @IsNumberString() readonly 'g11/g11_2/SamNabDam'?: string; @IsOptional() @IsNumberString() readonly 'g11/g11_3/PaddyAff'?: string; From 4f5c94dd9e0b280cd75ccd7905bbab9d74ab8001 Mon Sep 17 00:00:00 2001 From: Amit W Date: Wed, 18 Sep 2024 23:01:28 -0700 Subject: [PATCH 02/14] add new incident form fields --- .../IncidentFormValidation/tablesConfig/Social.tsx | 9 +++++++++ apps/frontend/translations/en.json | 2 ++ packages/interfaces/src/kobo/IncidentDto.ts | 2 ++ packages/interfaces/src/kobo/mapping/incident.ts | 4 ++++ 4 files changed, 17 insertions(+) diff --git a/apps/frontend/components/FormValidation/IncidentFormValidation/tablesConfig/Social.tsx b/apps/frontend/components/FormValidation/IncidentFormValidation/tablesConfig/Social.tsx index 37822ef3..eb7daaf6 100644 --- a/apps/frontend/components/FormValidation/IncidentFormValidation/tablesConfig/Social.tsx +++ b/apps/frontend/components/FormValidation/IncidentFormValidation/tablesConfig/Social.tsx @@ -26,6 +26,8 @@ const SocialColumns: GridColDef[] = [ getColumnSetup({ field: IncidentSpecific.StorageDam, disaster: INCIDENT }), getColumnSetup({ field: IncidentSpecific.CraftAff, disaster: INCIDENT }), getColumnSetup({ field: IncidentSpecific.CraftDam, disaster: INCIDENT }), + getColumnSetup({ field: IncidentSpecific.integer_ws0la67, disaster: INCIDENT }), + getColumnSetup({ field: IncidentSpecific.integer_da9ns07, disaster: INCIDENT }), ]; const SocialColumnGroup: GridColumnGroupingModel = [ @@ -64,6 +66,13 @@ const SocialColumnGroup: GridColumnGroupingModel = [ { field: IncidentSpecific.CraftDam }, ], }, + { + ...getGroupSetup('factory', INCIDENT), + children: [ + { field: IncidentSpecific.integer_ws0la67 }, + { field: IncidentSpecific.integer_da9ns07 }, + ], + }, ]; const groupParams: ColumnSetupParams = { diff --git a/apps/frontend/translations/en.json b/apps/frontend/translations/en.json index 97a429f5..53e35cee 100644 --- a/apps/frontend/translations/en.json +++ b/apps/frontend/translations/en.json @@ -211,6 +211,8 @@ "NumWareHDam": "Damaged", "NumCraftAff": "Affected", "NumCraftDam": "Damaged", + "integer_ws0la67": "Affected", + "integer_da9ns07": "Damaged", "ToNamAgriAff": "Affected", "NumFarmCroAff": "Affected", "FarmAff": "Affected", diff --git a/packages/interfaces/src/kobo/IncidentDto.ts b/packages/interfaces/src/kobo/IncidentDto.ts index 458d8b93..084f6138 100644 --- a/packages/interfaces/src/kobo/IncidentDto.ts +++ b/packages/interfaces/src/kobo/IncidentDto.ts @@ -86,6 +86,8 @@ export class IncidentDto { @IsOptional() @IsNumberString() readonly 'group_pk03i04/group_ub2hp14/CraftDam'?: string; @IsOptional() @IsNumberString() readonly 'group_gh6ag70/group_na4yi04/CropAff'?: string; @IsOptional() @IsNumberString() readonly 'group_gh6ag70/group_na4yi04/CropDam'?: string; + @IsOptional() @IsNumberString() readonly 'group_gh6ag70/group_az7bv13/integer_ws0la67'?: string; + @IsOptional() @IsNumberString() readonly 'group_gh6ag70/group_az7bv13/integer_da9ns07'?: string; @IsOptional() @IsNumberString() readonly 'group_gh6ag70/group_yh83p68/SamnabAff'?: string; @IsOptional() @IsNumberString() readonly 'group_gh6ag70/group_yh83p68/SamnabDam'?: string; @IsOptional() @IsNumberString() readonly 'group_gh6ag70/group_en38q31/PaddyAff'?: string; diff --git a/packages/interfaces/src/kobo/mapping/incident.ts b/packages/interfaces/src/kobo/mapping/incident.ts index 126fb5d2..4d4c4a9d 100644 --- a/packages/interfaces/src/kobo/mapping/incident.ts +++ b/packages/interfaces/src/kobo/mapping/incident.ts @@ -60,6 +60,8 @@ export enum IncidentSpecific { CraftDam = 'CraftDam', CropAff = 'CropAff', CropDam = 'CropDam', + integer_ws0la67 = 'integer_ws0la67', + integer_da9ns07 = 'integer_da9ns07', SamnabAff = 'SamnabAff', SamnabDam = 'SamnabDam', PaddyAff = 'PaddyAff', @@ -132,6 +134,8 @@ export const incidentSpecificKeys = { [IncidentSpecific.CraftDam]: 'group_pk03i04/group_ub2hp14/CraftDam', [IncidentSpecific.CropAff]: 'group_gh6ag70/group_na4yi04/CropAff', [IncidentSpecific.CropDam]: 'group_gh6ag70/group_na4yi04/CropDam', + [IncidentSpecific.integer_ws0la67]: 'group_gh6ag70/group_az7bv13/CropAff', + [IncidentSpecific.integer_da9ns07]: 'group_gh6ag70/group_az7bv13/CropDam', [IncidentSpecific.SamnabAff]: 'group_gh6ag70/group_yh83p68/SamnabAff', [IncidentSpecific.SamnabDam]: 'group_gh6ag70/group_yh83p68/SamnabDam', [IncidentSpecific.PaddyAff]: 'group_gh6ag70/group_en38q31/PaddyAff', From 7bb68d4379f18ec6e45bb3a56f9a4f8222228d2d Mon Sep 17 00:00:00 2001 From: Amit W Date: Wed, 18 Sep 2024 23:03:51 -0700 Subject: [PATCH 03/14] add shipwreck as an incident type --- packages/interfaces/src/kobo/constants.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/interfaces/src/kobo/constants.ts b/packages/interfaces/src/kobo/constants.ts index 014cfd34..2ab1dd99 100644 --- a/packages/interfaces/src/kobo/constants.ts +++ b/packages/interfaces/src/kobo/constants.ts @@ -30,6 +30,7 @@ export const IncidentMapping: MappingTypes = { drowning: '10', collapse: '11', weapon: '12', + shipwreck: '13', // Hide other incidents from the selection menu. // other: '99', }; From e022c560ed2a2e29a0b9fff62a501401b04d2494 Mon Sep 17 00:00:00 2001 From: ericboucher Date: Fri, 20 Sep 2024 23:20:31 +0200 Subject: [PATCH 04/14] Simplify Patch types --- .../tablesConfig/Agriculture.tsx | 2 +- .../tablesConfig/Social.tsx | 10 +- .../src/kobo/PatchDroughtFormDto.ts | 117 +++--------- .../interfaces/src/kobo/PatchFloodFormDto.ts | 172 +++--------------- .../src/kobo/PatchIncidentFormDto.ts | 106 +++-------- packages/interfaces/src/kobo/mapping/flood.ts | 6 + 6 files changed, 87 insertions(+), 326 deletions(-) diff --git a/apps/frontend/components/FormValidation/FloodFormValidation/tablesConfig/Agriculture.tsx b/apps/frontend/components/FormValidation/FloodFormValidation/tablesConfig/Agriculture.tsx index 4ca25804..e4896e5e 100644 --- a/apps/frontend/components/FormValidation/FloodFormValidation/tablesConfig/Agriculture.tsx +++ b/apps/frontend/components/FormValidation/FloodFormValidation/tablesConfig/Agriculture.tsx @@ -20,7 +20,7 @@ const AgricultureColumns: GridColDef[] = [ field: FloodSpecific.NumFarmCroAff, disaster: FLOOD, width: colWidth + 8 * 2, - }), + }), getColumnSetup({ field: FloodSpecific.FarmAff, disaster: FLOOD, diff --git a/apps/frontend/components/FormValidation/IncidentFormValidation/tablesConfig/Social.tsx b/apps/frontend/components/FormValidation/IncidentFormValidation/tablesConfig/Social.tsx index eb7daaf6..329cf60f 100644 --- a/apps/frontend/components/FormValidation/IncidentFormValidation/tablesConfig/Social.tsx +++ b/apps/frontend/components/FormValidation/IncidentFormValidation/tablesConfig/Social.tsx @@ -26,8 +26,14 @@ const SocialColumns: GridColDef[] = [ getColumnSetup({ field: IncidentSpecific.StorageDam, disaster: INCIDENT }), getColumnSetup({ field: IncidentSpecific.CraftAff, disaster: INCIDENT }), getColumnSetup({ field: IncidentSpecific.CraftDam, disaster: INCIDENT }), - getColumnSetup({ field: IncidentSpecific.integer_ws0la67, disaster: INCIDENT }), - getColumnSetup({ field: IncidentSpecific.integer_da9ns07, disaster: INCIDENT }), + getColumnSetup({ + field: IncidentSpecific.integer_ws0la67, + disaster: INCIDENT, + }), + getColumnSetup({ + field: IncidentSpecific.integer_da9ns07, + disaster: INCIDENT, + }), ]; const SocialColumnGroup: GridColumnGroupingModel = [ diff --git a/packages/interfaces/src/kobo/PatchDroughtFormDto.ts b/packages/interfaces/src/kobo/PatchDroughtFormDto.ts index 460f1dd8..6704fbc7 100644 --- a/packages/interfaces/src/kobo/PatchDroughtFormDto.ts +++ b/packages/interfaces/src/kobo/PatchDroughtFormDto.ts @@ -1,94 +1,25 @@ -import { IsDateString, IsIn, IsNumberString, IsOptional, IsString, Length } from 'class-validator'; +import { OmitType, PartialType } from '@nestjs/mapped-types'; -export class PatchDroughtFormDto { - @IsOptional() @IsString() readonly 'group_ve4vz14/q_Enum'!: string; - @IsOptional() @IsDateString() readonly 'group_ve4vz14/Date_report'!: string; - @IsOptional() @IsString() readonly 'group_ve4vz14/q_Funtion'!: string; - @IsOptional() @IsString() readonly 'group_ve4vz14/q_Phone'!: string; - @IsOptional() @IsString() @Length(2) readonly 'group_yu9nq00/Province'!: string; - @IsOptional() @IsString() @Length(4) readonly 'group_yu9nq00/District'!: string; - @IsOptional() @IsString() @Length(6) readonly 'group_yu9nq00/Commune'!: string; - @IsOptional() @IsDateString() readonly 'group_yu9nq00/Date_Dis': string; - @IsOptional() @IsNumberString() readonly 'group_yu9nq00/DisTyp'!: string; - @IsOptional() @IsNumberString() readonly 'group_dg01m69/NumVillAff'?: string; - @IsOptional() @IsNumberString() readonly 'group_dg01m69/group_kx2wb92/NumFamAff'?: string; - @IsOptional() @IsNumberString() readonly 'group_dg01m69/group_kx2wb92/NumPeoAff'?: string; - @IsOptional() @IsNumberString() readonly 'group_dg01m69/group_kx2wb92/NumMe'?: string; - @IsOptional() @IsNumberString() readonly 'group_dg01m69/group_kx2wb92/NumFe'?: string; - @IsOptional() @IsNumberString() readonly 'group_dg01m69/group_kx2wb92/NumKid'?: string; - @IsOptional() @IsNumberString() readonly 'group_dg01m69/group_kx2wb92/NumOld'?: string; - @IsOptional() @IsNumberString() readonly 'group_dg01m69/group_kx2wb92/NumDisMising'?: string; - @IsOptional() @IsNumberString() readonly 'group_dg01m69/group_nk3zh15/TNumDeath'?: string; - @IsOptional() @IsNumberString() readonly 'group_dg01m69/group_nk3zh15/NumMeDeath'?: string; - @IsOptional() @IsNumberString() readonly 'group_dg01m69/group_nk3zh15/NumFeDeath'?: string; - @IsOptional() @IsNumberString() readonly 'group_dg01m69/group_nk3zh15/NumKidDeath'?: string; - @IsOptional() @IsNumberString() readonly 'group_dg01m69/group_nk3zh15/NumOldDeath'?: string; - @IsOptional() @IsNumberString() readonly 'group_dg01m69/group_nk3zh15/NumDisDeath'?: string; - @IsOptional() @IsNumberString() readonly 'group_yn34m57/group_rg2xt75/FamAgriAff'?: string; - @IsOptional() @IsNumberString() readonly 'group_yn34m57/group_rg2xt75/FarmAff'?: string; - @IsOptional() @IsNumberString() readonly 'group_yn34m57/group_rg2xt75/FarmDam'?: string; - @IsOptional() @IsNumberString() readonly 'group_yn34m57/group_rg2xt75/SamNabAff'?: string; - @IsOptional() @IsNumberString() readonly 'group_yn34m57/group_rg2xt75/SamNabDam'?: string; - @IsOptional() @IsNumberString() readonly 'group_yn34m57/group_rg2xt75/PaddyAff'?: string; - @IsOptional() @IsNumberString() readonly 'group_yn34m57/group_rg2xt75/PaddyDam'?: string; - @IsOptional() @IsNumberString() readonly 'group_yn34m57/group_pl5gf73/CowDeath'?: string; - @IsOptional() @IsNumberString() readonly 'group_yn34m57/group_pl5gf73/BaffoDeath'?: string; - @IsOptional() @IsNumberString() readonly 'group_yn34m57/group_pl5gf73/PigDeath'?: string; - @IsOptional() @IsNumberString() readonly 'group_yn34m57/group_pl5gf73/BirdDeath'?: string; - @IsOptional() @IsNumberString() readonly 'group_em29q27/group_oh4fa74/NumSchNoHo2'?: string; - @IsOptional() @IsNumberString() readonly 'group_em29q27/group_oh4fa74/BotSourTang'?: string; - @IsOptional() @IsNumberString() readonly 'group_em29q27/group_oh4fa74/HSourNoTang'?: string; - @IsOptional() @IsNumberString() readonly 'group_em29q27/group_oh4fa74/NoSourHtang'?: string; - @IsOptional() @IsNumberString() readonly 'group_em29q27/group_oh4fa74/NoBtSourTan'?: string; - @IsOptional() @IsIn(['1', '2']) readonly 'group_em29q27/group_oh4fa74/Electric'?: string; - @IsOptional() @IsNumberString() readonly 'group_em29q27/group_mv5vw26/HealCenNoHo2'?: string; - @IsOptional() @IsNumberString() readonly 'group_em29q27/group_mv5vw26/HBotSourTang'?: string; - @IsOptional() @IsNumberString() readonly 'group_em29q27/group_mv5vw26/HaSouNoTang'?: string; - @IsOptional() @IsNumberString() readonly 'group_em29q27/group_mv5vw26/NoSourHatan'?: string; - @IsOptional() @IsNumberString() readonly 'group_em29q27/group_mv5vw26/NoBtSouTan'?: string; - @IsOptional() @IsIn(['1', '2']) readonly 'group_em29q27/group_mv5vw26/ElecForHeal'?: string; - @IsOptional() @IsNumberString() readonly 'group_pa74w20/group_qu0fl63/DamHavWater'?: string; - @IsOptional() @IsNumberString() readonly 'group_pa74w20/group_qu0fl63/DamNoWater'?: string; - @IsOptional() @IsNumberString() readonly 'group_pa74w20/group_om0vk80/PondHavWat'?: string; - @IsOptional() @IsNumberString() readonly 'group_pa74w20/group_om0vk80/PondNoWate'?: string; - @IsOptional() @IsNumberString() readonly 'group_pa74w20/group_uv6lk64/PlumWelHaWat'?: string; - @IsOptional() @IsNumberString() readonly 'group_pa74w20/group_uv6lk64/PluWelNoWat'?: string; - @IsOptional() @IsNumberString() readonly 'group_pa74w20/group_nr51r72/DigWelHaWat'?: string; - @IsOptional() @IsNumberString() readonly 'group_pa74w20/group_nr51r72/DigWelNoWat'?: string; - @IsOptional() @IsNumberString() readonly 'group_gn6qw58/group_sx5lq59/NuVilNedHep'?: string; - @IsOptional() @IsNumberString() readonly 'group_gn6qw58/group_sx5lq59/TNuFamNeHo2'?: string; - @IsOptional() @IsNumberString() readonly 'group_gn6qw58/group_sx5lq59/NumPeople'?: string; - @IsOptional() @IsNumberString() readonly 'group_gn6qw58/group_sx5lq59/NumMen'?: string; - @IsOptional() @IsNumberString() readonly 'group_gn6qw58/group_sx5lq59/NumWomen'?: string; - @IsOptional() @IsNumberString() readonly 'group_gn6qw58/group_sx5lq59/NumKids'?: string; - @IsOptional() @IsNumberString() readonly 'group_gn6qw58/group_sx5lq59/NumElder'?: string; - @IsOptional() @IsNumberString() readonly 'group_gn6qw58/group_sx5lq59/NumDis'?: string; - @IsOptional() @IsNumberString() readonly 'group_gn6qw58/group_ot4yf02/NumWatTank'?: string; - @IsOptional() @IsNumberString() readonly 'group_gn6qw58/group_ot4yf02/NuStorageFam'?: string; - @IsOptional() @IsNumberString() readonly 'group_gn6qw58/group_ot4yf02/NumWateTank'?: string; - @IsOptional() @IsNumberString() readonly 'group_gn6qw58/group_ot4yf02/NumFilter'?: string; - @IsOptional() @IsNumberString() readonly 'group_gn6qw58/group_ot4yf02/NumWatePur'?: string; - @IsOptional() @IsNumberString() readonly 'group_lm0eq74/group_ei7de96/NumWatStor'?: string; - @IsOptional() @IsNumberString() readonly 'group_lm0eq74/group_ei7de96/WatSorRepar'?: string; - @IsOptional() @IsNumberString() readonly 'group_lm0eq74/group_ei7de96/WatStoRepar'?: string; - @IsOptional() @IsNumberString() readonly 'group_lm0eq74/group_ei7de96/SolarNeed'?: string; - @IsOptional() @IsNumberString() readonly 'group_lm0eq74/group_ei7de96/FanNeed'?: string; - @IsOptional() @IsNumberString() readonly 'group_lm0eq74/group_ni05u89/WatStorNed'?: string; - @IsOptional() @IsNumberString() readonly 'group_lm0eq74/group_ni05u89/WatSorRep'?: string; - @IsOptional() @IsNumberString() readonly 'group_lm0eq74/group_ni05u89/WatStoRep'?: string; - @IsOptional() @IsNumberString() readonly 'group_lm0eq74/group_ni05u89/NuSolarNeed'?: string; - @IsOptional() @IsNumberString() readonly 'group_lm0eq74/group_ni05u89/NumFanNeed'?: string; - @IsOptional() @IsNumberString() readonly 'group_lt1ab13/LandSize'?: string; - @IsOptional() @IsNumberString() readonly 'group_lt1ab13/PumMachine'?: string; - @IsOptional() @IsNumberString() readonly 'group_lt1ab13/NumGasoline'?: string; - @IsOptional() @IsNumberString() readonly 'group_lt1ab13/NumFam'?: string; - @IsOptional() @IsNumberString() readonly 'group_wi2jc00/FamNoIncom'?: string; - @IsOptional() @IsNumberString() readonly 'group_wi2jc00/PeoNoIncom'?: string; - @IsOptional() @IsNumberString() readonly 'group_wi2jc00/FamNoFod'?: string; - @IsOptional() @IsNumberString() readonly 'group_wi2jc00/PeoNoFod'?: string; - @IsOptional() @IsIn(['1', '2']) readonly 'group_hp5cn05/NuKidColWat'?: string; - @IsOptional() @IsIn(['1', '2']) readonly 'group_hp5cn05/IfYes'?: string; - @IsOptional() @IsIn(['1', '2']) readonly 'group_hp5cn05/NuWoCollWat'?: string; - @IsOptional() @IsIn(['1', '2']) readonly 'group_hp5cn05/Yes'?: string; - @IsOptional() @IsIn(['1', '2']) readonly 'group_hp5cn05/TreatOccur'?: string; -} +import { DroughtDto } from './DroughtDto'; + +export class PatchDroughtFormDto extends PartialType( + OmitType(DroughtDto, [ + '_id', + 'formhub/uuid', + 'start', + 'end', + '__version__', + 'meta/instanceID', + 'meta/deprecatedID', + '_xform_id_string', + '_uuid', + '_attachments', + '_status', + '_geolocation', + '_submission_time', + '_tags', + '_notes', + '_validation_status', + '_submitted_by', + ] as const), +) {} diff --git a/packages/interfaces/src/kobo/PatchFloodFormDto.ts b/packages/interfaces/src/kobo/PatchFloodFormDto.ts index d1b1a06c..8868a9b9 100644 --- a/packages/interfaces/src/kobo/PatchFloodFormDto.ts +++ b/packages/interfaces/src/kobo/PatchFloodFormDto.ts @@ -1,149 +1,25 @@ -import { - IsDateString, - IsIn, - IsNumberString, - IsOptional, - IsString, - Length, - Matches, -} from 'class-validator'; +import { OmitType, PartialType } from '@nestjs/mapped-types'; -export class PatchFloodFormDto { - @IsOptional() @IsString() readonly 'g1/q_Enum'!: string; - @IsOptional() @IsString() readonly 'g1/q_Funtion'!: string; - @IsOptional() @IsString() readonly 'g1/q_Phone'!: string; - @IsOptional() @IsDateString() readonly 'g1/Date_report'!: string; - @IsOptional() @IsString() @Length(2) readonly 'g2/Province'!: string; - @IsOptional() @IsString() @Length(4) readonly 'g2/District'!: string; - @IsOptional() @IsString() @Length(6) readonly 'g2/Commune'!: string; - @IsOptional() @IsDateString() readonly 'g2/Date_Dis'!: string; - @IsOptional() @IsNumberString() readonly 'g2/DisTyp'!: string; - @IsOptional() @IsNumberString() readonly 'g2/flood_n'?: string; - @IsOptional() @IsNumberString() readonly 'g3/g3_1/NumVillAff'?: string; - @IsOptional() @IsNumberString() readonly 'g3/g3_1/g3_2/NumFamAff'?: string; - @IsOptional() @IsNumberString() readonly 'g3/g3_1/g3_2/NumPeoAff'?: string; - @IsOptional() @IsNumberString() readonly 'g3/g3_1/g3_2/NumFeAff'?: string; - @IsOptional() @IsNumberString() readonly 'g3/g4/TNumDeath'?: string; - @IsOptional() @IsNumberString() readonly 'g3/g4/NumMeDeath'?: string; - @IsOptional() @IsNumberString() readonly 'g3/g4/NumFeDeath'?: string; - @IsOptional() @IsNumberString() readonly 'g3/g4/NumKidDeath'?: string; - @IsOptional() @IsNumberString() readonly 'g3/g4/NumOldDeath'?: string; - @IsOptional() @IsNumberString() readonly 'g3/g4/NumDisDeath'?: string; - @IsOptional() @IsNumberString() readonly 'g3/g5/NumTMising'?: string; - @IsOptional() @IsNumberString() readonly 'g3/g5/NumMeMising'?: string; - @IsOptional() @IsNumberString() readonly 'g3/g5/NumFeMising'?: string; - @IsOptional() @IsNumberString() readonly 'g3/g5/NumKidMising'?: string; - @IsOptional() @IsNumberString() readonly 'g3/g5/NumOldMising'?: string; - @IsOptional() @IsNumberString() readonly 'g3/g5/NumDisMising'?: string; - @IsOptional() @IsNumberString() readonly 'g3/g6/NumTInjure'?: string; - @IsOptional() @IsNumberString() readonly 'g3/g6/NumMeInjure'?: string; - @IsOptional() @IsNumberString() readonly 'g3/g6/NumFeInjure'?: string; - @IsOptional() @IsNumberString() readonly 'g3/g6/NumKidInjure'?: string; - @IsOptional() @IsNumberString() readonly 'g3/g6/NumOldInjure'?: string; - @IsOptional() @IsNumberString() readonly 'g3/g6/NumDisInjure'?: string; - @IsOptional() @IsNumberString() readonly 'g3/g7/NumFamEva'?: string; - @IsOptional() @IsNumberString() readonly 'g3/g7/NumPeoEva'?: string; - @IsOptional() @IsNumberString() readonly 'g3/g7/NumMeEva'?: string; - @IsOptional() @IsNumberString() readonly 'g3/g7/NumFeEva'?: string; - @IsOptional() @IsNumberString() readonly 'g3/g7/NumKidEva'?: string; - @IsOptional() @IsNumberString() readonly 'g3/g7/NumOldEva'?: string; - @IsOptional() @IsNumberString() readonly 'g3/g7/NumDisEva'?: string; - @IsOptional() @IsNumberString() readonly 'g3/g8/NumFamRe'?: string; - @IsOptional() @IsNumberString() readonly 'g3/g8/NumPeoRe'?: string; - @IsOptional() @IsNumberString() readonly 'g3/g8/NumMeRe'?: string; - @IsOptional() @IsNumberString() readonly 'g3/g8/NumFeRe'?: string; - @IsOptional() @IsNumberString() readonly 'g3/g8/NumKidRe'?: string; - @IsOptional() @IsNumberString() readonly 'g3/g8/NumOldRe'?: string; - @IsOptional() @IsNumberString() readonly 'g3/g8/NumDisRe'?: string; - @IsOptional() @IsNumberString() readonly 'g3/g9/NumSafePla'?: string; - @IsOptional() @IsNumberString() readonly 'g3/g9/NumPeoSEC'?: string; - @IsOptional() @IsNumberString() readonly 'g10/g10_1/NumHouAff'?: string; - @IsOptional() @IsNumberString() readonly 'g10/g10_1/NumHouDam'?: string; - @IsOptional() @IsNumberString() readonly 'g10/g10_2/NumSchoAff'?: string; - @IsOptional() @IsNumberString() readonly 'g10/g10_2/NumSchoDam'?: string; - @IsOptional() @IsNumberString() readonly 'g10/g10_3/NumAffHeal'?: string; - @IsOptional() @IsNumberString() readonly 'g10/g10_3/NumDamHeal'?: string; - @IsOptional() @IsNumberString() readonly 'g10/g10_4/NumPagoAff'?: string; - @IsOptional() @IsNumberString() readonly 'g10/g10_4/NumPagoDam'?: string; - @IsOptional() @IsNumberString() readonly 'g10/g10_5/NumBuilAff'?: string; - @IsOptional() @IsNumberString() readonly 'g10/g10_5/NumBuilDam'?: string; - @IsOptional() @IsNumberString() readonly 'g10/g10_6/NumShopAff'?: string; - @IsOptional() @IsNumberString() readonly 'g10/g10_6/NumShopDam'?: string; - @IsOptional() @IsNumberString() readonly 'g10/g10_7/NumWareHAff'?: string; - @IsOptional() @IsNumberString() readonly 'g10/g10_7/NumWareHDam'?: string; - @IsOptional() @IsNumberString() readonly 'g10/g10_8/NumCraftAff'?: string; - @IsOptional() @IsNumberString() readonly 'g10/g10_8/NumCraftDam'?: string; - @IsOptional() @IsNumberString() readonly 'g11/g11_1/FarmAff'?: string; - @IsOptional() @IsNumberString() readonly 'g11/g11_1/FarmDam'?: string; - @IsOptional() @IsNumberString() readonly 'g11/g11_2/SamNabAff'?: string; - @IsOptional() @IsNumberString() readonly 'g11/g11_2/SamNabDam'?: string; - @IsOptional() @IsNumberString() readonly 'g11/g11_3/PaddyAff'?: string; - @IsOptional() @IsNumberString() readonly 'g11/g11_3/PaddyDam'?: string; - @IsOptional() @IsNumberString() readonly 'g11/g11_4/CowEva'?: string; - @IsOptional() @IsNumberString() readonly 'g11/g11_4/CowDeath'?: string; - @IsOptional() @IsNumberString() readonly 'g11/g11_4/CowMissing'?: string; - @IsOptional() @IsNumberString() readonly 'g11/g11_5/PigEva'?: string; - @IsOptional() @IsNumberString() readonly 'g11/g11_5/PigDeath'?: string; - @IsOptional() @IsNumberString() readonly 'g11/g11_5/PigMissing'?: string; - @IsOptional() @IsNumberString() readonly 'g11/g11_6/BirdEva'?: string; - @IsOptional() @IsNumberString() readonly 'g11/g11_6/BirdDeath'?: string; - @IsOptional() @IsNumberString() readonly 'g11/g11_6/BirdMissing'?: string; - @IsOptional() @IsNumberString() readonly 'g12/g12_1/RubberRoAff'?: string; - @IsOptional() @IsNumberString() readonly 'g12/g12_1/RubberRoDam'?: string; - @IsOptional() @IsNumberString() readonly 'g12/g12_2/ConcretAff'?: string; - @IsOptional() @IsNumberString() readonly 'g12/g12_2/ConcretDam'?: string; - @IsOptional() @IsNumberString() readonly 'g12/g12_3/RuralRoAff'?: string; - @IsOptional() @IsNumberString() readonly 'g12/g12_3/RuralRoDam'?: string; - @IsOptional() @IsNumberString() readonly 'g12/g12_4/BridgeAff'?: string; - @IsOptional() @IsNumberString() readonly 'g12/g12_4/BridgeDam'?: string; - @IsOptional() @IsNumberString() readonly 'g12/g12_5/BeleBridAff'?: string; - @IsOptional() @IsNumberString() readonly 'g12/g12_5/BeleBridDam'?: string; - @IsOptional() @IsNumberString() readonly 'g12/g12_6/DrainageAff'?: string; - @IsOptional() @IsNumberString() readonly 'g12/g12_6/DrainageDam'?: string; - @IsOptional() @IsNumberString() readonly 'g13/g13_1/DamAff'?: string; - @IsOptional() @IsNumberString() readonly 'g13/g13_1/DamDamaged'?: string; - @IsOptional() @IsNumberString() readonly 'g13/g13_2/WatGateAff'?: string; - @IsOptional() @IsNumberString() readonly 'g13/g13_2/WatGateDam'?: string; - @IsOptional() @IsNumberString() readonly 'g13/g13_3/PlumWelAff'?: string; - @IsOptional() @IsNumberString() readonly 'g13/g13_3/PlumWelDam'?: string; - @IsOptional() @IsNumberString() readonly 'g13/g13_4/DigWellAff'?: string; - @IsOptional() @IsNumberString() readonly 'g13/g13_4/DigWellDam'?: string; - @IsOptional() @IsNumberString() readonly 'g13/g13_5/PondAff'?: string; - @IsOptional() @IsNumberString() readonly 'g13/g13_5/PondDam'?: string; - @IsOptional() @IsNumberString() readonly 'g13/g13_6/LatrineAff'?: string; - @IsOptional() @IsNumberString() readonly 'g13/g13_6/LatrineDam'?: string; - @IsOptional() @IsNumberString() readonly 'g13/g13_7/RiverBreak'?: string; - @IsOptional() @IsNumberString() readonly 'g13/g13_7/RiverBreakLo'?: string; - @IsOptional() @IsNumberString() readonly 'g13/BrolayAff'?: string; - @IsOptional() @IsNumberString() readonly 'g13/BrolayDam'?: string; - @IsOptional() @IsNumberString() readonly 'g14/g14_1/NumFamTent'?: string; - @IsOptional() @IsNumberString() readonly 'g14/g14_1/NumPeoTent'?: string; - @IsOptional() @IsNumberString() readonly 'g14/g14_2/NumFamBuil'?: string; - @IsOptional() @IsNumberString() readonly 'g14/g14_2/NumPeoBuil'?: string; - @IsOptional() @IsNumberString() readonly 'g14/g14_3/NumFamRela'?: string; - @IsOptional() @IsNumberString() readonly 'g14/g14_3/NumPeoRela'?: string; - @IsOptional() @IsNumberString() readonly 'g15/g15_1/NumTemSch'?: string; - @IsOptional() @IsNumberString() readonly 'g15/g15_1/StuAcTemSch'?: string; - @IsOptional() @IsNumberString() readonly 'g15/g15_2/SchUseSafe'?: string; - @IsOptional() @IsNumberString() readonly 'g15/g15_2/NumStu'?: string; - @IsOptional() @IsNumberString() readonly 'g15/g15_3/NumSchStop'?: string; - @IsOptional() @IsNumberString() readonly 'g15/g15_3/NumStuNoCla'?: string; - @IsOptional() @IsNumberString() readonly 'g16_1/g16_1_001/NumFamNoWa'?: string; - @IsOptional() @IsNumberString() readonly 'g16_1/g16_1_001/NumPeoNoWa'?: string; - @IsOptional() @IsNumberString() readonly 'g16_1/g16_1_001/TimeAceWa'?: string; - @IsOptional() @IsNumberString() readonly 'g16_1/g16_1_001/NuFamNoWaEq'?: string; - @IsOptional() @IsNumberString() readonly 'g16_1/g16_1_001/NuFamNoLat'?: string; - @IsOptional() @IsNumberString() readonly 'g17/g17_1/NonActingH'?: string; - @IsOptional() @IsNumberString() readonly 'g17/g17_1/PeoCanAceH'?: string; - @IsOptional() @IsNumberString() readonly 'g17/g17_1/NumDoctor'?: string; - @IsOptional() @IsNumberString() readonly 'g17/g17_1/NumNurse'?: string; - @IsOptional() @IsNumberString() readonly 'g17/g17_1/NumStaff'?: string; - @IsOptional() @IsNumberString() readonly 'g18/g18_1/NumFamNoFod'?: string; - @IsOptional() @IsNumberString() readonly 'g18/g18_1/NumPeoNoFod'?: string; - @IsOptional() @IsNumberString() readonly 'g18/FamNoFod7d'?: string; - @IsOptional() @IsNumberString() readonly 'g18/g18_2/NumActShop'?: string; - @IsOptional() @IsNumberString() readonly 'g18/g18_2/NumNoActShop'?: string; - @IsOptional() @IsIn(['1', '2']) readonly 'g18/RicePrice'?: string; - @IsOptional() @Matches(/^[0-9 ]+$/) readonly 'g19/threat'?: string; - @IsOptional() @IsString() readonly 'g19/other'?: string; -} +import { FloodDto } from './FloodDto'; + +export class PatchFloodFormDto extends PartialType( + OmitType(FloodDto, [ + '_id', + 'formhub/uuid', + 'start', + 'end', + '__version__', + 'meta/instanceID', + 'meta/deprecatedID', + '_xform_id_string', + '_uuid', + '_attachments', + '_status', + '_geolocation', + '_submission_time', + '_tags', + '_notes', + '_validation_status', + '_submitted_by', + ] as const), +) {} diff --git a/packages/interfaces/src/kobo/PatchIncidentFormDto.ts b/packages/interfaces/src/kobo/PatchIncidentFormDto.ts index 07b74098..619ae750 100644 --- a/packages/interfaces/src/kobo/PatchIncidentFormDto.ts +++ b/packages/interfaces/src/kobo/PatchIncidentFormDto.ts @@ -1,83 +1,25 @@ -import { IsDateString, IsNumberString, IsOptional, IsString, Length } from 'class-validator'; +import { OmitType, PartialType } from '@nestjs/mapped-types'; -export class PatchIncidentFormDto { - @IsOptional() @IsString() readonly 'G1/q_Enum'!: string; - @IsOptional() @IsString() readonly 'G1/q_Funtion'!: string; - @IsOptional() @IsString() readonly 'G1/q_Phone'!: string; - @IsOptional() @IsDateString() readonly 'G1/Date_report'!: string; - @IsOptional() @IsDateString() readonly 'G2/Date_Dis'!: string; - @IsOptional() @IsNumberString() readonly 'G2/DisTyp'!: string; - @IsOptional() @IsString() readonly 'G2/Specify'?: string; - @IsOptional() @IsString() @Length(2) readonly 'G2/Province'!: string; - @IsOptional() @IsString() @Length(4) readonly 'G2/District'!: string; - @IsOptional() @IsString() @Length(6) readonly 'G2/Commune'!: string; - @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_pf1pd97/NumVillAff'?: string; - @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_pf1pd97/NumFamAff'?: string; - @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_pf1pd97/NumPeoAff'?: string; - @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_pf1pd97/NumFeAff'?: string; - @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_bz3jq33/NumDeathTo'?: string; - @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_bz3jq33/NumMeDeath'?: string; - @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_bz3jq33/NumFeDeath'?: string; - @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_bz3jq33/NumKidDeath'?: string; - @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_bz3jq33/NumOldDeath'?: string; - @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_bz3jq33/NumDisDeath'?: string; - @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_th37h10/ToNumMising'?: string; - @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_th37h10/NumMeMising'?: string; - @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_th37h10/NumFeMising'?: string; - @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_th37h10/NumKidMising'?: string; - @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_th37h10/NumOldMising'?: string; - @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_th37h10/NumDisMising'?: string; - @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_sa7hz27/ToNumInjure'?: string; - @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_sa7hz27/NumMeInjure'?: string; - @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_sa7hz27/NumFeInjure'?: string; - @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_sa7hz27/NumKidInjure'?: string; - @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_sa7hz27/NumOldInjure'?: string; - @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_sa7hz27/NumDisInjure'?: string; - @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_sg8yl06/NumFamEva'?: string; - @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_sg8yl06/NumPeoEva'?: string; - @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_sg8yl06/NumMeEva'?: string; - @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_sg8yl06/NumFeEva'?: string; - @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_sg8yl06/NumKidEva'?: string; - @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_sg8yl06/NumOldEva'?: string; - @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_sg8yl06/NumDisEva'?: string; - @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_mq8uz76/NumFamRe'?: string; - @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_mq8uz76/NumPeoRe'?: string; - @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_mq8uz76/NumMeRe'?: string; - @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_mq8uz76/NumFeRe'?: string; - @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_mq8uz76/NumKidRe'?: string; - @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_mq8uz76/NumOldRe'?: string; - @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_mq8uz76/NumDisRe'?: string; - @IsOptional() @IsNumberString() readonly 'group_fh3jp70/group_cn0sw74/PartlyBurn'?: string; - @IsOptional() @IsNumberString() readonly 'group_fh3jp70/group_cn0sw74/CompletBurn'?: string; - @IsOptional() @IsNumberString() readonly 'group_fh3jp70/group_ez5mr58/SchAff'?: string; - @IsOptional() @IsNumberString() readonly 'group_fh3jp70/group_ez5mr58/SchDam'?: string; - @IsOptional() @IsNumberString() readonly 'group_fh3jp70/group_bj6tu99/HealthAff'?: string; - @IsOptional() @IsNumberString() readonly 'group_fh3jp70/group_bj6tu99/HealthDam'?: string; - @IsOptional() @IsNumberString() readonly 'group_fh3jp70/group_pv8hz72/RivBreakLo'?: string; - @IsOptional() @IsNumberString() readonly 'group_fh3jp70/group_pv8hz72/RivBreakWid'?: string; - @IsOptional() @IsNumberString() readonly 'group_fh3jp70/group_pv8hz72/NationalRod'?: string; - @IsOptional() @IsNumberString() readonly 'group_fh3jp70/group_pv8hz72/RuralRoad'?: string; - @IsOptional() @IsNumberString() readonly 'group_fh3jp70/group_pv8hz72/Bridge'?: string; - @IsOptional() @IsNumberString() readonly 'group_pk03i04/group_wa9cj38/PagoAff'?: string; - @IsOptional() @IsNumberString() readonly 'group_pk03i04/group_wa9cj38/PagoDam'?: string; - @IsOptional() @IsNumberString() readonly 'group_pk03i04/group_fg5ko43/BuildingAff'?: string; - @IsOptional() @IsNumberString() readonly 'group_pk03i04/group_fg5ko43/BuildingDam'?: string; - @IsOptional() @IsNumberString() readonly 'group_pk03i04/group_hi74i16/MarketAff'?: string; - @IsOptional() @IsNumberString() readonly 'group_pk03i04/group_hi74i16/MarketDam'?: string; - @IsOptional() @IsNumberString() readonly 'group_pk03i04/group_lf9ou90/StorageAff'?: string; - @IsOptional() @IsNumberString() readonly 'group_pk03i04/group_lf9ou90/StorageDam'?: string; - @IsOptional() @IsNumberString() readonly 'group_pk03i04/group_ub2hp14/CraftAff'?: string; - @IsOptional() @IsNumberString() readonly 'group_pk03i04/group_ub2hp14/CraftDam'?: string; - @IsOptional() @IsNumberString() readonly 'group_gh6ag70/group_na4yi04/CropAff'?: string; - @IsOptional() @IsNumberString() readonly 'group_gh6ag70/group_na4yi04/CropDam'?: string; - @IsOptional() @IsNumberString() readonly 'group_gh6ag70/group_yh83p68/SamnabAff'?: string; - @IsOptional() @IsNumberString() readonly 'group_gh6ag70/group_yh83p68/SamnabDam'?: string; - @IsOptional() @IsNumberString() readonly 'group_gh6ag70/group_en38q31/PaddyAff'?: string; - @IsOptional() @IsNumberString() readonly 'group_gh6ag70/group_en38q31/PaddyDam'?: string; - @IsOptional() @IsNumberString() readonly 'group_gh6ag70/group_wb0mf29/CowDeath'?: string; - @IsOptional() @IsNumberString() readonly 'group_gh6ag70/group_wb0mf29/BaffoDeath'?: string; - @IsOptional() @IsNumberString() readonly 'group_gh6ag70/group_wb0mf29/PigDeath'?: string; - @IsOptional() @IsNumberString() readonly 'group_gh6ag70/group_wb0mf29/ChickDeath'?: string; - @IsOptional() @IsNumberString() readonly 'group_gh6ag70/group_gu1xp89/NumJungleAf'?: string; - @IsOptional() @IsNumberString() readonly 'group_gh6ag70/group_gu1xp89/FarmAf'?: string; -} +import { IncidentDto } from './IncidentDto'; + +export class PatchIncidentFormDto extends PartialType( + OmitType(IncidentDto, [ + '_id', + 'formhub/uuid', + 'start', + 'end', + '__version__', + 'meta/instanceID', + 'meta/deprecatedID', + '_xform_id_string', + '_uuid', + '_attachments', + '_status', + '_geolocation', + '_submission_time', + '_tags', + '_notes', + '_validation_status', + '_submitted_by', + ] as const), +) {} diff --git a/packages/interfaces/src/kobo/mapping/flood.ts b/packages/interfaces/src/kobo/mapping/flood.ts index 4d1755f9..1508624d 100644 --- a/packages/interfaces/src/kobo/mapping/flood.ts +++ b/packages/interfaces/src/kobo/mapping/flood.ts @@ -2,6 +2,7 @@ export enum FloodSpecific { floodN = 'floodN', + ToNamAgriAff = 'ToNamAgriAff', NumVillAff = 'NumVillAff', NumFamAff = 'NumFamAff', NumPeoAff = 'NumPeoAff', @@ -127,6 +128,8 @@ export enum FloodSpecific { NumActShop = 'NumActShop', NumNoActShop = 'NumNoActShop', RicePrice = 'RicePrice', + NumFarmCroAff = 'NumFarmCroAff', + NumFarmPaddyAff = 'NumFarmPaddyAff', threat = 'threat', other = 'other', } @@ -189,8 +192,11 @@ export const floodSpecificKeys = { [FloodSpecific.NumCraftDam]: 'g10/g10_8/NumCraftDam', [FloodSpecific.FarmAff]: 'g11/g11_1/FarmAff', [FloodSpecific.FarmDam]: 'g11/g11_1/FarmDam', + [FloodSpecific.NumFarmCroAff]: 'g11/g11_1/NumFarmCroAff', + [FloodSpecific.ToNamAgriAff]: 'g11/g11_1/ToNamAgriAff', [FloodSpecific.SamNabAff]: 'g11/g11_2/SamNabAff', [FloodSpecific.SamNabDam]: 'g11/g11_2/SamNabDam', + [FloodSpecific.NumFarmPaddyAff]: 'g11/g11_2/NumFarmPaddyAff', [FloodSpecific.PaddyAff]: 'g11/g11_3/PaddyAff', [FloodSpecific.PaddyDam]: 'g11/g11_3/PaddyDam', [FloodSpecific.CowEva]: 'g11/g11_4/CowEva', From ec041fa84470cf25ff798f20641a903b82797f13 Mon Sep 17 00:00:00 2001 From: ericboucher Date: Fri, 20 Sep 2024 23:35:04 +0200 Subject: [PATCH 05/14] Fix linter --- packages/interfaces/src/kobo/mapping/incident.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/interfaces/src/kobo/mapping/incident.ts b/packages/interfaces/src/kobo/mapping/incident.ts index 4d4c4a9d..f32094b6 100644 --- a/packages/interfaces/src/kobo/mapping/incident.ts +++ b/packages/interfaces/src/kobo/mapping/incident.ts @@ -134,8 +134,8 @@ export const incidentSpecificKeys = { [IncidentSpecific.CraftDam]: 'group_pk03i04/group_ub2hp14/CraftDam', [IncidentSpecific.CropAff]: 'group_gh6ag70/group_na4yi04/CropAff', [IncidentSpecific.CropDam]: 'group_gh6ag70/group_na4yi04/CropDam', - [IncidentSpecific.integer_ws0la67]: 'group_gh6ag70/group_az7bv13/CropAff', - [IncidentSpecific.integer_da9ns07]: 'group_gh6ag70/group_az7bv13/CropDam', + [IncidentSpecific.integer_ws0la67]: 'group_gh6ag70/group_az7bv13/integer_ws0la67', + [IncidentSpecific.integer_da9ns07]: 'group_gh6ag70/group_az7bv13/integer_da9ns07', [IncidentSpecific.SamnabAff]: 'group_gh6ag70/group_yh83p68/SamnabAff', [IncidentSpecific.SamnabDam]: 'group_gh6ag70/group_yh83p68/SamnabDam', [IncidentSpecific.PaddyAff]: 'group_gh6ag70/group_en38q31/PaddyAff', From d65e3b5dbd131e1a6d6fe49a3481b450e03d8928 Mon Sep 17 00:00:00 2001 From: ericboucher Date: Fri, 20 Sep 2024 23:45:58 +0200 Subject: [PATCH 06/14] Revert OmitType, PartialType changes that seem to create build issues --- .../src/kobo/PatchDroughtFormDto.ts | 117 +++++++++--- .../interfaces/src/kobo/PatchFloodFormDto.ts | 172 +++++++++++++++--- .../src/kobo/PatchIncidentFormDto.ts | 106 ++++++++--- 3 files changed, 323 insertions(+), 72 deletions(-) diff --git a/packages/interfaces/src/kobo/PatchDroughtFormDto.ts b/packages/interfaces/src/kobo/PatchDroughtFormDto.ts index 6704fbc7..460f1dd8 100644 --- a/packages/interfaces/src/kobo/PatchDroughtFormDto.ts +++ b/packages/interfaces/src/kobo/PatchDroughtFormDto.ts @@ -1,25 +1,94 @@ -import { OmitType, PartialType } from '@nestjs/mapped-types'; +import { IsDateString, IsIn, IsNumberString, IsOptional, IsString, Length } from 'class-validator'; -import { DroughtDto } from './DroughtDto'; - -export class PatchDroughtFormDto extends PartialType( - OmitType(DroughtDto, [ - '_id', - 'formhub/uuid', - 'start', - 'end', - '__version__', - 'meta/instanceID', - 'meta/deprecatedID', - '_xform_id_string', - '_uuid', - '_attachments', - '_status', - '_geolocation', - '_submission_time', - '_tags', - '_notes', - '_validation_status', - '_submitted_by', - ] as const), -) {} +export class PatchDroughtFormDto { + @IsOptional() @IsString() readonly 'group_ve4vz14/q_Enum'!: string; + @IsOptional() @IsDateString() readonly 'group_ve4vz14/Date_report'!: string; + @IsOptional() @IsString() readonly 'group_ve4vz14/q_Funtion'!: string; + @IsOptional() @IsString() readonly 'group_ve4vz14/q_Phone'!: string; + @IsOptional() @IsString() @Length(2) readonly 'group_yu9nq00/Province'!: string; + @IsOptional() @IsString() @Length(4) readonly 'group_yu9nq00/District'!: string; + @IsOptional() @IsString() @Length(6) readonly 'group_yu9nq00/Commune'!: string; + @IsOptional() @IsDateString() readonly 'group_yu9nq00/Date_Dis': string; + @IsOptional() @IsNumberString() readonly 'group_yu9nq00/DisTyp'!: string; + @IsOptional() @IsNumberString() readonly 'group_dg01m69/NumVillAff'?: string; + @IsOptional() @IsNumberString() readonly 'group_dg01m69/group_kx2wb92/NumFamAff'?: string; + @IsOptional() @IsNumberString() readonly 'group_dg01m69/group_kx2wb92/NumPeoAff'?: string; + @IsOptional() @IsNumberString() readonly 'group_dg01m69/group_kx2wb92/NumMe'?: string; + @IsOptional() @IsNumberString() readonly 'group_dg01m69/group_kx2wb92/NumFe'?: string; + @IsOptional() @IsNumberString() readonly 'group_dg01m69/group_kx2wb92/NumKid'?: string; + @IsOptional() @IsNumberString() readonly 'group_dg01m69/group_kx2wb92/NumOld'?: string; + @IsOptional() @IsNumberString() readonly 'group_dg01m69/group_kx2wb92/NumDisMising'?: string; + @IsOptional() @IsNumberString() readonly 'group_dg01m69/group_nk3zh15/TNumDeath'?: string; + @IsOptional() @IsNumberString() readonly 'group_dg01m69/group_nk3zh15/NumMeDeath'?: string; + @IsOptional() @IsNumberString() readonly 'group_dg01m69/group_nk3zh15/NumFeDeath'?: string; + @IsOptional() @IsNumberString() readonly 'group_dg01m69/group_nk3zh15/NumKidDeath'?: string; + @IsOptional() @IsNumberString() readonly 'group_dg01m69/group_nk3zh15/NumOldDeath'?: string; + @IsOptional() @IsNumberString() readonly 'group_dg01m69/group_nk3zh15/NumDisDeath'?: string; + @IsOptional() @IsNumberString() readonly 'group_yn34m57/group_rg2xt75/FamAgriAff'?: string; + @IsOptional() @IsNumberString() readonly 'group_yn34m57/group_rg2xt75/FarmAff'?: string; + @IsOptional() @IsNumberString() readonly 'group_yn34m57/group_rg2xt75/FarmDam'?: string; + @IsOptional() @IsNumberString() readonly 'group_yn34m57/group_rg2xt75/SamNabAff'?: string; + @IsOptional() @IsNumberString() readonly 'group_yn34m57/group_rg2xt75/SamNabDam'?: string; + @IsOptional() @IsNumberString() readonly 'group_yn34m57/group_rg2xt75/PaddyAff'?: string; + @IsOptional() @IsNumberString() readonly 'group_yn34m57/group_rg2xt75/PaddyDam'?: string; + @IsOptional() @IsNumberString() readonly 'group_yn34m57/group_pl5gf73/CowDeath'?: string; + @IsOptional() @IsNumberString() readonly 'group_yn34m57/group_pl5gf73/BaffoDeath'?: string; + @IsOptional() @IsNumberString() readonly 'group_yn34m57/group_pl5gf73/PigDeath'?: string; + @IsOptional() @IsNumberString() readonly 'group_yn34m57/group_pl5gf73/BirdDeath'?: string; + @IsOptional() @IsNumberString() readonly 'group_em29q27/group_oh4fa74/NumSchNoHo2'?: string; + @IsOptional() @IsNumberString() readonly 'group_em29q27/group_oh4fa74/BotSourTang'?: string; + @IsOptional() @IsNumberString() readonly 'group_em29q27/group_oh4fa74/HSourNoTang'?: string; + @IsOptional() @IsNumberString() readonly 'group_em29q27/group_oh4fa74/NoSourHtang'?: string; + @IsOptional() @IsNumberString() readonly 'group_em29q27/group_oh4fa74/NoBtSourTan'?: string; + @IsOptional() @IsIn(['1', '2']) readonly 'group_em29q27/group_oh4fa74/Electric'?: string; + @IsOptional() @IsNumberString() readonly 'group_em29q27/group_mv5vw26/HealCenNoHo2'?: string; + @IsOptional() @IsNumberString() readonly 'group_em29q27/group_mv5vw26/HBotSourTang'?: string; + @IsOptional() @IsNumberString() readonly 'group_em29q27/group_mv5vw26/HaSouNoTang'?: string; + @IsOptional() @IsNumberString() readonly 'group_em29q27/group_mv5vw26/NoSourHatan'?: string; + @IsOptional() @IsNumberString() readonly 'group_em29q27/group_mv5vw26/NoBtSouTan'?: string; + @IsOptional() @IsIn(['1', '2']) readonly 'group_em29q27/group_mv5vw26/ElecForHeal'?: string; + @IsOptional() @IsNumberString() readonly 'group_pa74w20/group_qu0fl63/DamHavWater'?: string; + @IsOptional() @IsNumberString() readonly 'group_pa74w20/group_qu0fl63/DamNoWater'?: string; + @IsOptional() @IsNumberString() readonly 'group_pa74w20/group_om0vk80/PondHavWat'?: string; + @IsOptional() @IsNumberString() readonly 'group_pa74w20/group_om0vk80/PondNoWate'?: string; + @IsOptional() @IsNumberString() readonly 'group_pa74w20/group_uv6lk64/PlumWelHaWat'?: string; + @IsOptional() @IsNumberString() readonly 'group_pa74w20/group_uv6lk64/PluWelNoWat'?: string; + @IsOptional() @IsNumberString() readonly 'group_pa74w20/group_nr51r72/DigWelHaWat'?: string; + @IsOptional() @IsNumberString() readonly 'group_pa74w20/group_nr51r72/DigWelNoWat'?: string; + @IsOptional() @IsNumberString() readonly 'group_gn6qw58/group_sx5lq59/NuVilNedHep'?: string; + @IsOptional() @IsNumberString() readonly 'group_gn6qw58/group_sx5lq59/TNuFamNeHo2'?: string; + @IsOptional() @IsNumberString() readonly 'group_gn6qw58/group_sx5lq59/NumPeople'?: string; + @IsOptional() @IsNumberString() readonly 'group_gn6qw58/group_sx5lq59/NumMen'?: string; + @IsOptional() @IsNumberString() readonly 'group_gn6qw58/group_sx5lq59/NumWomen'?: string; + @IsOptional() @IsNumberString() readonly 'group_gn6qw58/group_sx5lq59/NumKids'?: string; + @IsOptional() @IsNumberString() readonly 'group_gn6qw58/group_sx5lq59/NumElder'?: string; + @IsOptional() @IsNumberString() readonly 'group_gn6qw58/group_sx5lq59/NumDis'?: string; + @IsOptional() @IsNumberString() readonly 'group_gn6qw58/group_ot4yf02/NumWatTank'?: string; + @IsOptional() @IsNumberString() readonly 'group_gn6qw58/group_ot4yf02/NuStorageFam'?: string; + @IsOptional() @IsNumberString() readonly 'group_gn6qw58/group_ot4yf02/NumWateTank'?: string; + @IsOptional() @IsNumberString() readonly 'group_gn6qw58/group_ot4yf02/NumFilter'?: string; + @IsOptional() @IsNumberString() readonly 'group_gn6qw58/group_ot4yf02/NumWatePur'?: string; + @IsOptional() @IsNumberString() readonly 'group_lm0eq74/group_ei7de96/NumWatStor'?: string; + @IsOptional() @IsNumberString() readonly 'group_lm0eq74/group_ei7de96/WatSorRepar'?: string; + @IsOptional() @IsNumberString() readonly 'group_lm0eq74/group_ei7de96/WatStoRepar'?: string; + @IsOptional() @IsNumberString() readonly 'group_lm0eq74/group_ei7de96/SolarNeed'?: string; + @IsOptional() @IsNumberString() readonly 'group_lm0eq74/group_ei7de96/FanNeed'?: string; + @IsOptional() @IsNumberString() readonly 'group_lm0eq74/group_ni05u89/WatStorNed'?: string; + @IsOptional() @IsNumberString() readonly 'group_lm0eq74/group_ni05u89/WatSorRep'?: string; + @IsOptional() @IsNumberString() readonly 'group_lm0eq74/group_ni05u89/WatStoRep'?: string; + @IsOptional() @IsNumberString() readonly 'group_lm0eq74/group_ni05u89/NuSolarNeed'?: string; + @IsOptional() @IsNumberString() readonly 'group_lm0eq74/group_ni05u89/NumFanNeed'?: string; + @IsOptional() @IsNumberString() readonly 'group_lt1ab13/LandSize'?: string; + @IsOptional() @IsNumberString() readonly 'group_lt1ab13/PumMachine'?: string; + @IsOptional() @IsNumberString() readonly 'group_lt1ab13/NumGasoline'?: string; + @IsOptional() @IsNumberString() readonly 'group_lt1ab13/NumFam'?: string; + @IsOptional() @IsNumberString() readonly 'group_wi2jc00/FamNoIncom'?: string; + @IsOptional() @IsNumberString() readonly 'group_wi2jc00/PeoNoIncom'?: string; + @IsOptional() @IsNumberString() readonly 'group_wi2jc00/FamNoFod'?: string; + @IsOptional() @IsNumberString() readonly 'group_wi2jc00/PeoNoFod'?: string; + @IsOptional() @IsIn(['1', '2']) readonly 'group_hp5cn05/NuKidColWat'?: string; + @IsOptional() @IsIn(['1', '2']) readonly 'group_hp5cn05/IfYes'?: string; + @IsOptional() @IsIn(['1', '2']) readonly 'group_hp5cn05/NuWoCollWat'?: string; + @IsOptional() @IsIn(['1', '2']) readonly 'group_hp5cn05/Yes'?: string; + @IsOptional() @IsIn(['1', '2']) readonly 'group_hp5cn05/TreatOccur'?: string; +} diff --git a/packages/interfaces/src/kobo/PatchFloodFormDto.ts b/packages/interfaces/src/kobo/PatchFloodFormDto.ts index 8868a9b9..d1b1a06c 100644 --- a/packages/interfaces/src/kobo/PatchFloodFormDto.ts +++ b/packages/interfaces/src/kobo/PatchFloodFormDto.ts @@ -1,25 +1,149 @@ -import { OmitType, PartialType } from '@nestjs/mapped-types'; +import { + IsDateString, + IsIn, + IsNumberString, + IsOptional, + IsString, + Length, + Matches, +} from 'class-validator'; -import { FloodDto } from './FloodDto'; - -export class PatchFloodFormDto extends PartialType( - OmitType(FloodDto, [ - '_id', - 'formhub/uuid', - 'start', - 'end', - '__version__', - 'meta/instanceID', - 'meta/deprecatedID', - '_xform_id_string', - '_uuid', - '_attachments', - '_status', - '_geolocation', - '_submission_time', - '_tags', - '_notes', - '_validation_status', - '_submitted_by', - ] as const), -) {} +export class PatchFloodFormDto { + @IsOptional() @IsString() readonly 'g1/q_Enum'!: string; + @IsOptional() @IsString() readonly 'g1/q_Funtion'!: string; + @IsOptional() @IsString() readonly 'g1/q_Phone'!: string; + @IsOptional() @IsDateString() readonly 'g1/Date_report'!: string; + @IsOptional() @IsString() @Length(2) readonly 'g2/Province'!: string; + @IsOptional() @IsString() @Length(4) readonly 'g2/District'!: string; + @IsOptional() @IsString() @Length(6) readonly 'g2/Commune'!: string; + @IsOptional() @IsDateString() readonly 'g2/Date_Dis'!: string; + @IsOptional() @IsNumberString() readonly 'g2/DisTyp'!: string; + @IsOptional() @IsNumberString() readonly 'g2/flood_n'?: string; + @IsOptional() @IsNumberString() readonly 'g3/g3_1/NumVillAff'?: string; + @IsOptional() @IsNumberString() readonly 'g3/g3_1/g3_2/NumFamAff'?: string; + @IsOptional() @IsNumberString() readonly 'g3/g3_1/g3_2/NumPeoAff'?: string; + @IsOptional() @IsNumberString() readonly 'g3/g3_1/g3_2/NumFeAff'?: string; + @IsOptional() @IsNumberString() readonly 'g3/g4/TNumDeath'?: string; + @IsOptional() @IsNumberString() readonly 'g3/g4/NumMeDeath'?: string; + @IsOptional() @IsNumberString() readonly 'g3/g4/NumFeDeath'?: string; + @IsOptional() @IsNumberString() readonly 'g3/g4/NumKidDeath'?: string; + @IsOptional() @IsNumberString() readonly 'g3/g4/NumOldDeath'?: string; + @IsOptional() @IsNumberString() readonly 'g3/g4/NumDisDeath'?: string; + @IsOptional() @IsNumberString() readonly 'g3/g5/NumTMising'?: string; + @IsOptional() @IsNumberString() readonly 'g3/g5/NumMeMising'?: string; + @IsOptional() @IsNumberString() readonly 'g3/g5/NumFeMising'?: string; + @IsOptional() @IsNumberString() readonly 'g3/g5/NumKidMising'?: string; + @IsOptional() @IsNumberString() readonly 'g3/g5/NumOldMising'?: string; + @IsOptional() @IsNumberString() readonly 'g3/g5/NumDisMising'?: string; + @IsOptional() @IsNumberString() readonly 'g3/g6/NumTInjure'?: string; + @IsOptional() @IsNumberString() readonly 'g3/g6/NumMeInjure'?: string; + @IsOptional() @IsNumberString() readonly 'g3/g6/NumFeInjure'?: string; + @IsOptional() @IsNumberString() readonly 'g3/g6/NumKidInjure'?: string; + @IsOptional() @IsNumberString() readonly 'g3/g6/NumOldInjure'?: string; + @IsOptional() @IsNumberString() readonly 'g3/g6/NumDisInjure'?: string; + @IsOptional() @IsNumberString() readonly 'g3/g7/NumFamEva'?: string; + @IsOptional() @IsNumberString() readonly 'g3/g7/NumPeoEva'?: string; + @IsOptional() @IsNumberString() readonly 'g3/g7/NumMeEva'?: string; + @IsOptional() @IsNumberString() readonly 'g3/g7/NumFeEva'?: string; + @IsOptional() @IsNumberString() readonly 'g3/g7/NumKidEva'?: string; + @IsOptional() @IsNumberString() readonly 'g3/g7/NumOldEva'?: string; + @IsOptional() @IsNumberString() readonly 'g3/g7/NumDisEva'?: string; + @IsOptional() @IsNumberString() readonly 'g3/g8/NumFamRe'?: string; + @IsOptional() @IsNumberString() readonly 'g3/g8/NumPeoRe'?: string; + @IsOptional() @IsNumberString() readonly 'g3/g8/NumMeRe'?: string; + @IsOptional() @IsNumberString() readonly 'g3/g8/NumFeRe'?: string; + @IsOptional() @IsNumberString() readonly 'g3/g8/NumKidRe'?: string; + @IsOptional() @IsNumberString() readonly 'g3/g8/NumOldRe'?: string; + @IsOptional() @IsNumberString() readonly 'g3/g8/NumDisRe'?: string; + @IsOptional() @IsNumberString() readonly 'g3/g9/NumSafePla'?: string; + @IsOptional() @IsNumberString() readonly 'g3/g9/NumPeoSEC'?: string; + @IsOptional() @IsNumberString() readonly 'g10/g10_1/NumHouAff'?: string; + @IsOptional() @IsNumberString() readonly 'g10/g10_1/NumHouDam'?: string; + @IsOptional() @IsNumberString() readonly 'g10/g10_2/NumSchoAff'?: string; + @IsOptional() @IsNumberString() readonly 'g10/g10_2/NumSchoDam'?: string; + @IsOptional() @IsNumberString() readonly 'g10/g10_3/NumAffHeal'?: string; + @IsOptional() @IsNumberString() readonly 'g10/g10_3/NumDamHeal'?: string; + @IsOptional() @IsNumberString() readonly 'g10/g10_4/NumPagoAff'?: string; + @IsOptional() @IsNumberString() readonly 'g10/g10_4/NumPagoDam'?: string; + @IsOptional() @IsNumberString() readonly 'g10/g10_5/NumBuilAff'?: string; + @IsOptional() @IsNumberString() readonly 'g10/g10_5/NumBuilDam'?: string; + @IsOptional() @IsNumberString() readonly 'g10/g10_6/NumShopAff'?: string; + @IsOptional() @IsNumberString() readonly 'g10/g10_6/NumShopDam'?: string; + @IsOptional() @IsNumberString() readonly 'g10/g10_7/NumWareHAff'?: string; + @IsOptional() @IsNumberString() readonly 'g10/g10_7/NumWareHDam'?: string; + @IsOptional() @IsNumberString() readonly 'g10/g10_8/NumCraftAff'?: string; + @IsOptional() @IsNumberString() readonly 'g10/g10_8/NumCraftDam'?: string; + @IsOptional() @IsNumberString() readonly 'g11/g11_1/FarmAff'?: string; + @IsOptional() @IsNumberString() readonly 'g11/g11_1/FarmDam'?: string; + @IsOptional() @IsNumberString() readonly 'g11/g11_2/SamNabAff'?: string; + @IsOptional() @IsNumberString() readonly 'g11/g11_2/SamNabDam'?: string; + @IsOptional() @IsNumberString() readonly 'g11/g11_3/PaddyAff'?: string; + @IsOptional() @IsNumberString() readonly 'g11/g11_3/PaddyDam'?: string; + @IsOptional() @IsNumberString() readonly 'g11/g11_4/CowEva'?: string; + @IsOptional() @IsNumberString() readonly 'g11/g11_4/CowDeath'?: string; + @IsOptional() @IsNumberString() readonly 'g11/g11_4/CowMissing'?: string; + @IsOptional() @IsNumberString() readonly 'g11/g11_5/PigEva'?: string; + @IsOptional() @IsNumberString() readonly 'g11/g11_5/PigDeath'?: string; + @IsOptional() @IsNumberString() readonly 'g11/g11_5/PigMissing'?: string; + @IsOptional() @IsNumberString() readonly 'g11/g11_6/BirdEva'?: string; + @IsOptional() @IsNumberString() readonly 'g11/g11_6/BirdDeath'?: string; + @IsOptional() @IsNumberString() readonly 'g11/g11_6/BirdMissing'?: string; + @IsOptional() @IsNumberString() readonly 'g12/g12_1/RubberRoAff'?: string; + @IsOptional() @IsNumberString() readonly 'g12/g12_1/RubberRoDam'?: string; + @IsOptional() @IsNumberString() readonly 'g12/g12_2/ConcretAff'?: string; + @IsOptional() @IsNumberString() readonly 'g12/g12_2/ConcretDam'?: string; + @IsOptional() @IsNumberString() readonly 'g12/g12_3/RuralRoAff'?: string; + @IsOptional() @IsNumberString() readonly 'g12/g12_3/RuralRoDam'?: string; + @IsOptional() @IsNumberString() readonly 'g12/g12_4/BridgeAff'?: string; + @IsOptional() @IsNumberString() readonly 'g12/g12_4/BridgeDam'?: string; + @IsOptional() @IsNumberString() readonly 'g12/g12_5/BeleBridAff'?: string; + @IsOptional() @IsNumberString() readonly 'g12/g12_5/BeleBridDam'?: string; + @IsOptional() @IsNumberString() readonly 'g12/g12_6/DrainageAff'?: string; + @IsOptional() @IsNumberString() readonly 'g12/g12_6/DrainageDam'?: string; + @IsOptional() @IsNumberString() readonly 'g13/g13_1/DamAff'?: string; + @IsOptional() @IsNumberString() readonly 'g13/g13_1/DamDamaged'?: string; + @IsOptional() @IsNumberString() readonly 'g13/g13_2/WatGateAff'?: string; + @IsOptional() @IsNumberString() readonly 'g13/g13_2/WatGateDam'?: string; + @IsOptional() @IsNumberString() readonly 'g13/g13_3/PlumWelAff'?: string; + @IsOptional() @IsNumberString() readonly 'g13/g13_3/PlumWelDam'?: string; + @IsOptional() @IsNumberString() readonly 'g13/g13_4/DigWellAff'?: string; + @IsOptional() @IsNumberString() readonly 'g13/g13_4/DigWellDam'?: string; + @IsOptional() @IsNumberString() readonly 'g13/g13_5/PondAff'?: string; + @IsOptional() @IsNumberString() readonly 'g13/g13_5/PondDam'?: string; + @IsOptional() @IsNumberString() readonly 'g13/g13_6/LatrineAff'?: string; + @IsOptional() @IsNumberString() readonly 'g13/g13_6/LatrineDam'?: string; + @IsOptional() @IsNumberString() readonly 'g13/g13_7/RiverBreak'?: string; + @IsOptional() @IsNumberString() readonly 'g13/g13_7/RiverBreakLo'?: string; + @IsOptional() @IsNumberString() readonly 'g13/BrolayAff'?: string; + @IsOptional() @IsNumberString() readonly 'g13/BrolayDam'?: string; + @IsOptional() @IsNumberString() readonly 'g14/g14_1/NumFamTent'?: string; + @IsOptional() @IsNumberString() readonly 'g14/g14_1/NumPeoTent'?: string; + @IsOptional() @IsNumberString() readonly 'g14/g14_2/NumFamBuil'?: string; + @IsOptional() @IsNumberString() readonly 'g14/g14_2/NumPeoBuil'?: string; + @IsOptional() @IsNumberString() readonly 'g14/g14_3/NumFamRela'?: string; + @IsOptional() @IsNumberString() readonly 'g14/g14_3/NumPeoRela'?: string; + @IsOptional() @IsNumberString() readonly 'g15/g15_1/NumTemSch'?: string; + @IsOptional() @IsNumberString() readonly 'g15/g15_1/StuAcTemSch'?: string; + @IsOptional() @IsNumberString() readonly 'g15/g15_2/SchUseSafe'?: string; + @IsOptional() @IsNumberString() readonly 'g15/g15_2/NumStu'?: string; + @IsOptional() @IsNumberString() readonly 'g15/g15_3/NumSchStop'?: string; + @IsOptional() @IsNumberString() readonly 'g15/g15_3/NumStuNoCla'?: string; + @IsOptional() @IsNumberString() readonly 'g16_1/g16_1_001/NumFamNoWa'?: string; + @IsOptional() @IsNumberString() readonly 'g16_1/g16_1_001/NumPeoNoWa'?: string; + @IsOptional() @IsNumberString() readonly 'g16_1/g16_1_001/TimeAceWa'?: string; + @IsOptional() @IsNumberString() readonly 'g16_1/g16_1_001/NuFamNoWaEq'?: string; + @IsOptional() @IsNumberString() readonly 'g16_1/g16_1_001/NuFamNoLat'?: string; + @IsOptional() @IsNumberString() readonly 'g17/g17_1/NonActingH'?: string; + @IsOptional() @IsNumberString() readonly 'g17/g17_1/PeoCanAceH'?: string; + @IsOptional() @IsNumberString() readonly 'g17/g17_1/NumDoctor'?: string; + @IsOptional() @IsNumberString() readonly 'g17/g17_1/NumNurse'?: string; + @IsOptional() @IsNumberString() readonly 'g17/g17_1/NumStaff'?: string; + @IsOptional() @IsNumberString() readonly 'g18/g18_1/NumFamNoFod'?: string; + @IsOptional() @IsNumberString() readonly 'g18/g18_1/NumPeoNoFod'?: string; + @IsOptional() @IsNumberString() readonly 'g18/FamNoFod7d'?: string; + @IsOptional() @IsNumberString() readonly 'g18/g18_2/NumActShop'?: string; + @IsOptional() @IsNumberString() readonly 'g18/g18_2/NumNoActShop'?: string; + @IsOptional() @IsIn(['1', '2']) readonly 'g18/RicePrice'?: string; + @IsOptional() @Matches(/^[0-9 ]+$/) readonly 'g19/threat'?: string; + @IsOptional() @IsString() readonly 'g19/other'?: string; +} diff --git a/packages/interfaces/src/kobo/PatchIncidentFormDto.ts b/packages/interfaces/src/kobo/PatchIncidentFormDto.ts index 619ae750..07b74098 100644 --- a/packages/interfaces/src/kobo/PatchIncidentFormDto.ts +++ b/packages/interfaces/src/kobo/PatchIncidentFormDto.ts @@ -1,25 +1,83 @@ -import { OmitType, PartialType } from '@nestjs/mapped-types'; +import { IsDateString, IsNumberString, IsOptional, IsString, Length } from 'class-validator'; -import { IncidentDto } from './IncidentDto'; - -export class PatchIncidentFormDto extends PartialType( - OmitType(IncidentDto, [ - '_id', - 'formhub/uuid', - 'start', - 'end', - '__version__', - 'meta/instanceID', - 'meta/deprecatedID', - '_xform_id_string', - '_uuid', - '_attachments', - '_status', - '_geolocation', - '_submission_time', - '_tags', - '_notes', - '_validation_status', - '_submitted_by', - ] as const), -) {} +export class PatchIncidentFormDto { + @IsOptional() @IsString() readonly 'G1/q_Enum'!: string; + @IsOptional() @IsString() readonly 'G1/q_Funtion'!: string; + @IsOptional() @IsString() readonly 'G1/q_Phone'!: string; + @IsOptional() @IsDateString() readonly 'G1/Date_report'!: string; + @IsOptional() @IsDateString() readonly 'G2/Date_Dis'!: string; + @IsOptional() @IsNumberString() readonly 'G2/DisTyp'!: string; + @IsOptional() @IsString() readonly 'G2/Specify'?: string; + @IsOptional() @IsString() @Length(2) readonly 'G2/Province'!: string; + @IsOptional() @IsString() @Length(4) readonly 'G2/District'!: string; + @IsOptional() @IsString() @Length(6) readonly 'G2/Commune'!: string; + @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_pf1pd97/NumVillAff'?: string; + @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_pf1pd97/NumFamAff'?: string; + @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_pf1pd97/NumPeoAff'?: string; + @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_pf1pd97/NumFeAff'?: string; + @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_bz3jq33/NumDeathTo'?: string; + @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_bz3jq33/NumMeDeath'?: string; + @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_bz3jq33/NumFeDeath'?: string; + @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_bz3jq33/NumKidDeath'?: string; + @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_bz3jq33/NumOldDeath'?: string; + @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_bz3jq33/NumDisDeath'?: string; + @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_th37h10/ToNumMising'?: string; + @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_th37h10/NumMeMising'?: string; + @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_th37h10/NumFeMising'?: string; + @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_th37h10/NumKidMising'?: string; + @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_th37h10/NumOldMising'?: string; + @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_th37h10/NumDisMising'?: string; + @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_sa7hz27/ToNumInjure'?: string; + @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_sa7hz27/NumMeInjure'?: string; + @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_sa7hz27/NumFeInjure'?: string; + @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_sa7hz27/NumKidInjure'?: string; + @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_sa7hz27/NumOldInjure'?: string; + @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_sa7hz27/NumDisInjure'?: string; + @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_sg8yl06/NumFamEva'?: string; + @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_sg8yl06/NumPeoEva'?: string; + @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_sg8yl06/NumMeEva'?: string; + @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_sg8yl06/NumFeEva'?: string; + @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_sg8yl06/NumKidEva'?: string; + @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_sg8yl06/NumOldEva'?: string; + @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_sg8yl06/NumDisEva'?: string; + @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_mq8uz76/NumFamRe'?: string; + @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_mq8uz76/NumPeoRe'?: string; + @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_mq8uz76/NumMeRe'?: string; + @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_mq8uz76/NumFeRe'?: string; + @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_mq8uz76/NumKidRe'?: string; + @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_mq8uz76/NumOldRe'?: string; + @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_mq8uz76/NumDisRe'?: string; + @IsOptional() @IsNumberString() readonly 'group_fh3jp70/group_cn0sw74/PartlyBurn'?: string; + @IsOptional() @IsNumberString() readonly 'group_fh3jp70/group_cn0sw74/CompletBurn'?: string; + @IsOptional() @IsNumberString() readonly 'group_fh3jp70/group_ez5mr58/SchAff'?: string; + @IsOptional() @IsNumberString() readonly 'group_fh3jp70/group_ez5mr58/SchDam'?: string; + @IsOptional() @IsNumberString() readonly 'group_fh3jp70/group_bj6tu99/HealthAff'?: string; + @IsOptional() @IsNumberString() readonly 'group_fh3jp70/group_bj6tu99/HealthDam'?: string; + @IsOptional() @IsNumberString() readonly 'group_fh3jp70/group_pv8hz72/RivBreakLo'?: string; + @IsOptional() @IsNumberString() readonly 'group_fh3jp70/group_pv8hz72/RivBreakWid'?: string; + @IsOptional() @IsNumberString() readonly 'group_fh3jp70/group_pv8hz72/NationalRod'?: string; + @IsOptional() @IsNumberString() readonly 'group_fh3jp70/group_pv8hz72/RuralRoad'?: string; + @IsOptional() @IsNumberString() readonly 'group_fh3jp70/group_pv8hz72/Bridge'?: string; + @IsOptional() @IsNumberString() readonly 'group_pk03i04/group_wa9cj38/PagoAff'?: string; + @IsOptional() @IsNumberString() readonly 'group_pk03i04/group_wa9cj38/PagoDam'?: string; + @IsOptional() @IsNumberString() readonly 'group_pk03i04/group_fg5ko43/BuildingAff'?: string; + @IsOptional() @IsNumberString() readonly 'group_pk03i04/group_fg5ko43/BuildingDam'?: string; + @IsOptional() @IsNumberString() readonly 'group_pk03i04/group_hi74i16/MarketAff'?: string; + @IsOptional() @IsNumberString() readonly 'group_pk03i04/group_hi74i16/MarketDam'?: string; + @IsOptional() @IsNumberString() readonly 'group_pk03i04/group_lf9ou90/StorageAff'?: string; + @IsOptional() @IsNumberString() readonly 'group_pk03i04/group_lf9ou90/StorageDam'?: string; + @IsOptional() @IsNumberString() readonly 'group_pk03i04/group_ub2hp14/CraftAff'?: string; + @IsOptional() @IsNumberString() readonly 'group_pk03i04/group_ub2hp14/CraftDam'?: string; + @IsOptional() @IsNumberString() readonly 'group_gh6ag70/group_na4yi04/CropAff'?: string; + @IsOptional() @IsNumberString() readonly 'group_gh6ag70/group_na4yi04/CropDam'?: string; + @IsOptional() @IsNumberString() readonly 'group_gh6ag70/group_yh83p68/SamnabAff'?: string; + @IsOptional() @IsNumberString() readonly 'group_gh6ag70/group_yh83p68/SamnabDam'?: string; + @IsOptional() @IsNumberString() readonly 'group_gh6ag70/group_en38q31/PaddyAff'?: string; + @IsOptional() @IsNumberString() readonly 'group_gh6ag70/group_en38q31/PaddyDam'?: string; + @IsOptional() @IsNumberString() readonly 'group_gh6ag70/group_wb0mf29/CowDeath'?: string; + @IsOptional() @IsNumberString() readonly 'group_gh6ag70/group_wb0mf29/BaffoDeath'?: string; + @IsOptional() @IsNumberString() readonly 'group_gh6ag70/group_wb0mf29/PigDeath'?: string; + @IsOptional() @IsNumberString() readonly 'group_gh6ag70/group_wb0mf29/ChickDeath'?: string; + @IsOptional() @IsNumberString() readonly 'group_gh6ag70/group_gu1xp89/NumJungleAf'?: string; + @IsOptional() @IsNumberString() readonly 'group_gh6ag70/group_gu1xp89/FarmAf'?: string; +} From eb228297d17e8e0b1da8e2002234cd22ea29e473 Mon Sep 17 00:00:00 2001 From: ericboucher Date: Sat, 21 Sep 2024 00:01:29 +0200 Subject: [PATCH 07/14] Use typescript approach to simplify patchformdtos --- .../src/kobo/PatchDroughtFormDto.ts | 116 +++--------- .../interfaces/src/kobo/PatchFloodFormDto.ts | 171 +++--------------- .../src/kobo/PatchIncidentFormDto.ts | 105 +++-------- 3 files changed, 69 insertions(+), 323 deletions(-) diff --git a/packages/interfaces/src/kobo/PatchDroughtFormDto.ts b/packages/interfaces/src/kobo/PatchDroughtFormDto.ts index 460f1dd8..8fd33610 100644 --- a/packages/interfaces/src/kobo/PatchDroughtFormDto.ts +++ b/packages/interfaces/src/kobo/PatchDroughtFormDto.ts @@ -1,94 +1,24 @@ -import { IsDateString, IsIn, IsNumberString, IsOptional, IsString, Length } from 'class-validator'; +import { DroughtDto } from './DroughtDto'; -export class PatchDroughtFormDto { - @IsOptional() @IsString() readonly 'group_ve4vz14/q_Enum'!: string; - @IsOptional() @IsDateString() readonly 'group_ve4vz14/Date_report'!: string; - @IsOptional() @IsString() readonly 'group_ve4vz14/q_Funtion'!: string; - @IsOptional() @IsString() readonly 'group_ve4vz14/q_Phone'!: string; - @IsOptional() @IsString() @Length(2) readonly 'group_yu9nq00/Province'!: string; - @IsOptional() @IsString() @Length(4) readonly 'group_yu9nq00/District'!: string; - @IsOptional() @IsString() @Length(6) readonly 'group_yu9nq00/Commune'!: string; - @IsOptional() @IsDateString() readonly 'group_yu9nq00/Date_Dis': string; - @IsOptional() @IsNumberString() readonly 'group_yu9nq00/DisTyp'!: string; - @IsOptional() @IsNumberString() readonly 'group_dg01m69/NumVillAff'?: string; - @IsOptional() @IsNumberString() readonly 'group_dg01m69/group_kx2wb92/NumFamAff'?: string; - @IsOptional() @IsNumberString() readonly 'group_dg01m69/group_kx2wb92/NumPeoAff'?: string; - @IsOptional() @IsNumberString() readonly 'group_dg01m69/group_kx2wb92/NumMe'?: string; - @IsOptional() @IsNumberString() readonly 'group_dg01m69/group_kx2wb92/NumFe'?: string; - @IsOptional() @IsNumberString() readonly 'group_dg01m69/group_kx2wb92/NumKid'?: string; - @IsOptional() @IsNumberString() readonly 'group_dg01m69/group_kx2wb92/NumOld'?: string; - @IsOptional() @IsNumberString() readonly 'group_dg01m69/group_kx2wb92/NumDisMising'?: string; - @IsOptional() @IsNumberString() readonly 'group_dg01m69/group_nk3zh15/TNumDeath'?: string; - @IsOptional() @IsNumberString() readonly 'group_dg01m69/group_nk3zh15/NumMeDeath'?: string; - @IsOptional() @IsNumberString() readonly 'group_dg01m69/group_nk3zh15/NumFeDeath'?: string; - @IsOptional() @IsNumberString() readonly 'group_dg01m69/group_nk3zh15/NumKidDeath'?: string; - @IsOptional() @IsNumberString() readonly 'group_dg01m69/group_nk3zh15/NumOldDeath'?: string; - @IsOptional() @IsNumberString() readonly 'group_dg01m69/group_nk3zh15/NumDisDeath'?: string; - @IsOptional() @IsNumberString() readonly 'group_yn34m57/group_rg2xt75/FamAgriAff'?: string; - @IsOptional() @IsNumberString() readonly 'group_yn34m57/group_rg2xt75/FarmAff'?: string; - @IsOptional() @IsNumberString() readonly 'group_yn34m57/group_rg2xt75/FarmDam'?: string; - @IsOptional() @IsNumberString() readonly 'group_yn34m57/group_rg2xt75/SamNabAff'?: string; - @IsOptional() @IsNumberString() readonly 'group_yn34m57/group_rg2xt75/SamNabDam'?: string; - @IsOptional() @IsNumberString() readonly 'group_yn34m57/group_rg2xt75/PaddyAff'?: string; - @IsOptional() @IsNumberString() readonly 'group_yn34m57/group_rg2xt75/PaddyDam'?: string; - @IsOptional() @IsNumberString() readonly 'group_yn34m57/group_pl5gf73/CowDeath'?: string; - @IsOptional() @IsNumberString() readonly 'group_yn34m57/group_pl5gf73/BaffoDeath'?: string; - @IsOptional() @IsNumberString() readonly 'group_yn34m57/group_pl5gf73/PigDeath'?: string; - @IsOptional() @IsNumberString() readonly 'group_yn34m57/group_pl5gf73/BirdDeath'?: string; - @IsOptional() @IsNumberString() readonly 'group_em29q27/group_oh4fa74/NumSchNoHo2'?: string; - @IsOptional() @IsNumberString() readonly 'group_em29q27/group_oh4fa74/BotSourTang'?: string; - @IsOptional() @IsNumberString() readonly 'group_em29q27/group_oh4fa74/HSourNoTang'?: string; - @IsOptional() @IsNumberString() readonly 'group_em29q27/group_oh4fa74/NoSourHtang'?: string; - @IsOptional() @IsNumberString() readonly 'group_em29q27/group_oh4fa74/NoBtSourTan'?: string; - @IsOptional() @IsIn(['1', '2']) readonly 'group_em29q27/group_oh4fa74/Electric'?: string; - @IsOptional() @IsNumberString() readonly 'group_em29q27/group_mv5vw26/HealCenNoHo2'?: string; - @IsOptional() @IsNumberString() readonly 'group_em29q27/group_mv5vw26/HBotSourTang'?: string; - @IsOptional() @IsNumberString() readonly 'group_em29q27/group_mv5vw26/HaSouNoTang'?: string; - @IsOptional() @IsNumberString() readonly 'group_em29q27/group_mv5vw26/NoSourHatan'?: string; - @IsOptional() @IsNumberString() readonly 'group_em29q27/group_mv5vw26/NoBtSouTan'?: string; - @IsOptional() @IsIn(['1', '2']) readonly 'group_em29q27/group_mv5vw26/ElecForHeal'?: string; - @IsOptional() @IsNumberString() readonly 'group_pa74w20/group_qu0fl63/DamHavWater'?: string; - @IsOptional() @IsNumberString() readonly 'group_pa74w20/group_qu0fl63/DamNoWater'?: string; - @IsOptional() @IsNumberString() readonly 'group_pa74w20/group_om0vk80/PondHavWat'?: string; - @IsOptional() @IsNumberString() readonly 'group_pa74w20/group_om0vk80/PondNoWate'?: string; - @IsOptional() @IsNumberString() readonly 'group_pa74w20/group_uv6lk64/PlumWelHaWat'?: string; - @IsOptional() @IsNumberString() readonly 'group_pa74w20/group_uv6lk64/PluWelNoWat'?: string; - @IsOptional() @IsNumberString() readonly 'group_pa74w20/group_nr51r72/DigWelHaWat'?: string; - @IsOptional() @IsNumberString() readonly 'group_pa74w20/group_nr51r72/DigWelNoWat'?: string; - @IsOptional() @IsNumberString() readonly 'group_gn6qw58/group_sx5lq59/NuVilNedHep'?: string; - @IsOptional() @IsNumberString() readonly 'group_gn6qw58/group_sx5lq59/TNuFamNeHo2'?: string; - @IsOptional() @IsNumberString() readonly 'group_gn6qw58/group_sx5lq59/NumPeople'?: string; - @IsOptional() @IsNumberString() readonly 'group_gn6qw58/group_sx5lq59/NumMen'?: string; - @IsOptional() @IsNumberString() readonly 'group_gn6qw58/group_sx5lq59/NumWomen'?: string; - @IsOptional() @IsNumberString() readonly 'group_gn6qw58/group_sx5lq59/NumKids'?: string; - @IsOptional() @IsNumberString() readonly 'group_gn6qw58/group_sx5lq59/NumElder'?: string; - @IsOptional() @IsNumberString() readonly 'group_gn6qw58/group_sx5lq59/NumDis'?: string; - @IsOptional() @IsNumberString() readonly 'group_gn6qw58/group_ot4yf02/NumWatTank'?: string; - @IsOptional() @IsNumberString() readonly 'group_gn6qw58/group_ot4yf02/NuStorageFam'?: string; - @IsOptional() @IsNumberString() readonly 'group_gn6qw58/group_ot4yf02/NumWateTank'?: string; - @IsOptional() @IsNumberString() readonly 'group_gn6qw58/group_ot4yf02/NumFilter'?: string; - @IsOptional() @IsNumberString() readonly 'group_gn6qw58/group_ot4yf02/NumWatePur'?: string; - @IsOptional() @IsNumberString() readonly 'group_lm0eq74/group_ei7de96/NumWatStor'?: string; - @IsOptional() @IsNumberString() readonly 'group_lm0eq74/group_ei7de96/WatSorRepar'?: string; - @IsOptional() @IsNumberString() readonly 'group_lm0eq74/group_ei7de96/WatStoRepar'?: string; - @IsOptional() @IsNumberString() readonly 'group_lm0eq74/group_ei7de96/SolarNeed'?: string; - @IsOptional() @IsNumberString() readonly 'group_lm0eq74/group_ei7de96/FanNeed'?: string; - @IsOptional() @IsNumberString() readonly 'group_lm0eq74/group_ni05u89/WatStorNed'?: string; - @IsOptional() @IsNumberString() readonly 'group_lm0eq74/group_ni05u89/WatSorRep'?: string; - @IsOptional() @IsNumberString() readonly 'group_lm0eq74/group_ni05u89/WatStoRep'?: string; - @IsOptional() @IsNumberString() readonly 'group_lm0eq74/group_ni05u89/NuSolarNeed'?: string; - @IsOptional() @IsNumberString() readonly 'group_lm0eq74/group_ni05u89/NumFanNeed'?: string; - @IsOptional() @IsNumberString() readonly 'group_lt1ab13/LandSize'?: string; - @IsOptional() @IsNumberString() readonly 'group_lt1ab13/PumMachine'?: string; - @IsOptional() @IsNumberString() readonly 'group_lt1ab13/NumGasoline'?: string; - @IsOptional() @IsNumberString() readonly 'group_lt1ab13/NumFam'?: string; - @IsOptional() @IsNumberString() readonly 'group_wi2jc00/FamNoIncom'?: string; - @IsOptional() @IsNumberString() readonly 'group_wi2jc00/PeoNoIncom'?: string; - @IsOptional() @IsNumberString() readonly 'group_wi2jc00/FamNoFod'?: string; - @IsOptional() @IsNumberString() readonly 'group_wi2jc00/PeoNoFod'?: string; - @IsOptional() @IsIn(['1', '2']) readonly 'group_hp5cn05/NuKidColWat'?: string; - @IsOptional() @IsIn(['1', '2']) readonly 'group_hp5cn05/IfYes'?: string; - @IsOptional() @IsIn(['1', '2']) readonly 'group_hp5cn05/NuWoCollWat'?: string; - @IsOptional() @IsIn(['1', '2']) readonly 'group_hp5cn05/Yes'?: string; - @IsOptional() @IsIn(['1', '2']) readonly 'group_hp5cn05/TreatOccur'?: string; -} +export type PatchDroughtFormDto = Partial< + Omit< + DroughtDto, + | '_id' + | 'formhub/uuid' + | 'start' + | 'end' + | '__version__' + | 'meta/instanceID' + | 'meta/deprecatedID' + | '_xform_id_string' + | '_uuid' + | '_attachments' + | '_status' + | '_geolocation' + | '_submission_time' + | '_tags' + | '_notes' + | '_validation_status' + | '_submitted_by' + > +>; diff --git a/packages/interfaces/src/kobo/PatchFloodFormDto.ts b/packages/interfaces/src/kobo/PatchFloodFormDto.ts index d1b1a06c..afb39f26 100644 --- a/packages/interfaces/src/kobo/PatchFloodFormDto.ts +++ b/packages/interfaces/src/kobo/PatchFloodFormDto.ts @@ -1,149 +1,24 @@ -import { - IsDateString, - IsIn, - IsNumberString, - IsOptional, - IsString, - Length, - Matches, -} from 'class-validator'; +import { FloodDto } from './FloodDto'; -export class PatchFloodFormDto { - @IsOptional() @IsString() readonly 'g1/q_Enum'!: string; - @IsOptional() @IsString() readonly 'g1/q_Funtion'!: string; - @IsOptional() @IsString() readonly 'g1/q_Phone'!: string; - @IsOptional() @IsDateString() readonly 'g1/Date_report'!: string; - @IsOptional() @IsString() @Length(2) readonly 'g2/Province'!: string; - @IsOptional() @IsString() @Length(4) readonly 'g2/District'!: string; - @IsOptional() @IsString() @Length(6) readonly 'g2/Commune'!: string; - @IsOptional() @IsDateString() readonly 'g2/Date_Dis'!: string; - @IsOptional() @IsNumberString() readonly 'g2/DisTyp'!: string; - @IsOptional() @IsNumberString() readonly 'g2/flood_n'?: string; - @IsOptional() @IsNumberString() readonly 'g3/g3_1/NumVillAff'?: string; - @IsOptional() @IsNumberString() readonly 'g3/g3_1/g3_2/NumFamAff'?: string; - @IsOptional() @IsNumberString() readonly 'g3/g3_1/g3_2/NumPeoAff'?: string; - @IsOptional() @IsNumberString() readonly 'g3/g3_1/g3_2/NumFeAff'?: string; - @IsOptional() @IsNumberString() readonly 'g3/g4/TNumDeath'?: string; - @IsOptional() @IsNumberString() readonly 'g3/g4/NumMeDeath'?: string; - @IsOptional() @IsNumberString() readonly 'g3/g4/NumFeDeath'?: string; - @IsOptional() @IsNumberString() readonly 'g3/g4/NumKidDeath'?: string; - @IsOptional() @IsNumberString() readonly 'g3/g4/NumOldDeath'?: string; - @IsOptional() @IsNumberString() readonly 'g3/g4/NumDisDeath'?: string; - @IsOptional() @IsNumberString() readonly 'g3/g5/NumTMising'?: string; - @IsOptional() @IsNumberString() readonly 'g3/g5/NumMeMising'?: string; - @IsOptional() @IsNumberString() readonly 'g3/g5/NumFeMising'?: string; - @IsOptional() @IsNumberString() readonly 'g3/g5/NumKidMising'?: string; - @IsOptional() @IsNumberString() readonly 'g3/g5/NumOldMising'?: string; - @IsOptional() @IsNumberString() readonly 'g3/g5/NumDisMising'?: string; - @IsOptional() @IsNumberString() readonly 'g3/g6/NumTInjure'?: string; - @IsOptional() @IsNumberString() readonly 'g3/g6/NumMeInjure'?: string; - @IsOptional() @IsNumberString() readonly 'g3/g6/NumFeInjure'?: string; - @IsOptional() @IsNumberString() readonly 'g3/g6/NumKidInjure'?: string; - @IsOptional() @IsNumberString() readonly 'g3/g6/NumOldInjure'?: string; - @IsOptional() @IsNumberString() readonly 'g3/g6/NumDisInjure'?: string; - @IsOptional() @IsNumberString() readonly 'g3/g7/NumFamEva'?: string; - @IsOptional() @IsNumberString() readonly 'g3/g7/NumPeoEva'?: string; - @IsOptional() @IsNumberString() readonly 'g3/g7/NumMeEva'?: string; - @IsOptional() @IsNumberString() readonly 'g3/g7/NumFeEva'?: string; - @IsOptional() @IsNumberString() readonly 'g3/g7/NumKidEva'?: string; - @IsOptional() @IsNumberString() readonly 'g3/g7/NumOldEva'?: string; - @IsOptional() @IsNumberString() readonly 'g3/g7/NumDisEva'?: string; - @IsOptional() @IsNumberString() readonly 'g3/g8/NumFamRe'?: string; - @IsOptional() @IsNumberString() readonly 'g3/g8/NumPeoRe'?: string; - @IsOptional() @IsNumberString() readonly 'g3/g8/NumMeRe'?: string; - @IsOptional() @IsNumberString() readonly 'g3/g8/NumFeRe'?: string; - @IsOptional() @IsNumberString() readonly 'g3/g8/NumKidRe'?: string; - @IsOptional() @IsNumberString() readonly 'g3/g8/NumOldRe'?: string; - @IsOptional() @IsNumberString() readonly 'g3/g8/NumDisRe'?: string; - @IsOptional() @IsNumberString() readonly 'g3/g9/NumSafePla'?: string; - @IsOptional() @IsNumberString() readonly 'g3/g9/NumPeoSEC'?: string; - @IsOptional() @IsNumberString() readonly 'g10/g10_1/NumHouAff'?: string; - @IsOptional() @IsNumberString() readonly 'g10/g10_1/NumHouDam'?: string; - @IsOptional() @IsNumberString() readonly 'g10/g10_2/NumSchoAff'?: string; - @IsOptional() @IsNumberString() readonly 'g10/g10_2/NumSchoDam'?: string; - @IsOptional() @IsNumberString() readonly 'g10/g10_3/NumAffHeal'?: string; - @IsOptional() @IsNumberString() readonly 'g10/g10_3/NumDamHeal'?: string; - @IsOptional() @IsNumberString() readonly 'g10/g10_4/NumPagoAff'?: string; - @IsOptional() @IsNumberString() readonly 'g10/g10_4/NumPagoDam'?: string; - @IsOptional() @IsNumberString() readonly 'g10/g10_5/NumBuilAff'?: string; - @IsOptional() @IsNumberString() readonly 'g10/g10_5/NumBuilDam'?: string; - @IsOptional() @IsNumberString() readonly 'g10/g10_6/NumShopAff'?: string; - @IsOptional() @IsNumberString() readonly 'g10/g10_6/NumShopDam'?: string; - @IsOptional() @IsNumberString() readonly 'g10/g10_7/NumWareHAff'?: string; - @IsOptional() @IsNumberString() readonly 'g10/g10_7/NumWareHDam'?: string; - @IsOptional() @IsNumberString() readonly 'g10/g10_8/NumCraftAff'?: string; - @IsOptional() @IsNumberString() readonly 'g10/g10_8/NumCraftDam'?: string; - @IsOptional() @IsNumberString() readonly 'g11/g11_1/FarmAff'?: string; - @IsOptional() @IsNumberString() readonly 'g11/g11_1/FarmDam'?: string; - @IsOptional() @IsNumberString() readonly 'g11/g11_2/SamNabAff'?: string; - @IsOptional() @IsNumberString() readonly 'g11/g11_2/SamNabDam'?: string; - @IsOptional() @IsNumberString() readonly 'g11/g11_3/PaddyAff'?: string; - @IsOptional() @IsNumberString() readonly 'g11/g11_3/PaddyDam'?: string; - @IsOptional() @IsNumberString() readonly 'g11/g11_4/CowEva'?: string; - @IsOptional() @IsNumberString() readonly 'g11/g11_4/CowDeath'?: string; - @IsOptional() @IsNumberString() readonly 'g11/g11_4/CowMissing'?: string; - @IsOptional() @IsNumberString() readonly 'g11/g11_5/PigEva'?: string; - @IsOptional() @IsNumberString() readonly 'g11/g11_5/PigDeath'?: string; - @IsOptional() @IsNumberString() readonly 'g11/g11_5/PigMissing'?: string; - @IsOptional() @IsNumberString() readonly 'g11/g11_6/BirdEva'?: string; - @IsOptional() @IsNumberString() readonly 'g11/g11_6/BirdDeath'?: string; - @IsOptional() @IsNumberString() readonly 'g11/g11_6/BirdMissing'?: string; - @IsOptional() @IsNumberString() readonly 'g12/g12_1/RubberRoAff'?: string; - @IsOptional() @IsNumberString() readonly 'g12/g12_1/RubberRoDam'?: string; - @IsOptional() @IsNumberString() readonly 'g12/g12_2/ConcretAff'?: string; - @IsOptional() @IsNumberString() readonly 'g12/g12_2/ConcretDam'?: string; - @IsOptional() @IsNumberString() readonly 'g12/g12_3/RuralRoAff'?: string; - @IsOptional() @IsNumberString() readonly 'g12/g12_3/RuralRoDam'?: string; - @IsOptional() @IsNumberString() readonly 'g12/g12_4/BridgeAff'?: string; - @IsOptional() @IsNumberString() readonly 'g12/g12_4/BridgeDam'?: string; - @IsOptional() @IsNumberString() readonly 'g12/g12_5/BeleBridAff'?: string; - @IsOptional() @IsNumberString() readonly 'g12/g12_5/BeleBridDam'?: string; - @IsOptional() @IsNumberString() readonly 'g12/g12_6/DrainageAff'?: string; - @IsOptional() @IsNumberString() readonly 'g12/g12_6/DrainageDam'?: string; - @IsOptional() @IsNumberString() readonly 'g13/g13_1/DamAff'?: string; - @IsOptional() @IsNumberString() readonly 'g13/g13_1/DamDamaged'?: string; - @IsOptional() @IsNumberString() readonly 'g13/g13_2/WatGateAff'?: string; - @IsOptional() @IsNumberString() readonly 'g13/g13_2/WatGateDam'?: string; - @IsOptional() @IsNumberString() readonly 'g13/g13_3/PlumWelAff'?: string; - @IsOptional() @IsNumberString() readonly 'g13/g13_3/PlumWelDam'?: string; - @IsOptional() @IsNumberString() readonly 'g13/g13_4/DigWellAff'?: string; - @IsOptional() @IsNumberString() readonly 'g13/g13_4/DigWellDam'?: string; - @IsOptional() @IsNumberString() readonly 'g13/g13_5/PondAff'?: string; - @IsOptional() @IsNumberString() readonly 'g13/g13_5/PondDam'?: string; - @IsOptional() @IsNumberString() readonly 'g13/g13_6/LatrineAff'?: string; - @IsOptional() @IsNumberString() readonly 'g13/g13_6/LatrineDam'?: string; - @IsOptional() @IsNumberString() readonly 'g13/g13_7/RiverBreak'?: string; - @IsOptional() @IsNumberString() readonly 'g13/g13_7/RiverBreakLo'?: string; - @IsOptional() @IsNumberString() readonly 'g13/BrolayAff'?: string; - @IsOptional() @IsNumberString() readonly 'g13/BrolayDam'?: string; - @IsOptional() @IsNumberString() readonly 'g14/g14_1/NumFamTent'?: string; - @IsOptional() @IsNumberString() readonly 'g14/g14_1/NumPeoTent'?: string; - @IsOptional() @IsNumberString() readonly 'g14/g14_2/NumFamBuil'?: string; - @IsOptional() @IsNumberString() readonly 'g14/g14_2/NumPeoBuil'?: string; - @IsOptional() @IsNumberString() readonly 'g14/g14_3/NumFamRela'?: string; - @IsOptional() @IsNumberString() readonly 'g14/g14_3/NumPeoRela'?: string; - @IsOptional() @IsNumberString() readonly 'g15/g15_1/NumTemSch'?: string; - @IsOptional() @IsNumberString() readonly 'g15/g15_1/StuAcTemSch'?: string; - @IsOptional() @IsNumberString() readonly 'g15/g15_2/SchUseSafe'?: string; - @IsOptional() @IsNumberString() readonly 'g15/g15_2/NumStu'?: string; - @IsOptional() @IsNumberString() readonly 'g15/g15_3/NumSchStop'?: string; - @IsOptional() @IsNumberString() readonly 'g15/g15_3/NumStuNoCla'?: string; - @IsOptional() @IsNumberString() readonly 'g16_1/g16_1_001/NumFamNoWa'?: string; - @IsOptional() @IsNumberString() readonly 'g16_1/g16_1_001/NumPeoNoWa'?: string; - @IsOptional() @IsNumberString() readonly 'g16_1/g16_1_001/TimeAceWa'?: string; - @IsOptional() @IsNumberString() readonly 'g16_1/g16_1_001/NuFamNoWaEq'?: string; - @IsOptional() @IsNumberString() readonly 'g16_1/g16_1_001/NuFamNoLat'?: string; - @IsOptional() @IsNumberString() readonly 'g17/g17_1/NonActingH'?: string; - @IsOptional() @IsNumberString() readonly 'g17/g17_1/PeoCanAceH'?: string; - @IsOptional() @IsNumberString() readonly 'g17/g17_1/NumDoctor'?: string; - @IsOptional() @IsNumberString() readonly 'g17/g17_1/NumNurse'?: string; - @IsOptional() @IsNumberString() readonly 'g17/g17_1/NumStaff'?: string; - @IsOptional() @IsNumberString() readonly 'g18/g18_1/NumFamNoFod'?: string; - @IsOptional() @IsNumberString() readonly 'g18/g18_1/NumPeoNoFod'?: string; - @IsOptional() @IsNumberString() readonly 'g18/FamNoFod7d'?: string; - @IsOptional() @IsNumberString() readonly 'g18/g18_2/NumActShop'?: string; - @IsOptional() @IsNumberString() readonly 'g18/g18_2/NumNoActShop'?: string; - @IsOptional() @IsIn(['1', '2']) readonly 'g18/RicePrice'?: string; - @IsOptional() @Matches(/^[0-9 ]+$/) readonly 'g19/threat'?: string; - @IsOptional() @IsString() readonly 'g19/other'?: string; -} +export type PatchFloodFormDto = Partial< + Omit< + FloodDto, + | '_id' + | 'formhub/uuid' + | 'start' + | 'end' + | '__version__' + | 'meta/instanceID' + | 'meta/deprecatedID' + | '_xform_id_string' + | '_uuid' + | '_attachments' + | '_status' + | '_geolocation' + | '_submission_time' + | '_tags' + | '_notes' + | '_validation_status' + | '_submitted_by' + > +>; diff --git a/packages/interfaces/src/kobo/PatchIncidentFormDto.ts b/packages/interfaces/src/kobo/PatchIncidentFormDto.ts index 07b74098..c98f834c 100644 --- a/packages/interfaces/src/kobo/PatchIncidentFormDto.ts +++ b/packages/interfaces/src/kobo/PatchIncidentFormDto.ts @@ -1,83 +1,24 @@ -import { IsDateString, IsNumberString, IsOptional, IsString, Length } from 'class-validator'; +import { IncidentDto } from './IncidentDto'; -export class PatchIncidentFormDto { - @IsOptional() @IsString() readonly 'G1/q_Enum'!: string; - @IsOptional() @IsString() readonly 'G1/q_Funtion'!: string; - @IsOptional() @IsString() readonly 'G1/q_Phone'!: string; - @IsOptional() @IsDateString() readonly 'G1/Date_report'!: string; - @IsOptional() @IsDateString() readonly 'G2/Date_Dis'!: string; - @IsOptional() @IsNumberString() readonly 'G2/DisTyp'!: string; - @IsOptional() @IsString() readonly 'G2/Specify'?: string; - @IsOptional() @IsString() @Length(2) readonly 'G2/Province'!: string; - @IsOptional() @IsString() @Length(4) readonly 'G2/District'!: string; - @IsOptional() @IsString() @Length(6) readonly 'G2/Commune'!: string; - @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_pf1pd97/NumVillAff'?: string; - @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_pf1pd97/NumFamAff'?: string; - @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_pf1pd97/NumPeoAff'?: string; - @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_pf1pd97/NumFeAff'?: string; - @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_bz3jq33/NumDeathTo'?: string; - @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_bz3jq33/NumMeDeath'?: string; - @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_bz3jq33/NumFeDeath'?: string; - @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_bz3jq33/NumKidDeath'?: string; - @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_bz3jq33/NumOldDeath'?: string; - @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_bz3jq33/NumDisDeath'?: string; - @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_th37h10/ToNumMising'?: string; - @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_th37h10/NumMeMising'?: string; - @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_th37h10/NumFeMising'?: string; - @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_th37h10/NumKidMising'?: string; - @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_th37h10/NumOldMising'?: string; - @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_th37h10/NumDisMising'?: string; - @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_sa7hz27/ToNumInjure'?: string; - @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_sa7hz27/NumMeInjure'?: string; - @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_sa7hz27/NumFeInjure'?: string; - @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_sa7hz27/NumKidInjure'?: string; - @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_sa7hz27/NumOldInjure'?: string; - @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_sa7hz27/NumDisInjure'?: string; - @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_sg8yl06/NumFamEva'?: string; - @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_sg8yl06/NumPeoEva'?: string; - @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_sg8yl06/NumMeEva'?: string; - @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_sg8yl06/NumFeEva'?: string; - @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_sg8yl06/NumKidEva'?: string; - @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_sg8yl06/NumOldEva'?: string; - @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_sg8yl06/NumDisEva'?: string; - @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_mq8uz76/NumFamRe'?: string; - @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_mq8uz76/NumPeoRe'?: string; - @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_mq8uz76/NumMeRe'?: string; - @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_mq8uz76/NumFeRe'?: string; - @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_mq8uz76/NumKidRe'?: string; - @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_mq8uz76/NumOldRe'?: string; - @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_mq8uz76/NumDisRe'?: string; - @IsOptional() @IsNumberString() readonly 'group_fh3jp70/group_cn0sw74/PartlyBurn'?: string; - @IsOptional() @IsNumberString() readonly 'group_fh3jp70/group_cn0sw74/CompletBurn'?: string; - @IsOptional() @IsNumberString() readonly 'group_fh3jp70/group_ez5mr58/SchAff'?: string; - @IsOptional() @IsNumberString() readonly 'group_fh3jp70/group_ez5mr58/SchDam'?: string; - @IsOptional() @IsNumberString() readonly 'group_fh3jp70/group_bj6tu99/HealthAff'?: string; - @IsOptional() @IsNumberString() readonly 'group_fh3jp70/group_bj6tu99/HealthDam'?: string; - @IsOptional() @IsNumberString() readonly 'group_fh3jp70/group_pv8hz72/RivBreakLo'?: string; - @IsOptional() @IsNumberString() readonly 'group_fh3jp70/group_pv8hz72/RivBreakWid'?: string; - @IsOptional() @IsNumberString() readonly 'group_fh3jp70/group_pv8hz72/NationalRod'?: string; - @IsOptional() @IsNumberString() readonly 'group_fh3jp70/group_pv8hz72/RuralRoad'?: string; - @IsOptional() @IsNumberString() readonly 'group_fh3jp70/group_pv8hz72/Bridge'?: string; - @IsOptional() @IsNumberString() readonly 'group_pk03i04/group_wa9cj38/PagoAff'?: string; - @IsOptional() @IsNumberString() readonly 'group_pk03i04/group_wa9cj38/PagoDam'?: string; - @IsOptional() @IsNumberString() readonly 'group_pk03i04/group_fg5ko43/BuildingAff'?: string; - @IsOptional() @IsNumberString() readonly 'group_pk03i04/group_fg5ko43/BuildingDam'?: string; - @IsOptional() @IsNumberString() readonly 'group_pk03i04/group_hi74i16/MarketAff'?: string; - @IsOptional() @IsNumberString() readonly 'group_pk03i04/group_hi74i16/MarketDam'?: string; - @IsOptional() @IsNumberString() readonly 'group_pk03i04/group_lf9ou90/StorageAff'?: string; - @IsOptional() @IsNumberString() readonly 'group_pk03i04/group_lf9ou90/StorageDam'?: string; - @IsOptional() @IsNumberString() readonly 'group_pk03i04/group_ub2hp14/CraftAff'?: string; - @IsOptional() @IsNumberString() readonly 'group_pk03i04/group_ub2hp14/CraftDam'?: string; - @IsOptional() @IsNumberString() readonly 'group_gh6ag70/group_na4yi04/CropAff'?: string; - @IsOptional() @IsNumberString() readonly 'group_gh6ag70/group_na4yi04/CropDam'?: string; - @IsOptional() @IsNumberString() readonly 'group_gh6ag70/group_yh83p68/SamnabAff'?: string; - @IsOptional() @IsNumberString() readonly 'group_gh6ag70/group_yh83p68/SamnabDam'?: string; - @IsOptional() @IsNumberString() readonly 'group_gh6ag70/group_en38q31/PaddyAff'?: string; - @IsOptional() @IsNumberString() readonly 'group_gh6ag70/group_en38q31/PaddyDam'?: string; - @IsOptional() @IsNumberString() readonly 'group_gh6ag70/group_wb0mf29/CowDeath'?: string; - @IsOptional() @IsNumberString() readonly 'group_gh6ag70/group_wb0mf29/BaffoDeath'?: string; - @IsOptional() @IsNumberString() readonly 'group_gh6ag70/group_wb0mf29/PigDeath'?: string; - @IsOptional() @IsNumberString() readonly 'group_gh6ag70/group_wb0mf29/ChickDeath'?: string; - @IsOptional() @IsNumberString() readonly 'group_gh6ag70/group_gu1xp89/NumJungleAf'?: string; - @IsOptional() @IsNumberString() readonly 'group_gh6ag70/group_gu1xp89/FarmAf'?: string; -} +export type PatchIncidentFormDto = Partial< + Omit< + IncidentDto, + | '_id' + | 'formhub/uuid' + | 'start' + | 'end' + | '__version__' + | 'meta/instanceID' + | 'meta/deprecatedID' + | '_xform_id_string' + | '_uuid' + | '_attachments' + | '_status' + | '_geolocation' + | '_submission_time' + | '_tags' + | '_notes' + | '_validation_status' + | '_submitted_by' + > +>; From dd702f16efd5d326868a758be2a384fd7b9ce606 Mon Sep 17 00:00:00 2001 From: ericboucher Date: Sun, 22 Sep 2024 17:37:58 +0200 Subject: [PATCH 08/14] Add shipwreck translation --- apps/frontend/translations/en.json | 1 + apps/frontend/translations/km.json | 1 + 2 files changed, 2 insertions(+) diff --git a/apps/frontend/translations/en.json b/apps/frontend/translations/en.json index 53e35cee..0a998c77 100644 --- a/apps/frontend/translations/en.json +++ b/apps/frontend/translations/en.json @@ -96,6 +96,7 @@ "10": "Drowning", "11": "Collapse", "12": "Unexploded Weapon", + "13": "Shipwreck", "99": "Other Incidents", "ALL_INCIDENTS": "All Incidents" }, diff --git a/apps/frontend/translations/km.json b/apps/frontend/translations/km.json index f28a4d73..6d9ffafa 100644 --- a/apps/frontend/translations/km.json +++ b/apps/frontend/translations/km.json @@ -104,6 +104,7 @@ "10": "លង់ទឹក", "11": "បាក់អគារ", "12": "យុទ្ធភណ្ឌមិនទាន់ផ្ទុះ", + "13": "លិចទូក", "99": "ផ្សេងៗ", "100": "ឧប្បត្តិហេតុទាំងអស់។", "ALL_INCIDENTS": "ឧប្បត្តិហេតុទាំងអស់។" From 991f9a9fac8b231f58aea94697340b78d74b3b03 Mon Sep 17 00:00:00 2001 From: ericboucher Date: Sun, 22 Sep 2024 17:54:32 +0200 Subject: [PATCH 09/14] Update README.md --- apps/frontend/README.md | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/apps/frontend/README.md b/apps/frontend/README.md index 75937e8c..50ae2393 100644 --- a/apps/frontend/README.md +++ b/apps/frontend/README.md @@ -6,11 +6,30 @@ ## Documentation -- 🏛️ [Project architecture](./docs/architecture.md) -- 💅 [Design](./docs/design.md) -- 🔒 [Authentication](./docs/authentication.md) -- 🚨 [Linter and Editor Configuration](./docs/linter-editor.md) -- 💃 [Error handling](./docs/error-handling.md) -- ⬆️ [Upgrading Dependencies](./docs/upgrading-dependencies.md) -- ⬆️ [Audit dependencies](./docs/dependency-security-audit.md) -- 🚀 [Deploy](./docs/deploy.md) +- 🏛️ [Project architecture](./docs/architecture.md) +- 💅 [Design](./docs/design.md) +- 🔒 [Authentication](./docs/authentication.md) +- 🚨 [Linter and Editor Configuration](./docs/linter-editor.md) +- 💃 [Error handling](./docs/error-handling.md) +- ⬆️ [Upgrading Dependencies](./docs/upgrading-dependencies.md) +- ⬆️ [Audit dependencies](./docs/dependency-security-audit.md) +- 🚀 [Deploy](./docs/deploy.md) + +## Updating KOBO Tables + +If changes have been made to the KOBO forms, you can follow the step by step below to update the DMP tables and reports. + +1. In `/packages/interfaces`: + +- Add the new fields to the corresponding Dto file. Eg. [FloodDto.ts](../../packages/interfaces/src/kobo/FloodDto.ts) +- Update the mapping file. Eg. [flood.ts](../../packages/interfaces/src/kobo/mapping/flood.ts) + +2. In `frontend`: + +- Add the new fields to the table configuration for the main tables. Eg. `FloodFormValidation/tablesConfig/Agriculture.tsx` +- Add the new fields to the report table configuration if required. Eg. `Report/FloodReport/tablesConfig/ReportFoodNeeds.tsx` +- Add the new fields to the summary table configuration if requried. Eg. `Report/FloodReport/tablesConfig/SummaryReport.tsx` + +3. In `translations` + +- Add the necessary key mapping to both the `en.json` and `km.json` files. From 01bde4e81cd579d2ddb881e77fcffdad11045477 Mon Sep 17 00:00:00 2001 From: ericboucher Date: Sun, 22 Sep 2024 23:40:26 +0200 Subject: [PATCH 10/14] Add village --- apps/frontend/translations/en.json | 3 ++- apps/frontend/utils/aggregate/aggregate.ts | 6 +++++ .../utils/aggregate/generateFloodReport.ts | 3 +++ apps/frontend/utils/aggregate/setAgg.ts | 17 ++++++++++++ apps/frontend/utils/formatFormToRaw.ts | 2 ++ apps/frontend/utils/tableFormatting.tsx | 26 ++++++++++++++++++- packages/interfaces/src/kobo/DroughtDto.ts | 2 ++ packages/interfaces/src/kobo/FloodDto.ts | 1 + packages/interfaces/src/kobo/IncidentDto.ts | 1 + packages/interfaces/src/kobo/mapping/keys.ts | 6 ++++- packages/interfaces/src/kobo/utils.ts | 3 +++ 11 files changed, 67 insertions(+), 3 deletions(-) create mode 100644 apps/frontend/utils/aggregate/setAgg.ts diff --git a/apps/frontend/translations/en.json b/apps/frontend/translations/en.json index 0a998c77..0a02b852 100644 --- a/apps/frontend/translations/en.json +++ b/apps/frontend/translations/en.json @@ -693,7 +693,8 @@ "COMMON": { "column": { "district": "District", - "commune": "Commune" + "commune": "Commune", + "village": "Villages" } } }, diff --git a/apps/frontend/utils/aggregate/aggregate.ts b/apps/frontend/utils/aggregate/aggregate.ts index 0629e12f..eeb5ab19 100644 --- a/apps/frontend/utils/aggregate/aggregate.ts +++ b/apps/frontend/utils/aggregate/aggregate.ts @@ -4,6 +4,7 @@ import { countAgg } from './countAgg'; import { countCategoriesAgg } from './countCategoriesAgg'; import { countMultipleChoicesAgg } from './countMultipleChoicesAgg'; import { firstAgg } from './firstAgg'; +import { getUniqueValuesSet } from './setAgg'; import { sumAgg } from './sumAgg'; interface IProps { @@ -14,6 +15,7 @@ interface IProps { countKeys?: string[]; countCategoriesKeys?: string[]; countMultipleChoicesKeys?: string[]; + setAggKeys?: string[]; } export const aggregate = ({ @@ -24,6 +26,7 @@ export const aggregate = ({ countKeys = [], countCategoriesKeys = [], countMultipleChoicesKeys = [], + setAggKeys = [], }: IProps) => { const groupedData = groupBy(data, groupKey); const aggregatedData = map(groupedData, (array, keyValue) => { @@ -37,6 +40,8 @@ export const aggregate = ({ countMultipleChoicesAgg(key, array), ); + const setAggValues = setAggKeys.map(key => getUniqueValuesSet(key, array)); + return assign( { [groupKey]: keyValue }, ...firstValues, @@ -44,6 +49,7 @@ export const aggregate = ({ ...countValues, ...countCategoriesValues, ...countMultipleChoicesValues, + ...setAggValues, ) as Record; }); diff --git a/apps/frontend/utils/aggregate/generateFloodReport.ts b/apps/frontend/utils/aggregate/generateFloodReport.ts index b969af83..91d6a7b2 100644 --- a/apps/frontend/utils/aggregate/generateFloodReport.ts +++ b/apps/frontend/utils/aggregate/generateFloodReport.ts @@ -19,6 +19,7 @@ const sumKeys = Object.values( const countCategoriesKeys = [FloodSpecific.RicePrice]; const countMultipleChoicesKeys = [FloodSpecific.threat]; +const setAggKeys = [KoboCommonKeys.village]; export const generateFloodCommuneLevelReport = ( data: Record[], @@ -37,6 +38,7 @@ export const generateFloodCommuneLevelReport = ( sumKeys, countCategoriesKeys, countMultipleChoicesKeys, + setAggKeys, }); }; @@ -57,5 +59,6 @@ export const generateFloodProvinceLevelReport = ( countKeys: provinceLevelReportCountKeys, countCategoriesKeys, countMultipleChoicesKeys, + setAggKeys, }); }; diff --git a/apps/frontend/utils/aggregate/setAgg.ts b/apps/frontend/utils/aggregate/setAgg.ts new file mode 100644 index 00000000..9407d93d --- /dev/null +++ b/apps/frontend/utils/aggregate/setAgg.ts @@ -0,0 +1,17 @@ +import { compact, flatten } from 'lodash'; + +/** + * Parses space-separated strings and returns an object with the key and a Set of unique values. + * @param key The key to look for in the group objects + * @param group An array of objects containing the key + * @returns An object with the key and an array of unique values parsed from the space-separated strings + */ +export const getUniqueValuesSet = ( + key: string, + group: Record[], +): { [key: string]: string[] | undefined } => { + const allValues = compact(flatten(group.map(x => x[key]?.split(' ')))); + const uniqueValues = Array.from(new Set(allValues)); + + return { [key]: uniqueValues.length === 0 ? undefined : uniqueValues }; +}; diff --git a/apps/frontend/utils/formatFormToRaw.ts b/apps/frontend/utils/formatFormToRaw.ts index bb6c609e..c504504b 100644 --- a/apps/frontend/utils/formatFormToRaw.ts +++ b/apps/frontend/utils/formatFormToRaw.ts @@ -17,6 +17,8 @@ export const formatFormToRaw = ( province: formValues.region.province[0], district: formValues.region.district[0], commune: formValues.region.commune[0], + // TODO - FIXME: This is just a placeholder for the village field + village: 'test', // TODO - FIXME: This is just a placeholder for the location field location: formValues.region.commune[0], entryName: formValues.interviewer, diff --git a/apps/frontend/utils/tableFormatting.tsx b/apps/frontend/utils/tableFormatting.tsx index 4ffd3f19..05974a7e 100644 --- a/apps/frontend/utils/tableFormatting.tsx +++ b/apps/frontend/utils/tableFormatting.tsx @@ -109,6 +109,16 @@ const getLocationCountColumnSetup = ( ), + // For villages, we need to count the number of villages in the list + ...(field === KoboCommonKeys.village + ? { + renderCell: (params: GridRenderCellParams) => { + const villageList = params.value as string[] | undefined; + + return villageList ? villageList.length : 0; + }, + } + : {}), }); export const getGroupSetup = (groupId: string, disaster: DisasterType) => ({ @@ -123,10 +133,20 @@ const addGroup = ( children: GridColumnNode[], groupParams?: ColumnSetupParams, ) => { + console.log({ children, addChill: groupParams?.additionalChildren }); const group: GridColumnGroup | undefined = groupParams ? { ...getGroupSetup(groupParams.groupId, groupParams.disaster), - children: [...children, ...groupParams.additionalChildren], + children: [ + ...children, + // Only add KoboCommonKeys.village if not already present + ...(children.some( + child => 'field' in child && child.field === KoboCommonKeys.village, + ) + ? [] + : [{ field: KoboCommonKeys.village as string } as GridColumnNode]), + ...groupParams.additionalChildren, + ], } : undefined; @@ -207,6 +227,8 @@ export const addCommuneLevelReportLocationColumns = ({ ); }, }, + // What to do in detailed commune level report? + getLocationCountColumnSetup(KoboCommonKeys.village as string, 'COMMON', 72), ...columns, ]; @@ -240,6 +262,7 @@ export const addProvinceLevelReportLocationColumns = ({ getLocationColumnSetup(KoboCommonKeys.province, 200), getLocationCountColumnSetup(KoboCommonKeys.district, 'COMMON', 72), getLocationCountColumnSetup(KoboCommonKeys.commune, 'COMMON', 84), + getLocationCountColumnSetup(KoboCommonKeys.village as string, 'COMMON', 72), ...columns, ]; @@ -249,6 +272,7 @@ export const addProvinceLevelReportLocationColumns = ({ { field: KoboCommonKeys.province }, { field: KoboCommonKeys.district }, { field: KoboCommonKeys.commune }, + { field: KoboCommonKeys.village as string }, ], groupParams, ); diff --git a/packages/interfaces/src/kobo/DroughtDto.ts b/packages/interfaces/src/kobo/DroughtDto.ts index 7db5aaf4..1bc0f134 100644 --- a/packages/interfaces/src/kobo/DroughtDto.ts +++ b/packages/interfaces/src/kobo/DroughtDto.ts @@ -24,6 +24,8 @@ export class DroughtDto { @IsString() @Length(2) readonly 'group_yu9nq00/Province'!: string; @IsString() @Length(4) readonly 'group_yu9nq00/District'!: string; @IsString() @Length(6) readonly 'group_yu9nq00/Commune'!: string; + // NOTE - This field does not exist in KOBO yet. + @IsString() readonly 'group_yu9nq00/Village'?: string; @IsDateString() readonly 'group_yu9nq00/Date_Dis': string; @IsNumberString() readonly 'group_yu9nq00/DisTyp'!: string; @IsOptional() @IsNumberString() readonly 'group_dg01m69/NumVillAff'?: string; diff --git a/packages/interfaces/src/kobo/FloodDto.ts b/packages/interfaces/src/kobo/FloodDto.ts index d4c78651..9fd54bc2 100644 --- a/packages/interfaces/src/kobo/FloodDto.ts +++ b/packages/interfaces/src/kobo/FloodDto.ts @@ -26,6 +26,7 @@ export class FloodDto { @IsString() @Length(2) readonly 'g2/Province'!: string; @IsString() @Length(4) readonly 'g2/District'!: string; @IsString() @Length(6) readonly 'g2/Commune'!: string; + @IsString() readonly 'g2/village'?: string; @IsDateString() readonly 'g2/Date_Dis'!: string; @IsNumberString() readonly 'g2/DisTyp'!: string; @IsOptional() @IsNumberString() readonly 'g2/flood_n'?: string; diff --git a/packages/interfaces/src/kobo/IncidentDto.ts b/packages/interfaces/src/kobo/IncidentDto.ts index 084f6138..6d262771 100644 --- a/packages/interfaces/src/kobo/IncidentDto.ts +++ b/packages/interfaces/src/kobo/IncidentDto.ts @@ -27,6 +27,7 @@ export class IncidentDto { @IsString() @Length(2) readonly 'G2/Province'!: string; @IsString() @Length(4) readonly 'G2/District'!: string; @IsString() @Length(6) readonly 'G2/Commune'!: string; + @IsString() readonly 'G2/Village'?: string; @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_pf1pd97/NumVillAff'?: string; @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_pf1pd97/NumFamAff'?: string; @IsOptional() @IsNumberString() readonly 'group_tc1fy38/group_pf1pd97/NumPeoAff'?: string; diff --git a/packages/interfaces/src/kobo/mapping/keys.ts b/packages/interfaces/src/kobo/mapping/keys.ts index c835fa0b..d8b37f1f 100644 --- a/packages/interfaces/src/kobo/mapping/keys.ts +++ b/packages/interfaces/src/kobo/mapping/keys.ts @@ -2,9 +2,10 @@ import { DROUGHT, FLOOD, INCIDENT } from '../constants'; import { floodSpecificKeys } from './flood'; export enum KoboCommonKeys { + province = 'province', district = 'district', commune = 'commune', - province = 'province', + village = 'village', disasterDate = 'disasterDate', entryName = 'entryName', phone = 'phone', @@ -21,6 +22,7 @@ export const koboKeys = { [KoboCommonKeys.district]: 'g2/District', [KoboCommonKeys.commune]: 'g2/Commune', [KoboCommonKeys.province]: 'g2/Province', + [KoboCommonKeys.village]: 'g2/village', [KoboCommonKeys.disasterDate]: 'g2/Date_Dis', [KoboCommonKeys.entryName]: 'g1/q_Enum', [KoboCommonKeys.phone]: 'g1/q_Phone', @@ -35,6 +37,7 @@ export const koboKeys = { [KoboCommonKeys.district]: 'group_yu9nq00/District', [KoboCommonKeys.commune]: 'group_yu9nq00/Commune', [KoboCommonKeys.province]: 'group_yu9nq00/Province', + [KoboCommonKeys.village]: 'group_yu9nq00/Village', [KoboCommonKeys.disasterDate]: 'group_yu9nq00/Date_Dis', [KoboCommonKeys.entryName]: 'group_ve4vz14/q_Enum', [KoboCommonKeys.phone]: 'group_ve4vz14/q_Phone', @@ -48,6 +51,7 @@ export const koboKeys = { [KoboCommonKeys.district]: 'G2/District', [KoboCommonKeys.commune]: 'G2/Commune', [KoboCommonKeys.province]: 'G2/Province', + [KoboCommonKeys.village]: 'G2/Village', [KoboCommonKeys.disasterDate]: 'G2/Date_Dis', [KoboCommonKeys.entryName]: 'G1/q_Enum', [KoboCommonKeys.phone]: 'G1/q_Phone', diff --git a/packages/interfaces/src/kobo/utils.ts b/packages/interfaces/src/kobo/utils.ts index 5515cd2c..711631c1 100644 --- a/packages/interfaces/src/kobo/utils.ts +++ b/packages/interfaces/src/kobo/utils.ts @@ -51,6 +51,7 @@ export const formatCommonFields = (form: DisasterDtoType) => { [KoboCommonKeys.province]: form[keys.province], [KoboCommonKeys.district]: form[keys.district], [KoboCommonKeys.commune]: form[keys.commune], + [KoboCommonKeys.village]: form[keys.village], [KoboCommonKeys.disasterDate]: form[keys.disasterDate], [KoboCommonKeys.disTyp]: form[keys.disTyp], [KoboCommonKeys.entryName]: form[keys.entryName], @@ -71,6 +72,7 @@ export const formatCommonFields = (form: DisasterDtoType) => { [KoboCommonKeys.province]: form[keys.province], [KoboCommonKeys.district]: form[keys.district], [KoboCommonKeys.commune]: form[keys.commune], + [KoboCommonKeys.village]: form[keys.village], [KoboCommonKeys.disasterDate]: form[keys.disasterDate], [KoboCommonKeys.disTyp]: form[keys.disTyp], [KoboCommonKeys.entryName]: form[keys.entryName], @@ -90,6 +92,7 @@ export const formatCommonFields = (form: DisasterDtoType) => { [KoboCommonKeys.province]: form[keys.province], [KoboCommonKeys.district]: form[keys.district], [KoboCommonKeys.commune]: form[keys.commune], + [KoboCommonKeys.village]: form[keys.village], [KoboCommonKeys.disasterDate]: form[keys.disasterDate], [KoboCommonKeys.disTyp]: form[keys.disTyp], [KoboCommonKeys.entryName]: form[keys.entryName], From 184f24d879d15306f4f8bbf8c250d2a8d85cf016 Mon Sep 17 00:00:00 2001 From: ericboucher Date: Sun, 22 Sep 2024 23:46:26 +0200 Subject: [PATCH 11/14] NumVillAff -> Villages (Old) --- apps/frontend/translations/en.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/frontend/translations/en.json b/apps/frontend/translations/en.json index 0a02b852..87723ebf 100644 --- a/apps/frontend/translations/en.json +++ b/apps/frontend/translations/en.json @@ -158,7 +158,7 @@ "FLOOD": { "floodN": "Flood Number", "column": { - "NumVillAff": "Villages", + "NumVillAff": "Villages (Old)", "NumFamAff": "Families", "NumPeoAff": "Total People", "NumFeAff": "Women", @@ -404,7 +404,7 @@ }, "DROUGHT": { "column": { - "NumVillAff": "Villages", + "NumVillAff": "Villages (Old)", "NumFamAff": "Families", "NumPeoAff": "Total People", "NumMe": "Men", @@ -569,7 +569,7 @@ }, "INCIDENT": { "column": { - "NumVillAff": "Villages", + "NumVillAff": "Villages (Old)", "NumPeoAff": "Total People", "NumFamAff": "Families", "NumFeAff": "Women", From 5e5db4824dfad0030a332385a75df513c557a336 Mon Sep 17 00:00:00 2001 From: ericboucher Date: Mon, 23 Sep 2024 09:54:11 +0200 Subject: [PATCH 12/14] Remove console log and add TODO --- apps/frontend/utils/tableFormatting.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/frontend/utils/tableFormatting.tsx b/apps/frontend/utils/tableFormatting.tsx index 05974a7e..190c45f1 100644 --- a/apps/frontend/utils/tableFormatting.tsx +++ b/apps/frontend/utils/tableFormatting.tsx @@ -133,12 +133,13 @@ const addGroup = ( children: GridColumnNode[], groupParams?: ColumnSetupParams, ) => { - console.log({ children, addChill: groupParams?.additionalChildren }); const group: GridColumnGroup | undefined = groupParams ? { ...getGroupSetup(groupParams.groupId, groupParams.disaster), children: [ ...children, + // TODO - this is a hack to add village to the commune level report without + // breaking the grouped menu in detailed commune level report // Only add KoboCommonKeys.village if not already present ...(children.some( child => 'field' in child && child.field === KoboCommonKeys.village, From a929b766ac3a745ae661288966c74d5018672303 Mon Sep 17 00:00:00 2001 From: ericboucher Date: Mon, 23 Sep 2024 10:46:53 +0200 Subject: [PATCH 13/14] Update translations --- apps/frontend/translations/en.json | 9 +++++---- apps/frontend/translations/km.json | 17 +++++++++++++---- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/apps/frontend/translations/en.json b/apps/frontend/translations/en.json index 87723ebf..795665fe 100644 --- a/apps/frontend/translations/en.json +++ b/apps/frontend/translations/en.json @@ -212,8 +212,6 @@ "NumWareHDam": "Damaged", "NumCraftAff": "Affected", "NumCraftDam": "Damaged", - "integer_ws0la67": "Affected", - "integer_da9ns07": "Damaged", "ToNamAgriAff": "Affected", "NumFarmCroAff": "Affected", "FarmAff": "Affected", @@ -392,6 +390,8 @@ "NumFeEva": "Women Evacuated", "NumHouAff": "Houses Affected", "NumSchoAff": "Schools Affected", + "ToNamAgriAff": "Total number of households affecting farmland", + "NumFarmCroAff": "Number of households affected by mixed crops", "SamNabAff": "Seedlings Affected (ha)", "SamNabDam": "Seedlings Damaged (ha)", "PaddyAff": "Paddies Affected (ha)", @@ -554,8 +554,6 @@ "NumFe": "Women Missing Water", "TNumDeath": "Total Death Toll", "FamAgriAff": "Families with Affected Plantations", - "ToNamAgriAff": "Total number of households affecting farmland", - "NumFarmCroAff": "Number of households affected by mixed crops", "FarmAff": "Crop/Subsidiary plants Affected (ha)", "FarmDam": "Crop/Subsidiary plants Damaged (ha)", "SamNabAff": "Seedlings Affected (ha)", @@ -626,6 +624,8 @@ "StorageDam": "Damaged", "CraftAff": "Affected", "CraftDam": "Damaged", + "integer_ws0la67": "Affected", + "integer_da9ns07": "Damaged", "CropAff": "Affected", "CropDam": "Damaged", "SamnabAff": "Affected", @@ -659,6 +659,7 @@ "market": "Market (number)", "warehouse": "Warehouse (number)", "workshop": "Workshop (number)", + "factory": "Factory (number)", "agricultureForest": "Agriculture and Forest Affected", "crop": "Crop/subsidiary plants (ha)", "transplanted": "Seedlings ()ha", diff --git a/apps/frontend/translations/km.json b/apps/frontend/translations/km.json index 6d9ffafa..8bd30837 100644 --- a/apps/frontend/translations/km.json +++ b/apps/frontend/translations/km.json @@ -167,7 +167,7 @@ "FLOOD": { "floodN": "ចំនួនលើកទឹកជំនន់", "column": { - "NumVillAff": "ភូមិ", + "NumVillAff": "ភូមិ (ចាស់)", "NumFamAff": "គ្រួសារ", "NumPeoAff": "ចំំនួនមនុស្ស", "NumFeAff": "ស្រ្តី", @@ -221,8 +221,11 @@ "NumWareHDam": "ខូចខាត", "NumCraftAff": "ប៉ះពាល់", "NumCraftDam": "ខូចខាត", + "ToNamAgriAff": "ប៉ះពាល់", + "NumFarmCroAff": "ប៉ះពាល់", "FarmAff": "ប៉ះពាល់", "FarmDam": "ខូចខាត", + "NumFarmPaddyAff": "ប៉ះពាល់", "SamNabAff": "ប៉ះពាល់", "SamNabDam": "ខូចខាត", "PaddyAff": "ប៉ះពាល់", @@ -396,6 +399,8 @@ "NumFeEva": "ចំនួនស្រ្តីដែលបានជម្លៀស", "NumHouAff": "ចំនួនផ្ទះដែលរងផលប៉ះពាល់", "NumSchoAff": "ចំនួនសាលាដែលរងផលប៉ះពាល់", + "ToNamAgriAff": "ចំនួនគ្រួសារសរុប៉ះពាល់ដីស្រែ/ចម្ការ", + "NumFarmCroAff": "ចំនួនគ្រួសារប៉ះពាល់ដំណាំរួមផ្សំ", "SamNabAff": "ចំនួនសំណាបដែលរងផលប៉ះពាល់ (ហិចតា)", "SamNabDam": "ចំនួនសំណាបដែលខូចខាត (ហិចតា)", "PaddyAff": "ចំនួនស្រែដែលរងផលប៉ះពាល់ (ហិចតា)", @@ -408,7 +413,7 @@ }, "DROUGHT": { "column": { - "NumVillAff": "ភូមិ", + "NumVillAff": "ភូមិ (ចាស់)", "NumFamAff": "គ្រួសារ", "NumPeoAff": "ចំំនួនមនុស្ស", "NumMe": "បុរស", @@ -571,7 +576,7 @@ }, "INCIDENT": { "column": { - "NumVillAff": "ភូមិ", + "NumVillAff": "ភូមិ (ចាស់)", "NumPeoAff": "ចំំនួនមនុស្ស", "NumFamAff": "គ្រួសារ", "NumFeAff": "ស្រ្តី", @@ -628,6 +633,8 @@ "StorageDam": "ខូចខាត", "CraftAff": "ប៉ះពាល់", "CraftDam": "ខូចខាត", + "integer_ws0la67": "ប៉ះពាល់", + "integer_da9ns07": "ខូចខាត", "CropAff": "ប៉ះពាល់", "CropDam": "ខូចខាត", "SamnabAff": "ប៉ះពាល់", @@ -661,6 +668,7 @@ "market": "ទីផ្សារ (ចំនួន)", "warehouse": "ឃ្លាំងស្តុកទំនិញ (កន្លែង)", "workshop": "សិប្បកម្ម/រោងជាង (កន្លែង)", + "factory": "រោងចក្រ (កន្លែង)", "agricultureForest": "ផលប៉ះពាល់កសិកម្ម និងព្រៃឈើ", "crop": "ដំណាំចម្ការ/ដំណាំរួមផ្សំ (ហ.ត)", "transplanted": "សំណាប (ហត)", @@ -695,7 +703,8 @@ "COMMON": { "column": { "district": "ស្រុក", - "commune": "ឃុំ" + "commune": "ឃុំ", + "village": "ភូមិ" } } }, From 9772224b4821a1f38d605305ff1289dcb8f9138f Mon Sep 17 00:00:00 2001 From: ericboucher Date: Mon, 23 Sep 2024 10:50:02 +0200 Subject: [PATCH 14/14] Prepare village for edit --- .../DroughtFormValidation/DroughtFormType.ts | 1 + .../DroughtFormValidation/DroughtFormValidation.tsx | 1 + .../FormValidation/FloodFormValidation/FloodFormType.ts | 1 + .../FloodFormValidation/FloodFormValidation.tsx | 1 + .../IncidentFormValidation/IncidentFormType.ts | 1 + .../IncidentFormValidation/IncidentFormValidation.tsx | 1 + apps/frontend/utils/formatFormToRaw.ts | 2 +- apps/frontend/utils/tableFormatting.tsx | 8 ++++---- 8 files changed, 11 insertions(+), 5 deletions(-) diff --git a/apps/frontend/components/FormValidation/DroughtFormValidation/DroughtFormType.ts b/apps/frontend/components/FormValidation/DroughtFormValidation/DroughtFormType.ts index 425d1818..ea05a5ab 100644 --- a/apps/frontend/components/FormValidation/DroughtFormValidation/DroughtFormType.ts +++ b/apps/frontend/components/FormValidation/DroughtFormValidation/DroughtFormType.ts @@ -6,6 +6,7 @@ export type DroughtFormType = { province: string[]; district: string[]; commune: string[]; + village: string; }; interviewer: string; disTyp: string; diff --git a/apps/frontend/components/FormValidation/DroughtFormValidation/DroughtFormValidation.tsx b/apps/frontend/components/FormValidation/DroughtFormValidation/DroughtFormValidation.tsx index 8e03408e..e05eb8ab 100644 --- a/apps/frontend/components/FormValidation/DroughtFormValidation/DroughtFormValidation.tsx +++ b/apps/frontend/components/FormValidation/DroughtFormValidation/DroughtFormValidation.tsx @@ -41,6 +41,7 @@ export const DroughtFormValidation = ({ province: [formattedForm.province], district: [formattedForm.district], commune: [formattedForm.commune], + village: formattedForm.village, }, interviewer: formattedForm.entryName, disTyp: formattedForm.disTyp, diff --git a/apps/frontend/components/FormValidation/FloodFormValidation/FloodFormType.ts b/apps/frontend/components/FormValidation/FloodFormValidation/FloodFormType.ts index b521ab1d..853c6a9b 100644 --- a/apps/frontend/components/FormValidation/FloodFormValidation/FloodFormType.ts +++ b/apps/frontend/components/FormValidation/FloodFormValidation/FloodFormType.ts @@ -6,6 +6,7 @@ export type FloodFormType = { province: string[]; district: string[]; commune: string[]; + village: string; }; interviewer: string; disTyp: string; diff --git a/apps/frontend/components/FormValidation/FloodFormValidation/FloodFormValidation.tsx b/apps/frontend/components/FormValidation/FloodFormValidation/FloodFormValidation.tsx index 398c7d52..3f940631 100644 --- a/apps/frontend/components/FormValidation/FloodFormValidation/FloodFormValidation.tsx +++ b/apps/frontend/components/FormValidation/FloodFormValidation/FloodFormValidation.tsx @@ -41,6 +41,7 @@ export const FloodFormValidation = ({ province: [formattedForm.province], district: [formattedForm.district], commune: [formattedForm.commune], + village: formattedForm.village, }, interviewer: formattedForm.entryName, disTyp: formattedForm.disTyp, diff --git a/apps/frontend/components/FormValidation/IncidentFormValidation/IncidentFormType.ts b/apps/frontend/components/FormValidation/IncidentFormValidation/IncidentFormType.ts index 73d53d80..3283fbbb 100644 --- a/apps/frontend/components/FormValidation/IncidentFormValidation/IncidentFormType.ts +++ b/apps/frontend/components/FormValidation/IncidentFormValidation/IncidentFormType.ts @@ -7,6 +7,7 @@ export interface IncidentFormType extends FieldValues { province: string[]; district: string[]; commune: string[]; + village: string; }; interviewer: string; disTyp: string; diff --git a/apps/frontend/components/FormValidation/IncidentFormValidation/IncidentFormValidation.tsx b/apps/frontend/components/FormValidation/IncidentFormValidation/IncidentFormValidation.tsx index 42b4d3d1..c9748ec5 100644 --- a/apps/frontend/components/FormValidation/IncidentFormValidation/IncidentFormValidation.tsx +++ b/apps/frontend/components/FormValidation/IncidentFormValidation/IncidentFormValidation.tsx @@ -41,6 +41,7 @@ export const IncidentFormValidation = ({ province: [formattedForm.province], district: [formattedForm.district], commune: [formattedForm.commune], + village: formattedForm.village, }, interviewer: formattedForm.entryName, disTyp: formattedForm.disTyp, diff --git a/apps/frontend/utils/formatFormToRaw.ts b/apps/frontend/utils/formatFormToRaw.ts index c504504b..e91ea2a4 100644 --- a/apps/frontend/utils/formatFormToRaw.ts +++ b/apps/frontend/utils/formatFormToRaw.ts @@ -18,7 +18,7 @@ export const formatFormToRaw = ( district: formValues.region.district[0], commune: formValues.region.commune[0], // TODO - FIXME: This is just a placeholder for the village field - village: 'test', + village: formValues.region.village, // TODO - FIXME: This is just a placeholder for the location field location: formValues.region.commune[0], entryName: formValues.interviewer, diff --git a/apps/frontend/utils/tableFormatting.tsx b/apps/frontend/utils/tableFormatting.tsx index 190c45f1..80121000 100644 --- a/apps/frontend/utils/tableFormatting.tsx +++ b/apps/frontend/utils/tableFormatting.tsx @@ -145,7 +145,7 @@ const addGroup = ( child => 'field' in child && child.field === KoboCommonKeys.village, ) ? [] - : [{ field: KoboCommonKeys.village as string } as GridColumnNode]), + : [{ field: KoboCommonKeys.village }]), ...groupParams.additionalChildren, ], } @@ -229,7 +229,7 @@ export const addCommuneLevelReportLocationColumns = ({ }, }, // What to do in detailed commune level report? - getLocationCountColumnSetup(KoboCommonKeys.village as string, 'COMMON', 72), + getLocationCountColumnSetup(KoboCommonKeys.village, 'COMMON', 72), ...columns, ]; @@ -263,7 +263,7 @@ export const addProvinceLevelReportLocationColumns = ({ getLocationColumnSetup(KoboCommonKeys.province, 200), getLocationCountColumnSetup(KoboCommonKeys.district, 'COMMON', 72), getLocationCountColumnSetup(KoboCommonKeys.commune, 'COMMON', 84), - getLocationCountColumnSetup(KoboCommonKeys.village as string, 'COMMON', 72), + getLocationCountColumnSetup(KoboCommonKeys.village, 'COMMON', 72), ...columns, ]; @@ -273,7 +273,7 @@ export const addProvinceLevelReportLocationColumns = ({ { field: KoboCommonKeys.province }, { field: KoboCommonKeys.district }, { field: KoboCommonKeys.commune }, - { field: KoboCommonKeys.village as string }, + { field: KoboCommonKeys.village }, ], groupParams, );