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. 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/FloodFormValidation/tablesConfig/Agriculture.tsx b/apps/frontend/components/FormValidation/FloodFormValidation/tablesConfig/Agriculture.tsx index f28f1594..e4896e5e 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/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/components/FormValidation/IncidentFormValidation/tablesConfig/Social.tsx b/apps/frontend/components/FormValidation/IncidentFormValidation/tablesConfig/Social.tsx index 37822ef3..329cf60f 100644 --- a/apps/frontend/components/FormValidation/IncidentFormValidation/tablesConfig/Social.tsx +++ b/apps/frontend/components/FormValidation/IncidentFormValidation/tablesConfig/Social.tsx @@ -26,6 +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, + }), ]; const SocialColumnGroup: GridColumnGroupingModel = [ @@ -64,6 +72,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 4109a1ca..795665fe 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" }, @@ -157,7 +158,7 @@ "FLOOD": { "floodN": "Flood Number", "column": { - "NumVillAff": "Villages", + "NumVillAff": "Villages (Old)", "NumFamAff": "Families", "NumPeoAff": "Total People", "NumFeAff": "Women", @@ -211,8 +212,11 @@ "NumWareHDam": "Damaged", "NumCraftAff": "Affected", "NumCraftDam": "Damaged", + "ToNamAgriAff": "Affected", + "NumFarmCroAff": "Affected", "FarmAff": "Affected", "FarmDam": "Damaged", + "NumFarmPaddyAff": "Affected", "SamNabAff": "Affected", "SamNabDam": "Damaged", "PaddyAff": "Affected", @@ -386,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)", @@ -398,7 +404,7 @@ }, "DROUGHT": { "column": { - "NumVillAff": "Villages", + "NumVillAff": "Villages (Old)", "NumFamAff": "Families", "NumPeoAff": "Total People", "NumMe": "Men", @@ -561,7 +567,7 @@ }, "INCIDENT": { "column": { - "NumVillAff": "Villages", + "NumVillAff": "Villages (Old)", "NumPeoAff": "Total People", "NumFamAff": "Families", "NumFeAff": "Women", @@ -618,6 +624,8 @@ "StorageDam": "Damaged", "CraftAff": "Affected", "CraftDam": "Damaged", + "integer_ws0la67": "Affected", + "integer_da9ns07": "Damaged", "CropAff": "Affected", "CropDam": "Damaged", "SamnabAff": "Affected", @@ -651,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", @@ -685,7 +694,8 @@ "COMMON": { "column": { "district": "District", - "commune": "Commune" + "commune": "Commune", + "village": "Villages" } } }, diff --git a/apps/frontend/translations/km.json b/apps/frontend/translations/km.json index f28a4d73..8bd30837 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": "αž§αž”αŸ’αž”αžαŸ’αžαž·αž αŸαžαž»αž‘αžΆαŸ†αž„αž’αžŸαŸ‹αŸ”" @@ -166,7 +167,7 @@ "FLOOD": { "floodN": "αž…αŸ†αž“αž½αž“αž›αžΎαž€αž‘αžΉαž€αž‡αŸ†αž“αž“αŸ‹", "column": { - "NumVillAff": "αž—αžΌαž˜αž·", + "NumVillAff": "αž—αžΌαž˜αž· (αž…αžΆαžŸαŸ‹)", "NumFamAff": "αž‚αŸ’αžšαž½αžŸαžΆαžš", "NumPeoAff": "αž…αŸ†αŸ†αž“αž½αž“αž˜αž“αž»αžŸαŸ’αžŸ", "NumFeAff": "αžŸαŸ’αžšαŸ’αžαžΈ", @@ -220,8 +221,11 @@ "NumWareHDam": "αžαžΌαž…αžαžΆαž", "NumCraftAff": "αž”αŸ‰αŸ‡αž–αžΆαž›αŸ‹", "NumCraftDam": "αžαžΌαž…αžαžΆαž", + "ToNamAgriAff": "αž”αŸ‰αŸ‡αž–αžΆαž›αŸ‹", + "NumFarmCroAff": "αž”αŸ‰αŸ‡αž–αžΆαž›αŸ‹", "FarmAff": "αž”αŸ‰αŸ‡αž–αžΆαž›αŸ‹", "FarmDam": "αžαžΌαž…αžαžΆαž", + "NumFarmPaddyAff": "αž”αŸ‰αŸ‡αž–αžΆαž›αŸ‹", "SamNabAff": "αž”αŸ‰αŸ‡αž–αžΆαž›αŸ‹", "SamNabDam": "αžαžΌαž…αžαžΆαž", "PaddyAff": "αž”αŸ‰αŸ‡αž–αžΆαž›αŸ‹", @@ -395,6 +399,8 @@ "NumFeEva": "αž…αŸ†αž“αž½αž“αžŸαŸ’αžšαŸ’αžαžΈαžŠαŸ‚αž›αž”αžΆαž“αž‡αž˜αŸ’αž›αŸ€αžŸ", "NumHouAff": "αž…αŸ†αž“αž½αž“αž•αŸ’αž‘αŸ‡αžŠαŸ‚αž›αžšαž„αž•αž›αž”αŸ‰αŸ‡αž–αžΆαž›αŸ‹", "NumSchoAff": "αž…αŸ†αž“αž½αž“αžŸαžΆαž›αžΆαžŠαŸ‚αž›αžšαž„αž•αž›αž”αŸ‰αŸ‡αž–αžΆαž›αŸ‹", + "ToNamAgriAff": "αž…αŸ†αž“αž½αž“αž‚αŸ’αžšαž½αžŸαžΆαžšαžŸαžšαž»αž”αŸ‰αŸ‡αž–αžΆαž›αŸ‹αžŠαžΈαžŸαŸ’αžšαŸ‚/αž…αž˜αŸ’αž€αžΆαžš", + "NumFarmCroAff": "αž…αŸ†αž“αž½αž“αž‚αŸ’αžšαž½αžŸαžΆαžšαž”αŸ‰αŸ‡αž–αžΆαž›αŸ‹αžŠαŸ†αžŽαžΆαŸ†αžšαž½αž˜αž•αŸ’αžŸαŸ†", "SamNabAff": "αž…αŸ†αž“αž½αž“αžŸαŸ†αžŽαžΆαž”αžŠαŸ‚αž›αžšαž„αž•αž›αž”αŸ‰αŸ‡αž–αžΆαž›αŸ‹ (αž αž·αž…αžαžΆ)", "SamNabDam": "αž…αŸ†αž“αž½αž“αžŸαŸ†αžŽαžΆαž”αžŠαŸ‚αž›αžαžΌαž…αžαžΆαž (αž αž·αž…αžαžΆ)", "PaddyAff": "αž…αŸ†αž“αž½αž“αžŸαŸ’αžšαŸ‚αžŠαŸ‚αž›αžšαž„αž•αž›αž”αŸ‰αŸ‡αž–αžΆαž›αŸ‹ (αž αž·αž…αžαžΆ)", @@ -407,7 +413,7 @@ }, "DROUGHT": { "column": { - "NumVillAff": "αž—αžΌαž˜αž·", + "NumVillAff": "αž—αžΌαž˜αž· (αž…αžΆαžŸαŸ‹)", "NumFamAff": "αž‚αŸ’αžšαž½αžŸαžΆαžš", "NumPeoAff": "αž…αŸ†αŸ†αž“αž½αž“αž˜αž“αž»αžŸαŸ’αžŸ", "NumMe": "αž”αž»αžšαžŸ", @@ -570,7 +576,7 @@ }, "INCIDENT": { "column": { - "NumVillAff": "αž—αžΌαž˜αž·", + "NumVillAff": "αž—αžΌαž˜αž· (αž…αžΆαžŸαŸ‹)", "NumPeoAff": "αž…αŸ†αŸ†αž“αž½αž“αž˜αž“αž»αžŸαŸ’αžŸ", "NumFamAff": "αž‚αŸ’αžšαž½αžŸαžΆαžš", "NumFeAff": "αžŸαŸ’αžšαŸ’αžαžΈ", @@ -627,6 +633,8 @@ "StorageDam": "αžαžΌαž…αžαžΆαž", "CraftAff": "αž”αŸ‰αŸ‡αž–αžΆαž›αŸ‹", "CraftDam": "αžαžΌαž…αžαžΆαž", + "integer_ws0la67": "αž”αŸ‰αŸ‡αž–αžΆαž›αŸ‹", + "integer_da9ns07": "αžαžΌαž…αžαžΆαž", "CropAff": "αž”αŸ‰αŸ‡αž–αžΆαž›αŸ‹", "CropDam": "αžαžΌαž…αžαžΆαž", "SamnabAff": "αž”αŸ‰αŸ‡αž–αžΆαž›αŸ‹", @@ -660,6 +668,7 @@ "market": "αž‘αžΈαž•αŸ’αžŸαžΆαžš (αž…αŸ†αž“αž½αž“)", "warehouse": "αžƒαŸ’αž›αžΆαŸ†αž„αžŸαŸ’αžαž»αž€αž‘αŸ†αž“αž·αž‰ (αž€αž“αŸ’αž›αŸ‚αž„)", "workshop": "αžŸαž·αž”αŸ’αž”αž€αž˜αŸ’αž˜/αžšαŸ„αž„αž‡αžΆαž„ (αž€αž“αŸ’αž›αŸ‚αž„)", + "factory": "αžšαŸ„αž„αž…αž€αŸ’αžš (αž€αž“αŸ’αž›αŸ‚αž„)", "agricultureForest": "αž•αž›αž”αŸ‰αŸ‡αž–αžΆαž›αŸ‹αž€αžŸαž·αž€αž˜αŸ’αž˜ αž“αž·αž„αž–αŸ’αžšαŸƒαžˆαžΎ", "crop": "αžŠαŸ†αžŽαžΆαŸ†αž…αž˜αŸ’αž€αžΆαžš/αžŠαŸ†αžŽαžΆαŸ†αžšαž½αž˜αž•αŸ’αžŸαŸ† (ហ.ត)", "transplanted": "αžŸαŸ†αžŽαžΆαž” (ហត)", @@ -694,7 +703,8 @@ "COMMON": { "column": { "district": "αžŸαŸ’αžšαž»αž€", - "commune": "αžƒαž»αŸ†" + "commune": "αžƒαž»αŸ†", + "village": "αž—αžΌαž˜αž·" } } }, 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..e91ea2a4 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: 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 4ffd3f19..80121000 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) => ({ @@ -126,7 +136,18 @@ const addGroup = ( const group: GridColumnGroup | undefined = groupParams ? { ...getGroupSetup(groupParams.groupId, groupParams.disaster), - children: [...children, ...groupParams.additionalChildren], + 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, + ) + ? [] + : [{ field: KoboCommonKeys.village }]), + ...groupParams.additionalChildren, + ], } : undefined; @@ -207,6 +228,8 @@ export const addCommuneLevelReportLocationColumns = ({ ); }, }, + // What to do in detailed commune level report? + getLocationCountColumnSetup(KoboCommonKeys.village, 'COMMON', 72), ...columns, ]; @@ -240,6 +263,7 @@ export const addProvinceLevelReportLocationColumns = ({ getLocationColumnSetup(KoboCommonKeys.province, 200), getLocationCountColumnSetup(KoboCommonKeys.district, 'COMMON', 72), getLocationCountColumnSetup(KoboCommonKeys.commune, 'COMMON', 84), + getLocationCountColumnSetup(KoboCommonKeys.village, 'COMMON', 72), ...columns, ]; @@ -249,6 +273,7 @@ export const addProvinceLevelReportLocationColumns = ({ { field: KoboCommonKeys.province }, { field: KoboCommonKeys.district }, { field: KoboCommonKeys.commune }, + { field: KoboCommonKeys.village }, ], 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 f17f24f1..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; @@ -85,6 +86,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; diff --git a/packages/interfaces/src/kobo/IncidentDto.ts b/packages/interfaces/src/kobo/IncidentDto.ts index 458d8b93..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; @@ -86,6 +87,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/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' + > +>; 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', }; 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', diff --git a/packages/interfaces/src/kobo/mapping/incident.ts b/packages/interfaces/src/kobo/mapping/incident.ts index 126fb5d2..f32094b6 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/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', 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],