Skip to content

Conversation

@Shreya-egov
Copy link

@Shreya-egov Shreya-egov commented Sep 15, 2025

TICKET NUMBER - egovernments/health-campaign-field-worker-app#777

Choose the appropriate template for your PR:

Feature/Bugfix Request

JIRA ID

Module

Description

Summary by CodeRabbit

  • New Features
    • Added new filterable attributes in the HCM Admin Console: pregnancy status, gender, type of structure, age, weight, height, member count, and max count.
    • Introduced pregnancy-status options (Yes/No) and a validation schema for that attribute.
    • Added multiple health campaign/project type configurations with cycles, delivery strategies, product mappings, and dashboard/eligibility settings.

@Shreya-egov Shreya-egov requested a review from a team as a code owner September 15, 2025 11:55
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 15, 2025

📝 Walkthrough

Walkthrough

Adds four new JSON assets: an attributes list and a YES/NO value set for the HCM Admin Console, a corresponding JSON Schema for the pregnancy attribute, and a comprehensive HCM project types configuration detailing campaigns, cycles, deliveries, dose criteria, resources, and related metadata.

Changes

Cohort / File(s) Summary
HCM Admin Console attributes and options
health/configs/Data/HCM-ADMIN-CONSOLE.allAttributes, health/configs/Data/HCM-ADMIN-CONSOLE.isPregnant
Adds an attributes definition array (8 items) for Admin Console and a two-option value list for pregnancy (YES/NO), including i18n keys, projectTypes, optional valuesSchema, and allowedOperators.
HCM Admin Console schema
health/configs/Schemas/HCM-ADMIN-CONSOLE.isPregnant
Introduces JSON Schema (draft-07) for the pregnancy value list, requiring unique string fields code and name.
HCM Project Types configuration
health/configs/Data/HCM-PROJECT-TYPES.projectTypes
Adds a detailed project types config covering multiple campaigns with cycles, deliveries, dose criteria (age/height/weight/pregnancy), resources, flags, dashboard URLs, and eligibility constraints.

Sequence Diagram(s)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

I hop through configs, ears held high,
New types and attributes flutter by.
YES or NO, the schema knows,
Cycles, doses—where the campaign goes.
With tidy fields and structured light,
This bunny ships the data right. 🐇✨

✨ Finishing touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch NTD-Changes---777-by-Shreya

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Pre-merge checks

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The PR body includes the repository template but leaves the JIRA ID, Module, and Description fields inside HTML comments and only provides an unstructured "TICKET NUMBER" line; the Description section contains the placeholder text and no implementation details are provided. Because the required template fields and a substantive description are missing, the PR description is largely incomplete and does not meet the repository's template requirements. Populate the template's required fields: set the JIRA ID (ticket URL or ID), specify the Module (e.g., "NTD Campaign"), and replace the placeholder Description with a clear summary of what changed, why, which files were added/modified, testing steps, and any migration or configuration notes; include the issue link and any relevant screenshots or sample data.
Title Check ⚠️ Warning The PR title "Update HCM-ADMIN-CONSOLE.FormConfigTemplate.json" describes updating a FormConfigTemplate file, but the provided raw_summary shows only additions of HCM-ADMIN-CONSOLE.allAttributes, HCM-ADMIN-CONSOLE.isPregnant, HCM-PROJECT-TYPES.projectTypes, and a schema with no mention of FormConfigTemplate.json; therefore the title is misleading and does not summarize the primary change. This will confuse reviewers scanning history or the PR list. Rename the PR to clearly reflect the actual changes, for example "Add HCM-ADMIN-CONSOLE allAttributes, isPregnant, projectTypes and schema" or "Add HCM admin-console attribute definitions and project types"; alternatively, if FormConfigTemplate.json was intended to change, include that file in the diff and update the PR description so the title matches the changes.
✅ Passed checks (1 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.

coderabbitai[bot]
coderabbitai bot previously approved these changes Sep 15, 2025
coderabbitai[bot]
coderabbitai bot previously approved these changes Sep 15, 2025
coderabbitai[bot]
coderabbitai bot previously approved these changes Sep 15, 2025
coderabbitai[bot]
coderabbitai bot previously approved these changes Sep 15, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e11ef66 and 1c7b27f.

⛔ Files ignored due to path filters (3)
  • health/configs/Data/HCM-ADMIN-CONSOLE.FormConfigTemplate.json is excluded by !**/*.json
  • health/configs/Data/HCM-ADMIN-CONSOLE.schemas.json is excluded by !**/*.json
  • health/configs/Data/HCM-ADMIN-CONSOLE.targetConfigs.json is excluded by !**/*.json
📒 Files selected for processing (1)
  • health/configs/Data/HCM-ADMIN-CONSOLE.allAttributes (1 hunks)
🔇 Additional comments (4)
health/configs/Data/HCM-ADMIN-CONSOLE.allAttributes (4)

17-25: ```shell
#!/bin/bash
set -euo pipefail
echo "1) Find files named HCM-ADMIN-CONSOLE.allAttributes"
find . -type f -name 'HCM-ADMIN-CONSOLE.allAttributes' -print || true

echo
echo "2) Search repo for 'allowedOperators' and numeric attribute names (maxCount, weight, age, memberCount, height)"
rg -n --hidden --no-ignore-vcs -S '\ballowedOperators\b' -C2 || true
rg -n --hidden --no-ignore-vcs -S '\b(maxCount|weight|age|memberCount|height)\b' -C3 || true

echo
echo "3) If file found, show up to first 300 lines"
file=$(find . -type f -name 'HCM-ADMIN-CONSOLE.allAttributes' -print | head -n1 || true)
if [ -n "$file" ]; then
echo "---- $file ----"
nl -ba "$file" | sed -n '1,300p'
else
echo "No exact filename found; listing matching files in health/configs/Data"
rg -n --hidden --no-ignore-vcs -S 'HCM-ADMIN-CONSOLE' || true
find health -maxdepth 3 -type f -print || true
fi


---

`11-11`: **Validate referenced valuesSchema exist in MDMS/config**

File: health/configs/Data/HCM-ADMIN-CONSOLE.allAttributes — lines 11, 34, 87

- HCM-ADMIN-CONSOLE.isPregnant
- common-masters.GenderType
- HCM.HOUSE_STRUCTURE_TYPES

Ensure these entries are defined in MDMS/config and resolvable by the loader.

---

`5-5`: **Verify translations exist for all i18n keys**

rg in your verification run returned "No files were searched" (the --glob exclusions filtered everything). Re-run with the fixed command below and confirm each key appears in the locale bundles:

```bash
#!/bin/bash
set -euo pipefail
FILE="health/configs/Data/HCM-ADMIN-CONSOLE.allAttributes"
jq empty "$FILE"
mapfile -t keys < <(jq -r '.[].i18nKey' "$FILE")
for k in "${keys[@]}"; do
  echo "== $k =="
  rg -n --hidden -S -g '!dist/**' -g '!build/**' -g '!node_modules/**' -C1 "$k" || echo "MISSING: $k"
done

1-1: Extensionless data file — confirm loader picks up .allAttributes

Found health/configs/Data/HCM-ADMIN-CONSOLE.allAttributes (valid JSON array). I could not locate any repo code that explicitly globs/loads files from health/configs/Data (no .json-only loader discovered), while runtime code requests MDMS schema HCM-ADMIN-CONSOLE.allAttributes (e.g. micro-ui/.../deliveryRule/AddDeliverycontext.js). Confirm the dev/build/packaging loader includes *.allAttributes; if it does not, rename the file to .json or update the loader.

Comment on lines +1 to +104
[
{
"key": 7,
"code": "isPregnant",
"i18nKey": "CAMPAIGN_ISPREGNANT_LABEL",
"projectTypes": [
"NTD1",
"Oncho",
"Schisto"
],
"valuesSchema": "HCM-ADMIN-CONSOLE.isPregnant",
"allowedOperators": [
"EQUAL_TO"
]
},
{
"key": 2,
"code": "maxCount",
"i18nKey": "CAMPAIGN_MAXCOUNT_BEDNET_INDIVIDUAL_LABEL",
"projectTypes": [
"Bednets",
"DEFAULT"
],
"allowedOperators": []
},
{
"key": 6,
"code": "gender",
"i18nKey": "CAMPAIGN_ATTRIBUTE_GENDER",
"projectTypes": [
"DEFAULT",
"MR-DN"
],
"valuesSchema": "common-masters.GenderType",
"allowedOperators": [
"EQUAL_TO"
]
},
{
"key": 5,
"code": "weight",
"i18nKey": "CAMPAIGN_ATTRIBUTE_WEIGHT",
"projectTypes": [
"DEFAULT",
"MR-DN",
"NTD1",
"Oncho",
"Schisto"
],
"allowedOperators": []
},
{
"key": 4,
"code": "height",
"i18nKey": "CAMPAIGN_ATTRIBUTE_HEIGHT",
"projectTypes": [
"DEFAULT",
"MR-DN",
"NTD1",
"Oncho",
"Schisto"
]
},
{
"key": 3,
"code": "age",
"i18nKey": "CAMPAIGN_ATTRIBUTE_AGE",
"projectTypes": [
"CO-DEL",
"MR-DN",
"POLIO",
"DEFAULT",
"NTD1",
"Oncho",
"Schisto"
],
"allowedOperators": []
},
{
"key": 2,
"code": "type_of_structure",
"i18nKey": "TYPE_OF_STRUCTURE",
"projectTypes": [
"DEFAULT",
"IRS-mz"
],
"valuesSchema": "HCM.HOUSE_STRUCTURE_TYPES",
"allowedOperators": [
"EQUAL_TO"
]
},
{
"key": 1,
"code": "memberCount",
"i18nKey": "CAMPAIGN_BEDNET_INDIVIDUAL_LABEL",
"projectTypes": [
"LLIN-mz",
"DEFAULT",
"LLIN",
"Bednets"
],
"allowedOperators": []
}
]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Optional: sort by key or remove key if order is array-driven

If array order is the sole rendering order, either (a) drop key to avoid drift or (b) sort entries ascending by key for readability.

🤖 Prompt for AI Agents
In health/configs/Data/HCM-ADMIN-CONSOLE.allAttributes around lines 1-104, the
objects include a redundant/unsorted "key" field which can drift from array
order; either remove the "key" property from every object if the array order is
authoritative, or sort the array entries ascending by their "key" values (and
ensure keys are unique) so the explicit key matches the order; apply the change
consistently across the whole file and run a quick lint/format check before
committing.

Comment on lines +17 to +25
"key": 2,
"code": "maxCount",
"i18nKey": "CAMPAIGN_MAXCOUNT_BEDNET_INDIVIDUAL_LABEL",
"projectTypes": [
"Bednets",
"DEFAULT"
],
"allowedOperators": []
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Duplicate "key" value (2) — must be unique to avoid collisions/unstable ordering

Two entries share key 2 (“maxCount” and “type_of_structure”). If “key” is used for ordering or as an identifier, this can cause nondeterminism or overwrites.

Apply this diff to make keys unique (example: bump type_of_structure to 8):

-    "key": 2,
+    "key": 8,

Also applies to: 80-91

🤖 Prompt for AI Agents
In health/configs/Data/HCM-ADMIN-CONSOLE.allAttributes around lines 17-25 (and
also the duplicate at lines ~80-91), the "key" value 2 is used twice (for
"maxCount" and "type_of_structure"); update the duplicate numeric keys so each
entry has a unique integer (e.g., change the "type_of_structure" key to 8 or any
unused integer), apply the same uniqueness fix to the other duplicate at lines
80-91, and re-run any config validation or tests to ensure no other collisions
remain.

Comment on lines +53 to +63
"key": 4,
"code": "height",
"i18nKey": "CAMPAIGN_ATTRIBUTE_HEIGHT",
"projectTypes": [
"DEFAULT",
"MR-DN",
"NTD1",
"Oncho",
"Schisto"
]
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

height missing allowedOperators — align object shape

Consumer code often assumes allowedOperators exists; other numeric fields include it (even if empty). Add an empty array for consistency.

-    ]
+    ],
+    "allowedOperators": []
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"key": 4,
"code": "height",
"i18nKey": "CAMPAIGN_ATTRIBUTE_HEIGHT",
"projectTypes": [
"DEFAULT",
"MR-DN",
"NTD1",
"Oncho",
"Schisto"
]
},
"key": 4,
"code": "height",
"i18nKey": "CAMPAIGN_ATTRIBUTE_HEIGHT",
"projectTypes": [
"DEFAULT",
"MR-DN",
"NTD1",
"Oncho",
"Schisto"
],
"allowedOperators": []
},
🤖 Prompt for AI Agents
In health/configs/Data/HCM-ADMIN-CONSOLE.allAttributes around lines 53 to 63,
the "height" attribute is missing the allowedOperators property which other
numeric attributes include; add "allowedOperators": [] to the object so the
shape matches consumer expectations and avoids undefined access in calling code.

},
{
"key": 2,
"code": "type_of_structure",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Inconsistent code/i18n naming — verify canonical identifiers

  • code: mixed styles (type_of_structure vs camelCase elsewhere). Ensure this matches the backend/MDMS attribute id.
  • i18nKey: prefixes vary (TYPE_OF_STRUCTURE vs CAMPAIGN_...). Confirm these exact keys exist.

If required, I can normalize the code or update keys after you confirm canonical names.

Also applies to: 28-29, 93-95, 18-19

🤖 Prompt for AI Agents
In health/configs/Data/HCM-ADMIN-CONSOLE.allAttributes around line 81 (also
review lines 18-19, 28-29, 93-95): the "code" and "i18nKey" values use
inconsistent naming styles (e.g., snake_case vs camelCase and varying i18n
prefixes). Verify the canonical attribute IDs and i18n keys in the backend/MDMS
and update these entries so "code" exactly matches the MDMS attribute id (use
the canonical casing) and "i18nKey" uses the exact key prefix/naming used by
your localization files; perform a targeted replace for the four mentioned line
ranges, and run a quick config validation or unit check to ensure the updated
keys resolve against MDMS and i18n resources.

@Shreya-egov Shreya-egov changed the title Update HCM-ADMIN-CONSOLE.FormConfigTemplate.json NTD Changes - #777 by Shreya Sep 15, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1c7b27f and 95712e0.

📒 Files selected for processing (3)
  • health/configs/Data/HCM-ADMIN-CONSOLE.isPregnant (1 hunks)
  • health/configs/Data/HCM-PROJECT-TYPES.projectTypes (1 hunks)
  • health/configs/Schemas/HCM-ADMIN-CONSOLE.isPregnant (1 hunks)
🔇 Additional comments (5)
health/configs/Data/HCM-PROJECT-TYPES.projectTypes (4)

378-386: Confirm Bednets omission of "type".

Other project types specify "type": "multiround". If required by UI logic, add it here for consistency.


233-238: Verify group classification.

Oncho/Schisto/NTD1 are under "MALARIA". If groups drive dashboards/filters, ensure this is intentional.


437-447: Non-UUID id for DEFAULT; check constraints.

"id" looks non-standard (…23re). If consumers expect UUIDs, generate a valid one.


692-693: Validate observationStrategy value.

“DOT1” may not be a recognized enum value. Confirm allowed options.

health/configs/Data/HCM-ADMIN-CONSOLE.isPregnant (1)

1-10: Confirm consumers compare by code ('YES' / 'NO'), not display name

File: health/configs/Data/HCM-ADMIN-CONSOLE.isPregnant — values correct. Automated search returned no matches; verify all consumers compare against the "code" field (e.g., "YES"/"NO") rather than the "name" ("Yes"/"No"). Re-run locally with: rg -n --no-heading -C1 -g '!/node_modules/' -e $'\bisPregnant\s*[=]{1,2}\s*(Yes|No)\b' -e $'\bisPregnant\s*[=]{1,2}\s*(YES|NO)\b' health/

Comment on lines +16 to +116
"doseCriteria": [
{
"condition": "60<=age<180and90<=height<119and12<=weight<45andisPregnant=No",
"ProductVariants": [
{
"name": "Ivermectin 100mg",
"quantity": 1,
"productVariantId": "PVAR-2025-09-14-000582"
}
]
},
{
"condition": "60<=age<180and90<=height<119and12<=weight<45||isPregnant=No",
"ProductVariants": [
{
"name": "Ivermectin 100mg",
"quantity": 1,
"productVariantId": "PVAR-2025-09-14-000582"
}
]
},
{
"condition": "60<=age<180and120<=height<139and12<=weight<45andisPregnant=No",
"ProductVariants": [
{
"name": "Ivermectin 100mg",
"quantity": 1,
"productVariantId": "PVAR-2025-09-14-000582"
}
]
},
{
"condition": "60<=age<180and120<=height<139and12<=weight<45||isPregnant=No",
"ProductVariants": [
{
"name": "Ivermectin 100mg",
"quantity": 1,
"productVariantId": "PVAR-2025-09-14-000582"
}
]
},
{
"condition": "age>=180and140<=height<159and45<=weight<75andisPregnant=Yes",
"ProductVariants": [
{
"name": "Albendazole 400mg",
"quantity": 1,
"productVariantId": "PVAR-2025-09-14-000583"
}
]
},
{
"condition": "age>=180and140<=height<159and45<=weight<75andisPregnant=No",
"ProductVariants": [
{
"name": "Albendazole 400mg",
"quantity": 1,
"productVariantId": "PVAR-2025-09-14-000583"
}
]
},
{
"condition": "age>=180and140<=height<159and45<=weight<75||isPregnant=Yes",
"ProductVariants": [
{
"name": "Albendazole 400mg",
"quantity": 1,
"productVariantId": "PVAR-2025-09-14-000583"
}
]
},
{
"condition": "age>=180andheight>=159andweight>=75andisPregnant=Yes",
"ProductVariants": [
{
"name": "Albendazole 400mg",
"quantity": 1,
"productVariantId": "PVAR-2025-09-14-000583"
}
]
},
{
"condition": "age>=180andheight>=159andweight>=75andisPregnant=No",
"ProductVariants": [
{
"name": "Albendazole 400mg",
"quantity": 1,
"productVariantId": "PVAR-2025-09-14-000583"
}
]
},
{
"condition": "age>=180andheight>=159andweight>=75||isPregnant=No",
"ProductVariants": [
{
"name": "Albendazole 400mg",
"quantity": 1,
"productVariantId": "PVAR-2025-09-14-000583"
}
]
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Condition DSL inconsistencies risk mis-evaluation (operators, precedence, equality, value set).

Observed: mixed “and”/“||”/“or”, single “=”, and use of display names “Yes/No” vs codes “YES/NO”. Without explicit precedence, expressions like “… A and B and C || isPregnant=No” will match all non‑pregnant beneficiaries regardless of A/B/C.

  • Confirm the expected DSL grammar (operators, precedence, equality token).
  • If the engine compares codes, change to YES/NO and “==”.
  • Add parentheses where OR is intended.

Example fix pattern (apply similarly across Oncho/NTD1):

-                "condition": "60<=age<180and90<=height<119and12<=weight<45||isPregnant=No",
+                "condition": "(60<=age<180 and 90<=height<119 and 12<=weight<45) or isPregnant==NO",

Script to locate risky patterns:

Once grammar is confirmed, I can generate a bulk patch normalizing all conditions.


🏁 Script executed:

#!/bin/bash
rg -n -C1 -e $'\\|\\|' -e $'\\bisPregnant\\s*=\\s*(Yes|No|YES|NO)\\b' -e $'\\b(and|or)\\b.*\\|\\|' health/configs/Data/HCM-PROJECT-TYPES.projectTypes

Length of output: 1189


Fix inconsistent condition DSL (operators, equality, pregnancy values)

Mixed use of "and" with "||", single "=" for equality, and "Yes/No" literals will mis-evaluate conditions. Confirmed occurrences in health/configs/Data/HCM-PROJECT-TYPES.projectTypes at lines: 28, 48, 78, 108, 258, 278, 298, 328.

  • Required changes (apply to each occurrence and across Oncho/NTD1 sets):
    • Parenthesize conjunctions when OR is intended.
    • Use a single, consistent OR token (e.g., "or") instead of "||".
    • Use the DSL equality token (e.g., "==") and normalize pregnancy values to codes (NO/YES).
  • Example patch pattern to apply everywhere:
- "condition": "60<=age<180and90<=height<119and12<=weight<45||isPregnant=No",
+ "condition": "(60<=age<180 and 90<=height<119 and 12<=weight<45) or isPregnant==NO",

Apply the same normalization to all matched lines and re-run DSL/validation after changes.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"doseCriteria": [
{
"condition": "60<=age<180and90<=height<119and12<=weight<45andisPregnant=No",
"ProductVariants": [
{
"name": "Ivermectin 100mg",
"quantity": 1,
"productVariantId": "PVAR-2025-09-14-000582"
}
]
},
{
"condition": "60<=age<180and90<=height<119and12<=weight<45||isPregnant=No",
"ProductVariants": [
{
"name": "Ivermectin 100mg",
"quantity": 1,
"productVariantId": "PVAR-2025-09-14-000582"
}
]
},
{
"condition": "60<=age<180and120<=height<139and12<=weight<45andisPregnant=No",
"ProductVariants": [
{
"name": "Ivermectin 100mg",
"quantity": 1,
"productVariantId": "PVAR-2025-09-14-000582"
}
]
},
{
"condition": "60<=age<180and120<=height<139and12<=weight<45||isPregnant=No",
"ProductVariants": [
{
"name": "Ivermectin 100mg",
"quantity": 1,
"productVariantId": "PVAR-2025-09-14-000582"
}
]
},
{
"condition": "age>=180and140<=height<159and45<=weight<75andisPregnant=Yes",
"ProductVariants": [
{
"name": "Albendazole 400mg",
"quantity": 1,
"productVariantId": "PVAR-2025-09-14-000583"
}
]
},
{
"condition": "age>=180and140<=height<159and45<=weight<75andisPregnant=No",
"ProductVariants": [
{
"name": "Albendazole 400mg",
"quantity": 1,
"productVariantId": "PVAR-2025-09-14-000583"
}
]
},
{
"condition": "age>=180and140<=height<159and45<=weight<75||isPregnant=Yes",
"ProductVariants": [
{
"name": "Albendazole 400mg",
"quantity": 1,
"productVariantId": "PVAR-2025-09-14-000583"
}
]
},
{
"condition": "age>=180andheight>=159andweight>=75andisPregnant=Yes",
"ProductVariants": [
{
"name": "Albendazole 400mg",
"quantity": 1,
"productVariantId": "PVAR-2025-09-14-000583"
}
]
},
{
"condition": "age>=180andheight>=159andweight>=75andisPregnant=No",
"ProductVariants": [
{
"name": "Albendazole 400mg",
"quantity": 1,
"productVariantId": "PVAR-2025-09-14-000583"
}
]
},
{
"condition": "age>=180andheight>=159andweight>=75||isPregnant=No",
"ProductVariants": [
{
"name": "Albendazole 400mg",
"quantity": 1,
"productVariantId": "PVAR-2025-09-14-000583"
}
]
}
"doseCriteria": [
{
"condition": "60<=age<180and90<=height<119and12<=weight<45andisPregnant=No",
"ProductVariants": [
{
"name": "Ivermectin 100mg",
"quantity": 1,
"productVariantId": "PVAR-2025-09-14-000582"
}
]
},
{
"condition": "(60<=age<180 and 90<=height<119 and 12<=weight<45) or isPregnant==NO",
"ProductVariants": [
{
"name": "Ivermectin 100mg",
"quantity": 1,
"productVariantId": "PVAR-2025-09-14-000582"
}
]
},
{
"condition": "60<=age<180and120<=height<139and12<=weight<45andisPregnant=No",
"ProductVariants": [
{
"name": "Ivermectin 100mg",
"quantity": 1,
"productVariantId": "PVAR-2025-09-14-000582"
}
]
},
{
"condition": "60<=age<180and120<=height<139and12<=weight<45||isPregnant=No",
"ProductVariants": [
{
"name": "Ivermectin 100mg",
"quantity": 1,
"productVariantId": "PVAR-2025-09-14-000582"
}
]
},
{
"condition": "age>=180and140<=height<159and45<=weight<75andisPregnant=Yes",
"ProductVariants": [
{
"name": "Albendazole 400mg",
"quantity": 1,
"productVariantId": "PVAR-2025-09-14-000583"
}
]
},
{
"condition": "age>=180and140<=height<159and45<=weight<75andisPregnant=No",
"ProductVariants": [
{
"name": "Albendazole 400mg",
"quantity": 1,
"productVariantId": "PVAR-2025-09-14-000583"
}
]
},
{
"condition": "age>=180and140<=height<159and45<=weight<75||isPregnant=Yes",
"ProductVariants": [
{
"name": "Albendazole 400mg",
"quantity": 1,
"productVariantId": "PVAR-2025-09-14-000583"
}
]
},
{
"condition": "age>=180andheight>=159andweight>=75andisPregnant=Yes",
"ProductVariants": [
{
"name": "Albendazole 400mg",
"quantity": 1,
"productVariantId": "PVAR-2025-09-14-000583"
}
]
},
{
"condition": "age>=180andheight>=159andweight>=75andisPregnant=No",
"ProductVariants": [
{
"name": "Albendazole 400mg",
"quantity": 1,
"productVariantId": "PVAR-2025-09-14-000583"
}
]
},
{
"condition": "age>=180andheight>=159andweight>=75||isPregnant=No",
"ProductVariants": [
{
"name": "Albendazole 400mg",
"quantity": 1,
"productVariantId": "PVAR-2025-09-14-000583"
}
]
}
🤖 Prompt for AI Agents
In health/configs/Data/HCM-PROJECT-TYPES.projectTypes lines 16–116 (and
replicate across Oncho/NTD1 sets and the other reported lines 258, 278, 298,
328), the condition DSL mixes "and" with "||", uses single "=" for equality, and
inconsistent pregnancy literals; update each condition to (1) replace "||" with
a consistent OR token "or", (2) use the DSL equality operator "==" for
comparisons, (3) normalize pregnancy values to uppercase codes "YES" or "NO"
(e.g., isPregnant==NO), and (4) add parentheses to group terms where OR is
intended to ensure correct precedence; apply these transformations to every
matched condition and then re-run the DSL validator to confirm correctness.

Comment on lines +21 to +115
"name": "Ivermectin 100mg",
"quantity": 1,
"productVariantId": "PVAR-2025-09-14-000582"
}
]
},
{
"condition": "60<=age<180and90<=height<119and12<=weight<45||isPregnant=No",
"ProductVariants": [
{
"name": "Ivermectin 100mg",
"quantity": 1,
"productVariantId": "PVAR-2025-09-14-000582"
}
]
},
{
"condition": "60<=age<180and120<=height<139and12<=weight<45andisPregnant=No",
"ProductVariants": [
{
"name": "Ivermectin 100mg",
"quantity": 1,
"productVariantId": "PVAR-2025-09-14-000582"
}
]
},
{
"condition": "60<=age<180and120<=height<139and12<=weight<45||isPregnant=No",
"ProductVariants": [
{
"name": "Ivermectin 100mg",
"quantity": 1,
"productVariantId": "PVAR-2025-09-14-000582"
}
]
},
{
"condition": "age>=180and140<=height<159and45<=weight<75andisPregnant=Yes",
"ProductVariants": [
{
"name": "Albendazole 400mg",
"quantity": 1,
"productVariantId": "PVAR-2025-09-14-000583"
}
]
},
{
"condition": "age>=180and140<=height<159and45<=weight<75andisPregnant=No",
"ProductVariants": [
{
"name": "Albendazole 400mg",
"quantity": 1,
"productVariantId": "PVAR-2025-09-14-000583"
}
]
},
{
"condition": "age>=180and140<=height<159and45<=weight<75||isPregnant=Yes",
"ProductVariants": [
{
"name": "Albendazole 400mg",
"quantity": 1,
"productVariantId": "PVAR-2025-09-14-000583"
}
]
},
{
"condition": "age>=180andheight>=159andweight>=75andisPregnant=Yes",
"ProductVariants": [
{
"name": "Albendazole 400mg",
"quantity": 1,
"productVariantId": "PVAR-2025-09-14-000583"
}
]
},
{
"condition": "age>=180andheight>=159andweight>=75andisPregnant=No",
"ProductVariants": [
{
"name": "Albendazole 400mg",
"quantity": 1,
"productVariantId": "PVAR-2025-09-14-000583"
}
]
},
{
"condition": "age>=180andheight>=159andweight>=75||isPregnant=No",
"ProductVariants": [
{
"name": "Albendazole 400mg",
"quantity": 1,
"productVariantId": "PVAR-2025-09-14-000583"
}
]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Oncho delivery productVariantIds don’t exist in resources (mismatch).

Deliveries reference 000582/000583 but resources list 000579/000580. Align to prevent runtime lookups failing.

-                    "productVariantId": "PVAR-2025-09-14-000582"
+                    "productVariantId": "PVAR-2025-09-12-000579"
@@
-                    "productVariantId": "PVAR-2025-09-14-000582"
+                    "productVariantId": "PVAR-2025-09-12-000579"
@@
-                    "productVariantId": "PVAR-2025-09-14-000582"
+                    "productVariantId": "PVAR-2025-09-12-000579"
@@
-                    "productVariantId": "PVAR-2025-09-14-000582"
+                    "productVariantId": "PVAR-2025-09-12-000579"
@@
-                    "productVariantId": "PVAR-2025-09-14-000583"
+                    "productVariantId": "PVAR-2025-09-12-000580"
@@
-                    "productVariantId": "PVAR-2025-09-14-000583"
+                    "productVariantId": "PVAR-2025-09-12-000580"
@@
-                    "productVariantId": "PVAR-2025-09-14-000583"
+                    "productVariantId": "PVAR-2025-09-12-000580"
@@
-                    "productVariantId": "PVAR-2025-09-14-000583"
+                    "productVariantId": "PVAR-2025-09-12-000580"
@@
-                    "productVariantId": "PVAR-2025-09-14-000583"
+                    "productVariantId": "PVAR-2025-09-12-000580"
@@
-                    "productVariantId": "PVAR-2025-09-14-000583"
+                    "productVariantId": "PVAR-2025-09-12-000580"

Quick check for any other missing variant IDs:


🏁 Script executed:

#!/bin/bash
FILE=health/configs/Data/HCM-PROJECT-TYPES.projectTypes
jq -r '.[].resources[].productVariantId' "$FILE" | sort -u > /tmp/res_ids.txt
jq -r '.[].cycles[]?.deliveries[]?.doseCriteria[]?.ProductVariants[]?.productVariantId' "$FILE" | sort -u > /tmp/deliv_ids.txt
comm -13 /tmp/res_ids.txt /tmp/deliv_ids.txt | sed 's/^/Missing in resources: /'

Length of output: 89


Critical: deliveries reference missing productVariantIds — fix before merge

File: health/configs/Data/HCM-PROJECT-TYPES.projectTypes (lines 21–115)

jq shows deliveries reference PVAR-2025-09-14-000582 and PVAR-2025-09-14-000583 which are not present in resources. Update the deliveries to use existing resource IDs or add matching resource entries for these two productVariantIds to avoid runtime lookup failures.

🤖 Prompt for AI Agents
In health/configs/Data/HCM-PROJECT-TYPES.projectTypes around lines 21 to 115,
several delivery entries reference productVariantIds PVAR-2025-09-14-000582 and
PVAR-2025-09-14-000583 that do not exist in the resources list; update those
delivery entries to use valid existing productVariantIds or add new resource
entries with matching productVariantId, name, and metadata for each missing ID
so runtime lookups do not fail.

Comment on lines +136 to +139
"DISTRICT_SUPERVISOR": "3",
"NATIONAL_SUPERVISOR": "2",
"PROVINCIAL_SUPERVISOR": "1"
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

dashboardUrls are numeric strings; replace with valid routes.

Unlike other project types, these are placeholders and will break navigation.

Provide the actual DISTRICT/NATIONAL/PROVINCIAL paths (e.g., like Schisto/NTD1), or drop the block if optional.


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== .projectTypes files (repo) ==="
rg -n --hidden --no-ignore-vcs --glob '!node_modules' '\.projectTypes$' -S || true

echo
echo "=== occurrences of 'dashboardUrl' ==="
rg -n --hidden --no-ignore-vcs --glob '!node_modules' '"dashboardUrl"\s*:\s*"' -S || true

echo
echo "=== show health/configs/Data/HCM-PROJECT-TYPES.projectTypes (lines 1-300) ==="
if [ -f "health/configs/Data/HCM-PROJECT-TYPES.projectTypes" ]; then
  nl -ba -w4 -s': ' health/configs/Data/HCM-PROJECT-TYPES.projectTypes | sed -n '1,300p'
else
  echo "MISSING: health/configs/Data/HCM-PROJECT-TYPES.projectTypes"
fi

Length of output: 492


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "PWD: $(pwd)"
echo
echo "=== repo root listing (top) ==="
ls -la | sed -n '1,200p' || true

echo
echo "=== find .projectTypes files ==="
find . -type f -iname '*.projectTypes' -print || true

echo
echo "=== check specific file ==="
FILE="health/configs/Data/HCM-PROJECT-TYPES.projectTypes"
if [ -f "$FILE" ]; then
  echo "FOUND: $FILE"
  sed -n '1,300p' "$FILE"
else
  echo "MISSING: $FILE"
fi

echo
echo "=== search for 'dashboardUrl' occurrences ==="
grep -RIn --exclude-dir=node_modules --exclude-dir=.git '"dashboardUrl"' . || true

echo
echo "=== search for 'DISTRICT_SUPERVISOR' occurrences ==="
grep -RIn --exclude-dir=node_modules --exclude-dir=.git 'DISTRICT_SUPERVISOR' . || true

Length of output: 12885


Replace numeric dashboardUrls with real routes

dashboardUrls for projects Oncho, Schisto, and NTD1 in health/configs/Data/HCM-PROJECT-TYPES.projectTypes are numeric placeholders ("3","2","1") and will break navigation — replace with the actual route strings or remove the dashboardUrls block. (Placeholders found around lines 136, 221, 366; valid examples exist later in the file at ~417, 678, 784 and in micro-ui previewConfig.js.)

🤖 Prompt for AI Agents
In health/configs/Data/HCM-PROJECT-TYPES.projectTypes around lines 136-139 (and
also check the similar numeric placeholders at ~221 and ~366), the dashboardUrls
values are numeric placeholders ("3","2","1") which will break navigation;
replace each numeric value with the correct route string used elsewhere in this
file (see valid examples around ~417, ~678, ~784) or remove the dashboardUrls
block entirely for those projects, and verify consistency with the micro-ui
previewConfig.js routes so navigation points to the real route paths.

"mandatoryWaitSinceLastDeliveryInDays": null
}
],
"mandatoryWaitSinceLastCycleInDays": "30"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Use number, not string, for mandatory wait days.

Type consistency: elsewhere it’s null or a number; here it’s a string.

-        "mandatoryWaitSinceLastCycleInDays": "30"
+        "mandatoryWaitSinceLastCycleInDays": 30
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"mandatoryWaitSinceLastCycleInDays": "30"
"mandatoryWaitSinceLastCycleInDays": 30
🤖 Prompt for AI Agents
In health/configs/Data/HCM-PROJECT-TYPES.projectTypes around line 650, the
property "mandatoryWaitSinceLastCycleInDays" is set as a string ("30") but
should be a number or null for type consistency; change the value from the
quoted string to an unquoted numeric literal (30) so the config uses a number
instead of a string.

Comment on lines +682 to +686
"taskProcedure": [
"1 bednet is to be distributed per 2 household members.",
"If there are 4 household members, 2 bednets should be distributed.",
"If there are 5 household members, 3 bednets should be distributed."
],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

MR-DN taskProcedure content is for bednets, not SMC.

Either replace with correct SMC instructions or remove to avoid operator confusion.

-    "taskProcedure": [
-      "1 bednet is to be distributed per 2 household members.",
-      "If there are 4 household members, 2 bednets should be distributed.",
-      "If there are 5 household members, 3 bednets should be distributed."
-    ],
+    // TODO: Provide SMC-specific taskProcedure or omit this field

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In health/configs/Data/HCM-PROJECT-TYPES.projectTypes around lines 682 to 686,
the taskProcedure entries currently contain bednet distribution instructions but
this project type is for SMC; replace the bednet-specific lines with the correct
SMC taskProcedure instructions (or remove the property if no SMC-specific
procedure is required). Update the array to reflect the accurate SMC workflow
(e.g., dosing schedule, age/weight criteria, and administration steps) or delete
the key to avoid operator confusion, then run config validation to ensure
JSON/YAML structure remains valid.

Comment on lines +1 to +20
{
"type": "object",
"title": "Generated schema for Root",
"$schema": "http://json-schema.org/draft-07/schema#",
"required": [
"code",
"name"
],
"x-unique": [
"code"
],
"properties": {
"code": {
"type": "string"
},
"name": {
"type": "string"
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Tighten schema: enumerate values and forbid extras.

Codify allowed values and block stray keys.

 {
                 "type": "object",
                 "title": "Generated schema for Root",
                 "$schema": "http://json-schema.org/draft-07/schema#",
                 "required": [
                     "code",
                     "name"
                 ],
                 "x-unique": [
                     "code"
                 ],
+                "additionalProperties": false,
                 "properties": {
                     "code": {
-                        "type": "string"
+                        "type": "string",
+                        "enum": ["YES","NO"]
                     },
                     "name": {
-                        "type": "string"
+                        "type": "string",
+                        "enum": ["Yes","No"]
                     }
                 }
             }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{
"type": "object",
"title": "Generated schema for Root",
"$schema": "http://json-schema.org/draft-07/schema#",
"required": [
"code",
"name"
],
"x-unique": [
"code"
],
"properties": {
"code": {
"type": "string"
},
"name": {
"type": "string"
}
}
}
{
"type": "object",
"title": "Generated schema for Root",
"$schema": "http://json-schema.org/draft-07/schema#",
"required": [
"code",
"name"
],
"x-unique": [
"code"
],
"additionalProperties": false,
"properties": {
"code": {
"type": "string",
"enum": ["YES","NO"]
},
"name": {
"type": "string",
"enum": ["Yes","No"]
}
}
}
🤖 Prompt for AI Agents
In health/configs/Schemas/HCM-ADMIN-CONSOLE.isPregnant around lines 1–20,
tighten the schema by adding "additionalProperties": false at the root to forbid
stray keys and replace the loose "type": "string" definitions for "code" and
"name" with explicit "enum" arrays of allowed values (populate the enums with
the approved codes and names for this schema); keep the required and x-unique
entries as-is and ensure only the documented properties are permitted.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 10

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
health/configs/Schemas/HCM-ADMIN-CONSOLE.isPregnant (1)

1-21: Rename schema file to use .json and update references

  • Rename health/configs/Schemas/HCM-ADMIN-CONSOLE.isPregnant → health/configs/Schemas/HCM-ADMIN-CONSOLE.isPregnant.json (file parses as valid JSON).
  • Update all references to "HCM-ADMIN-CONSOLE.isPregnant" (e.g., health/configs/Data/HCM-ADMIN-CONSOLE.allAttributes — the "valuesSchema" entry) and search-replace any loaders that expect the exact filename.
📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e11ef66 and 95712e0.

⛔ Files ignored due to path filters (3)
  • health/configs/Data/HCM-ADMIN-CONSOLE.FormConfigTemplate.json is excluded by !**/*.json
  • health/configs/Data/HCM-ADMIN-CONSOLE.schemas.json is excluded by !**/*.json
  • health/configs/Data/HCM-ADMIN-CONSOLE.targetConfigs.json is excluded by !**/*.json
📒 Files selected for processing (4)
  • health/configs/Data/HCM-ADMIN-CONSOLE.allAttributes (1 hunks)
  • health/configs/Data/HCM-ADMIN-CONSOLE.isPregnant (1 hunks)
  • health/configs/Data/HCM-PROJECT-TYPES.projectTypes (1 hunks)
  • health/configs/Schemas/HCM-ADMIN-CONSOLE.isPregnant (1 hunks)
🔇 Additional comments (1)
health/configs/Data/HCM-ADMIN-CONSOLE.allAttributes (1)

96-101: Incorrect — 'LLIN-mz' and 'LLIN' are defined

Both "LLIN-mz" and "LLIN" appear in health/configs/Data/HCM-ADMIN-CONSOLE.allAttributes (lines 96–101); the memberCount references are valid.

Likely an incorrect or invalid review comment.

Comment on lines +17 to +25
"key": 2,
"code": "maxCount",
"i18nKey": "CAMPAIGN_MAXCOUNT_BEDNET_INDIVIDUAL_LABEL",
"projectTypes": [
"Bednets",
"DEFAULT"
],
"allowedOperators": []
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Duplicate key values will cause conflicts

Two different attributes (maxCount and type_of_structure) both use "key": 2. This will likely cause issues when the attributes are indexed or accessed by key.

Each attribute should have a unique key value. Consider renumbering to ensure uniqueness.

Also applies to: 79-91

🤖 Prompt for AI Agents
In health/configs/Data/HCM-ADMIN-CONSOLE.allAttributes around lines 17 to 25,
the attribute entry for "maxCount" is using a duplicate "key": 2 which conflicts
with another attribute ("type_of_structure"); update the "key" to a unique
integer not used elsewhere (and ensure the other attribute keeps a different
unique key), scan and renumber any other conflicting entries (including the one
referenced at lines 79-91) so every attribute has a distinct key, and validate
the file after renumbering to ensure no other duplicates remain.

Comment on lines +52 to +63
{
"key": 4,
"code": "height",
"i18nKey": "CAMPAIGN_ATTRIBUTE_HEIGHT",
"projectTypes": [
"DEFAULT",
"MR-DN",
"NTD1",
"Oncho",
"Schisto"
]
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Missing allowedOperators field for height attribute

The height attribute (lines 52-63) is missing the allowedOperators field that's present in all other attributes. This inconsistency could cause issues if the consuming code expects this field.

     "Oncho",
     "Schisto"
-  ]
+  ],
+  "allowedOperators": []
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{
"key": 4,
"code": "height",
"i18nKey": "CAMPAIGN_ATTRIBUTE_HEIGHT",
"projectTypes": [
"DEFAULT",
"MR-DN",
"NTD1",
"Oncho",
"Schisto"
]
},
{
"key": 4,
"code": "height",
"i18nKey": "CAMPAIGN_ATTRIBUTE_HEIGHT",
"projectTypes": [
"DEFAULT",
"MR-DN",
"NTD1",
"Oncho",
"Schisto"
],
"allowedOperators": []
},
🤖 Prompt for AI Agents
In health/configs/Data/HCM-ADMIN-CONSOLE.allAttributes around lines 52 to 63,
the "height" attribute is missing the allowedOperators field present on other
attributes; add an allowedOperators array consistent with the other attributes
(e.g., include the same set of operators used for numeric attributes in this
file) by inserting the allowedOperators property into the height object so
consumers expecting that field won't break.

Comment on lines +68 to +76
"projectTypes": [
"CO-DEL",
"MR-DN",
"POLIO",
"DEFAULT",
"NTD1",
"Oncho",
"Schisto"
],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Verify referenced project types exist

The age attribute references project types "CO-DEL" and "POLIO" which don't appear in the HCM-PROJECT-TYPES.projectTypes file.


🏁 Script executed:

#!/bin/bash
# Check if CO-DEL and POLIO project types are defined elsewhere
rg -l '"CO-DEL"|"POLIO"' health/configs/Data/

Length of output: 51


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Listing files under health/configs/Data/"
ls -la health/configs/Data/ || true

echo
echo "Searching for any file named 'HCM-PROJECT-TYPES.projectTypes' (case-sensitive)"
fd -HI 'HCM-PROJECT-TYPES.projectTypes' health/configs/Data || true

echo
echo "Search for files containing the key 'projectTypes' under health/configs/Data (show context)"
rg -n -C2 '\bprojectTypes\b' health/configs/Data/ || true

echo
echo "Search for bare occurrences of CO-DEL or POLIO (no quotes) under health/configs/Data (show context)"
rg -n -C2 '\bCO-DEL\b|\bPOLIO\b' health/configs/Data/ || true

echo
echo "If HCM-PROJECT-TYPES.projectTypes exists, print first 200 lines"
if [ -f health/configs/Data/HCM-PROJECT-TYPES.projectTypes ]; then
  sed -n '1,200p' health/configs/Data/HCM-PROJECT-TYPES.projectTypes
else
  echo "health/configs/Data/HCM-PROJECT-TYPES.projectTypes: not found"
fi

Length of output: 10865


CO-DEL and POLIO are referenced but not defined

health/configs/Data/HCM-ADMIN-CONSOLE.allAttributes (age attribute, lines 68–76) includes "CO-DEL" and "POLIO", but health/configs/Data/HCM-PROJECT-TYPES.projectTypes contains no entries for those codes — add definitions to HCM-PROJECT-TYPES.projectTypes or remove the references from the attribute.

🤖 Prompt for AI Agents
In health/configs/Data/HCM-ADMIN-CONSOLE.allAttributes around lines 68–76 the
age attribute references projectTypes "CO-DEL" and "POLIO" but those codes are
not defined in health/configs/Data/HCM-PROJECT-TYPES.projectTypes; either add
entries for "CO-DEL" and "POLIO" into HCM-PROJECT-TYPES.projectTypes with the
appropriate label/metadata consistent with existing project type entries, or
remove "CO-DEL" and "POLIO" from the projectTypes array in
HCM-ADMIN-CONSOLE.allAttributes so all referenced codes exist in
HCM-PROJECT-TYPES.projectTypes.

Comment on lines +1 to +10
[
{
"code": "NO",
"name": "No"
},
{
"code": "YES",
"name": "Yes"
}
]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

LGTM! Consider standardizing boolean value representation

The YES/NO options are correctly structured. However, consider using "true"/"false" for the codes to align with standard boolean representations, which could improve interoperability with other systems.

🤖 Prompt for AI Agents
In health/configs/Data/HCM-ADMIN-CONSOLE.isPregnant around lines 1 to 10, the
option codes use "YES"/"NO" which the reviewer suggests standardizing to
boolean-style "true"/"false"; update the "code" fields to use lowercase
true/false (or if system requires strings, use "true"/"false" as strings
consistently), ensure any consuming code or schema expecting boolean values is
updated/validated accordingly, and run a quick search for other config files to
keep representation consistent across the project.

Comment on lines +18 to +116
"condition": "60<=age<180and90<=height<119and12<=weight<45andisPregnant=No",
"ProductVariants": [
{
"name": "Ivermectin 100mg",
"quantity": 1,
"productVariantId": "PVAR-2025-09-14-000582"
}
]
},
{
"condition": "60<=age<180and90<=height<119and12<=weight<45||isPregnant=No",
"ProductVariants": [
{
"name": "Ivermectin 100mg",
"quantity": 1,
"productVariantId": "PVAR-2025-09-14-000582"
}
]
},
{
"condition": "60<=age<180and120<=height<139and12<=weight<45andisPregnant=No",
"ProductVariants": [
{
"name": "Ivermectin 100mg",
"quantity": 1,
"productVariantId": "PVAR-2025-09-14-000582"
}
]
},
{
"condition": "60<=age<180and120<=height<139and12<=weight<45||isPregnant=No",
"ProductVariants": [
{
"name": "Ivermectin 100mg",
"quantity": 1,
"productVariantId": "PVAR-2025-09-14-000582"
}
]
},
{
"condition": "age>=180and140<=height<159and45<=weight<75andisPregnant=Yes",
"ProductVariants": [
{
"name": "Albendazole 400mg",
"quantity": 1,
"productVariantId": "PVAR-2025-09-14-000583"
}
]
},
{
"condition": "age>=180and140<=height<159and45<=weight<75andisPregnant=No",
"ProductVariants": [
{
"name": "Albendazole 400mg",
"quantity": 1,
"productVariantId": "PVAR-2025-09-14-000583"
}
]
},
{
"condition": "age>=180and140<=height<159and45<=weight<75||isPregnant=Yes",
"ProductVariants": [
{
"name": "Albendazole 400mg",
"quantity": 1,
"productVariantId": "PVAR-2025-09-14-000583"
}
]
},
{
"condition": "age>=180andheight>=159andweight>=75andisPregnant=Yes",
"ProductVariants": [
{
"name": "Albendazole 400mg",
"quantity": 1,
"productVariantId": "PVAR-2025-09-14-000583"
}
]
},
{
"condition": "age>=180andheight>=159andweight>=75andisPregnant=No",
"ProductVariants": [
{
"name": "Albendazole 400mg",
"quantity": 1,
"productVariantId": "PVAR-2025-09-14-000583"
}
]
},
{
"condition": "age>=180andheight>=159andweight>=75||isPregnant=No",
"ProductVariants": [
{
"name": "Albendazole 400mg",
"quantity": 1,
"productVariantId": "PVAR-2025-09-14-000583"
}
]
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Critical: Invalid logical operators in dose criteria conditions

The dose criteria conditions contain malformed logical expressions with || operators that don't make semantic sense. For example:

  • Line 28: "60<=age<180and90<=height<119and12<=weight<45||isPregnant=No" - The OR operator with just isPregnant=No doesn't provide a complete alternative condition
  • Line 48: Similar issue with incomplete OR conditions

These appear to be copy-paste errors or incomplete conditions that could cause incorrect drug dosing decisions.

Apply this pattern fix throughout the file:

-"condition": "60<=age<180and90<=height<119and12<=weight<45||isPregnant=No",
+"condition": "60<=age<180and90<=height<119and12<=weight<45andisPregnant=No",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"condition": "60<=age<180and90<=height<119and12<=weight<45andisPregnant=No",
"ProductVariants": [
{
"name": "Ivermectin 100mg",
"quantity": 1,
"productVariantId": "PVAR-2025-09-14-000582"
}
]
},
{
"condition": "60<=age<180and90<=height<119and12<=weight<45||isPregnant=No",
"ProductVariants": [
{
"name": "Ivermectin 100mg",
"quantity": 1,
"productVariantId": "PVAR-2025-09-14-000582"
}
]
},
{
"condition": "60<=age<180and120<=height<139and12<=weight<45andisPregnant=No",
"ProductVariants": [
{
"name": "Ivermectin 100mg",
"quantity": 1,
"productVariantId": "PVAR-2025-09-14-000582"
}
]
},
{
"condition": "60<=age<180and120<=height<139and12<=weight<45||isPregnant=No",
"ProductVariants": [
{
"name": "Ivermectin 100mg",
"quantity": 1,
"productVariantId": "PVAR-2025-09-14-000582"
}
]
},
{
"condition": "age>=180and140<=height<159and45<=weight<75andisPregnant=Yes",
"ProductVariants": [
{
"name": "Albendazole 400mg",
"quantity": 1,
"productVariantId": "PVAR-2025-09-14-000583"
}
]
},
{
"condition": "age>=180and140<=height<159and45<=weight<75andisPregnant=No",
"ProductVariants": [
{
"name": "Albendazole 400mg",
"quantity": 1,
"productVariantId": "PVAR-2025-09-14-000583"
}
]
},
{
"condition": "age>=180and140<=height<159and45<=weight<75||isPregnant=Yes",
"ProductVariants": [
{
"name": "Albendazole 400mg",
"quantity": 1,
"productVariantId": "PVAR-2025-09-14-000583"
}
]
},
{
"condition": "age>=180andheight>=159andweight>=75andisPregnant=Yes",
"ProductVariants": [
{
"name": "Albendazole 400mg",
"quantity": 1,
"productVariantId": "PVAR-2025-09-14-000583"
}
]
},
{
"condition": "age>=180andheight>=159andweight>=75andisPregnant=No",
"ProductVariants": [
{
"name": "Albendazole 400mg",
"quantity": 1,
"productVariantId": "PVAR-2025-09-14-000583"
}
]
},
{
"condition": "age>=180andheight>=159andweight>=75||isPregnant=No",
"ProductVariants": [
{
"name": "Albendazole 400mg",
"quantity": 1,
"productVariantId": "PVAR-2025-09-14-000583"
}
]
}
"condition": "60<=age<180and90<=height<119and12<=weight<45andisPregnant=No",
"ProductVariants": [
{
"name": "Ivermectin 100mg",
"quantity": 1,
"productVariantId": "PVAR-2025-09-14-000582"
}
]
},
{
"condition": "60<=age<180and90<=height<119and12<=weight<45andisPregnant=No",
"ProductVariants": [
{
"name": "Ivermectin 100mg",
"quantity": 1,
"productVariantId": "PVAR-2025-09-14-000582"
}
]
},
{
"condition": "60<=age<180and120<=height<139and12<=weight<45andisPregnant=No",
"ProductVariants": [
{
"name": "Ivermectin 100mg",
"quantity": 1,
"productVariantId": "PVAR-2025-09-14-000582"
}
]
},
{
"condition": "60<=age<180and120<=height<139and12<=weight<45andisPregnant=No",
"ProductVariants": [
{
"name": "Ivermectin 100mg",
"quantity": 1,
"productVariantId": "PVAR-2025-09-14-000582"
}
]
},
{
"condition": "age>=180and140<=height<159and45<=weight<75andisPregnant=Yes",
"ProductVariants": [
{
"name": "Albendazole 400mg",
"quantity": 1,
"productVariantId": "PVAR-2025-09-14-000583"
}
]
},
{
"condition": "age>=180and140<=height<159and45<=weight<75andisPregnant=No",
"ProductVariants": [
{
"name": "Albendazole 400mg",
"quantity": 1,
"productVariantId": "PVAR-2025-09-14-000583"
}
]
},
{
"condition": "age>=180and140<=height<159and45<=weight<75andisPregnant=Yes",
"ProductVariants": [
{
"name": "Albendazole 400mg",
"quantity": 1,
"productVariantId": "PVAR-2025-09-14-000583"
}
]
},
{
"condition": "age>=180andheight>=159andweight>=75andisPregnant=Yes",
"ProductVariants": [
{
"name": "Albendazole 400mg",
"quantity": 1,
"productVariantId": "PVAR-2025-09-14-000583"
}
]
},
{
"condition": "age>=180andheight>=159andweight>=75andisPregnant=No",
"ProductVariants": [
{
"name": "Albendazole 400mg",
"quantity": 1,
"productVariantId": "PVAR-2025-09-14-000583"
}
]
},
{
"condition": "age>=180andheight>=159andweight>=75andisPregnant=No",
"ProductVariants": [
{
"name": "Albendazole 400mg",
"quantity": 1,
"productVariantId": "PVAR-2025-09-14-000583"
}
]
}
🤖 Prompt for AI Agents
In health/configs/Data/HCM-PROJECT-TYPES.projectTypes around lines 18–116,
several "condition" expressions use a stray OR operator (||) with only
isPregnant=No/Yes on the right-hand side (e.g.
"60<=age<180and90<=height<119and12<=weight<45||isPregnant=No"), which produces
an incomplete logical clause; replace those malformed OR expressions with the
intended AND conjunctions (i.e., change "||isPregnant=No" or "||isPregnant=Yes"
to "andisPregnant=No" or "andisPregnant=Yes") or remove the redundant duplicate
condition blocks so each condition is a complete boolean expression consistently
using "and" between comparisons.

Comment on lines +123 to +133
"resources": [
{
"name": "Ivermectin 100mg",
"productVariantId": "PVAR-2025-09-12-000579",
"isBaseUnitVariant": true
},
{
"name": "Albendazole 400mg",
"productVariantId": "PVAR-2025-09-12-000580",
"isBaseUnitVariant": true
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Product variant ID mismatch in resources section

The resources section uses different product variant IDs than those referenced in the dose criteria:

  • Dose criteria use: "PVAR-2025-09-14-000582" (Ivermectin) and "PVAR-2025-09-14-000583" (Albendazole)
  • Resources section lists: "PVAR-2025-09-12-000579" and "PVAR-2025-09-12-000580"

This mismatch could cause product lookup failures.


🏁 Script executed:

#!/bin/bash
# Check for all product variant IDs used in this file
rg -o 'PVAR-[0-9]{4}-[0-9]{2}-[0-9]{2}-[0-9]{6}' health/configs/Data/HCM-PROJECT-TYPES.projectTypes | sort -u

Length of output: 344


Product variant ID mismatch in resources section

health/configs/Data/HCM-PROJECT-TYPES.projectTypes: resources (lines 123–133) list PVAR-2025-09-12-000579 and PVAR-2025-09-12-000580, while dose criteria reference PVAR-2025-09-14-000582 and PVAR-2025-09-14-000583 — make these IDs consistent (update resources or dose criteria) to avoid product lookup failures.

🤖 Prompt for AI Agents
In health/configs/Data/HCM-PROJECT-TYPES.projectTypes around lines 123–133 the
productVariantId values in the resources array (PVAR-2025-09-12-000579,
PVAR-2025-09-12-000580) do not match the IDs used by the dose criteria
(PVAR-2025-09-14-000582, PVAR-2025-09-14-000583); update either the resources
entries to use PVAR-2025-09-14-000582 and PVAR-2025-09-14-000583 or update the
dose criteria to reference the 2025-09-12 IDs so both sections reference the
same productVariantIds, then search the repo for these IDs and update any other
references and validate the JSON to avoid lookup failures.

Comment on lines +258 to +285
"condition": "60<=age<180and90<=height<119||isPregnant=No",
"ProductVariants": [
{
"name": "Ivermectin 100mg",
"quantity": 1,
"productVariantId": "PVAR-2025-09-12-000579"
}
]
},
{
"condition": "60<=age<180and120<=height<139andisPregnant=No",
"ProductVariants": [
{
"name": "Ivermectin 100mg",
"quantity": 1,
"productVariantId": "PVAR-2025-09-12-000579"
}
]
},
{
"condition": "60<=age<180and120<=height<139||isPregnant=No",
"ProductVariants": [
{
"name": "Ivermectin 100mg",
"quantity": 1,
"productVariantId": "PVAR-2025-09-12-000579"
}
]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Duplicate conditions with OR operator issues in NTD1 campaign

Similar to the Oncho campaign, the NTD1 campaign has malformed logical conditions with incomplete OR operators at lines 258, 278, 298, 327, and others.

🤖 Prompt for AI Agents
In health/configs/Data/HCM-PROJECT-TYPES.projectTypes around lines 258-285, the
condition expressions are malformed and duplicated (e.g.,
"60<=age<180and120<=height<139||isPregnant=No" and repeated blocks); update each
affected condition to a consistent, valid logical syntax (use explicit operators
and spacing such as "60 <= age < 180 and 120 <= height < 139 and isPregnant =
No" or, if OR is intended, use parentheses to clarify precedence like "(60 <=
age < 180 and 120 <= height < 139) or isPregnant = No"), remove exact duplicate
condition blocks, and audit the other reported lines (278, 298, 327, etc.) to
apply the same correction pattern so all conditions are syntactically consistent
and non-duplicative.

"mandatoryWaitSinceLastDeliveryInDays": null
}
],
"mandatoryWaitSinceLastCycleInDays": "30"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Type inconsistency: String value for numeric field

The mandatoryWaitSinceLastCycleInDays field is set to the string "30" instead of the numeric value 30. This is inconsistent with other occurrences where it's either null or should be numeric.

Apply this fix:

-"mandatoryWaitSinceLastCycleInDays": "30"
+"mandatoryWaitSinceLastCycleInDays": 30
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"mandatoryWaitSinceLastCycleInDays": "30"
"mandatoryWaitSinceLastCycleInDays": 30
🤖 Prompt for AI Agents
In health/configs/Data/HCM-PROJECT-TYPES.projectTypes around line 650, the field
mandatoryWaitSinceLastCycleInDays is set as the string "30" but should be a
numeric value; change the value from the quoted string to an unquoted number
(30) so the field is a number (or null where appropriate) to match the schema
used elsewhere.

Comment on lines +683 to +686
"1 bednet is to be distributed per 2 household members.",
"If there are 4 household members, 2 bednets should be distributed.",
"If there are 5 household members, 3 bednets should be distributed."
],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Inappropriate task procedure content for MR-DN campaign

The task procedure for the MR-DN (Multi Round) campaign incorrectly references bednet distribution instructions, which are not relevant to an SP/AQ drug campaign.

The task procedure should provide instructions relevant to SP/AQ administration, not bednet distribution.

🤖 Prompt for AI Agents
In health/configs/Data/HCM-PROJECT-TYPES.projectTypes around lines 683 to 686,
the MR-DN task procedure wrongly contains bednet distribution instructions;
replace these lines with SP/AQ-specific procedure text. Remove the bednet
examples and insert concise SP/AQ guidance: eligibility criteria, correct dosing
by age/weight, administration schedule (timing and repeat rounds),
contraindications and warning signs, required documentation/consent,
safety/monitoring steps and disposal of unused medication, and a reference to
the official protocol. Ensure wording matches the style of surrounding entries
and keeps examples relevant (e.g., dosing examples, record fields) without any
bednet references.

"id": 1,
"doseCriteria": [
{
"condition": "type_of_structure==CEMENTortype_of_structure==CLAYortype_of_structure==REEDS",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Complex condition syntax needs spacing for clarity

The condition uses or without spaces, making it harder to parse: "type_of_structure==CEMENTortype_of_structure==CLAYortype_of_structure==REEDS"

Consider adding spaces for better readability.

-"condition": "type_of_structure==CEMENTortype_of_structure==CLAYortype_of_structure==REEDS",
+"condition": "type_of_structure==CEMENT or type_of_structure==CLAY or type_of_structure==REEDS",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"condition": "type_of_structure==CEMENTortype_of_structure==CLAYortype_of_structure==REEDS",
"condition": "type_of_structure==CEMENT or type_of_structure==CLAY or type_of_structure==REEDS",
🤖 Prompt for AI Agents
In health/configs/Data/HCM-PROJECT-TYPES.projectTypes around line 709, the
condition string concatenates comparison expressions without spaces around the
`or` operators which reduces readability; update the condition so each
comparison is separated from the `or` operator by spaces (e.g., put a space
before and after each `or`), ensuring the three comparisons remain the same but
are clearly delimited for readability and maintainability.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants