-
Notifications
You must be signed in to change notification settings - Fork 19
Create workerRates.json #161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
WalkthroughIntroduces a new MDMS data file mdms/HCM/v1.7/workerRates.json containing WORKER_RATES entries for the HCM module under tenant "mz", detailing campaign and training rate structures by skillCode, rateBreakup (FOOD, TRAVEL, PER_DAY), currency (USD), eventType, and campaignId. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. ✨ Finishing Touches🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Nitpick comments (2)
mdms/HCM/v1.7/workerRates.json (2)
86-164: Duplicate campaign name “SMC Demo” (different campaignId) — confirm intent.Two entries share the same name but have different campaignIds and identical rates. If consumers look up campaigns by name, this can cause ambiguity. If the intent is to track separate runs of the same campaign, consider adding a disambiguator (e.g., date, region) to name or introducing a separate displayName vs internal name.
Would you like a quick patch to rename one of these for clarity (e.g., “SMC Demo (Run 2)”)?
166-260: Optional: normalize and future-proof the data model.If the platform permits, consider:
- Adding effectiveFrom/effectiveTo to each campaign to support temporal changes without overwriting past rates.
- Enforcing skillCode uniqueness per campaign via CI checks.
- Defining a schema (JSON Schema) for WORKER_RATES to validate enum values and required fields.
I can open a follow-up issue and provide a JSON Schema + CI validation step.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
mdms/HCM/v1.7/workerRates.json(1 hunks)
🔇 Additional comments (3)
mdms/HCM/v1.7/workerRates.json (3)
5-84: Rates block for “SMC Demo” looks consistent and well-formed.rateBreakup keys are consistent, numeric values are valid, and campaignId is present.
81-83: Verify currency choice (“USD”) for tenant “mz”.All entries use currency USD. If this tenant is Mozambique (“mz”), confirm whether rates should be in MZN instead. If USD is intentional, ensure UI/exports don’t auto-format to local currency.
Would you like a PR comment bot check that flags mismatches between tenant and currency?
Also applies to: 161-163, 257-259, 313-315
262-316: TRAINING event rates block looks coherent.Structure matches CAMPAIGN blocks, eventType is correctly set to TRAINING, and values are plausible.
| { | ||
| "tenantId": "mz", | ||
| "moduleName": "HCM", | ||
| "WORKER_RATES": [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Schema alignment check recommended.
The top-level layout { tenantId, moduleName, WORKER_RATES: [] } looks reasonable, but MDMS integrations can be strict. Please verify this file conforms to the HCM v1.7 schema (field names, enums like eventType, and rateBreakup keys: FOOD/TRAVEL/PER_DAY).
Run this script to surface duplicate skillCodes per campaign and repeated names; it also sanity-checks key shapes.
🏁 Script executed:
#!/bin/bash
set -euo pipefail
FILE="mdms/HCM/v1.7/workerRates.json"
python - << 'PY'
import json, sys, collections, re
path = "mdms/HCM/v1.7/workerRates.json"
with open(path) as f:
data = json.load(f)
errors = 0
# Basic shape
required_top = {"tenantId","moduleName","WORKER_RATES"}
missing = required_top - set(data.keys())
if missing:
errors += 1
print(f"[ERROR] Missing top-level keys: {sorted(missing)}")
# Check campaigns
seen_names = collections.Counter()
seen_ids = set()
for idx, camp in enumerate(data.get("WORKER_RATES", []), 1):
name = camp.get("name")
cid = camp.get("campaignId")
seen_names[name] += 1
if cid in seen_ids:
errors += 1
print(f"[ERROR] Duplicate campaignId at index {idx}: {cid}")
seen_ids.add(cid)
# Check currency presence and basic type
if "currency" not in camp or not isinstance(camp["currency"], str):
errors += 1
print(f"[ERROR] Campaign {name}: missing/invalid currency")
# eventType value sanity check
et = camp.get("eventType")
if et not in {"CAMPAIGN","TRAINING"}:
errors += 1
print(f"[ERROR] Campaign {name}: unexpected eventType={et}")
# Duplicate skillCode detection and rateBreakup keys
skill_counts = collections.Counter()
for r in camp.get("rates", []):
sc = r.get("skillCode")
rb = r.get("rateBreakup", {})
skill_counts[sc] += 1
expected_keys = {"FOOD","TRAVEL","PER_DAY"}
if set(rb.keys()) != expected_keys:
errors += 1
print(f"[ERROR] Campaign {name}, skill {sc}: rateBreakup keys {sorted(rb.keys())} != {sorted(expected_keys)}")
# Number sanity
for k,v in rb.items():
if not isinstance(v, (int, float)) or v < 0:
errors += 1
print(f"[ERROR] Campaign {name}, skill {sc}: {k} invalid value {v}")
dups = [s for s,c in skill_counts.items() if c>1]
if dups:
errors += 1
print(f"[ERROR] Campaign {name}: duplicate skillCodes: {dups}")
# Report duplicate names
dup_names = [n for n,c in seen_names.items() if c>1 and n is not None]
if dup_names:
print(f"[WARN] Duplicate campaign names detected: {dup_names} (ensure consumers select by campaignId)")
if errors == 0:
print("OK: No schema/duplicate issues detected by this basic check.")
else:
print(f"Found {errors} issue(s).")
PYLength of output: 281
Duplicate entries detected in mdms/HCM/v1.7/workerRates.json – action required
- Duplicate skillCodes in campaign
SMC_campaign_payments_test_2:
–HEALTH_FACILITY_SUPERVISORappears more than once in theratesarray. Ensure eachskillCodeis unique per campaign. - Duplicate campaign name
SMC Demoacross entries:
– Either rename one of the campaigns or confirm that consumers always disambiguate bycampaignId.
No other schema/key‐shape issues were flagged (top‐level keys, eventType enums, rateBreakup keys conform). Once duplicates are resolved, please re‐run validation to confirm full HCM v1.7 compliance.
🤖 Prompt for AI Agents
In mdms/HCM/v1.7/workerRates.json around lines 1 to 4, there are duplicate
entries causing schema problems: within campaign "SMC_campaign_payments_test_2"
the skillCode "HEALTH_FACILITY_SUPERVISOR" appears multiple times in the rates
array (ensure each skillCode is unique per campaign by removing or merging
duplicates and consolidating rateBreakup entries), and the campaign display name
"SMC Demo" is used more than once (rename one of the duplicate campaigns or
otherwise disambiguate by ensuring unique campaignId values); after making these
changes, re-run the v1.7 HCM validation to confirm compliance.
| "name": "SMC_campaign_payments_test_2", | ||
| "rates": [ | ||
| { | ||
| "skillCode": "CDD", | ||
| "rateBreakup": { | ||
| "FOOD": 2, | ||
| "TRAVEL": 1, | ||
| "PER_DAY": 2 | ||
| } | ||
| }, | ||
| { | ||
| "skillCode": "HEALTH_FACILITY_SUPERVISOR", | ||
| "rateBreakup": { | ||
| "FOOD": 4.5, | ||
| "TRAVEL": 5, | ||
| "PER_DAY": 5.5 | ||
| } | ||
| }, | ||
| { | ||
| "skillCode": "PROXIMITY_SUPERVISOR", | ||
| "rateBreakup": { | ||
| "FOOD": 3.5, | ||
| "TRAVEL": 5, | ||
| "PER_DAY": 11.5 | ||
| } | ||
| }, | ||
| { | ||
| "skillCode": "PAYMENT_SUPERVISOR", | ||
| "rateBreakup": { | ||
| "FOOD": 6, | ||
| "TRAVEL": 6.5, | ||
| "PER_DAY": 12.5 | ||
| } | ||
| }, | ||
| { | ||
| "skillCode": "MUNICIPAL_ADVISOR", | ||
| "rateBreakup": { | ||
| "FOOD": 6.5, | ||
| "TRAVEL": 7, | ||
| "PER_DAY": 9.5 | ||
| } | ||
| }, | ||
| { | ||
| "skillCode": "NATIONAL_SUPERVISOR", | ||
| "rateBreakup": { | ||
| "FOOD": 8, | ||
| "TRAVEL": 8, | ||
| "PER_DAY": 12 | ||
| } | ||
| }, | ||
| { | ||
| "skillCode": "DISTRICT_SUPERVISOR", | ||
| "rateBreakup": { | ||
| "FOOD": 6, | ||
| "TRAVEL": 8, | ||
| "PER_DAY": 10 | ||
| } | ||
| }, | ||
| { | ||
| "skillCode": "WAREHOUSE_MANAGER", | ||
| "rateBreakup": { | ||
| "FOOD": 5.5, | ||
| "TRAVEL": 6.5, | ||
| "PER_DAY": 10 | ||
| } | ||
| }, | ||
| { | ||
| "skillCode": "HEALTH_FACILITY_SUPERVISOR", | ||
| "rateBreakup": { | ||
| "FOOD": 5.5, | ||
| "TRAVEL": 6.5, | ||
| "PER_DAY": 11.5 | ||
| } | ||
| }, | ||
| { | ||
| "skillCode": "DISTRIBUTOR", | ||
| "rateBreakup": { | ||
| "FOOD": 5.5, | ||
| "TRAVEL": 6.5, | ||
| "PER_DAY": 12.5 | ||
| } | ||
| }, | ||
| { | ||
| "skillCode": "HEALTH_FACILITY_WORKER", | ||
| "rateBreakup": { | ||
| "FOOD": 5.5, | ||
| "TRAVEL": 6.5, | ||
| "PER_DAY": 9.5 | ||
| } | ||
| } | ||
| ], | ||
| "currency": "USD", | ||
| "eventType": "CAMPAIGN", | ||
| "campaignId": "c2220d30-aafb-474e-97c6-8f5a4f6da7b0" | ||
| }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicate skillCode within the same campaign (“HEALTH_FACILITY_SUPERVISOR”) with conflicting rates.
In “SMC_campaign_payments_test_2”, HEALTH_FACILITY_SUPERVISOR appears twice (Lines 177–183 and 233–239) with different rateBreakup values. This is likely a data bug; downstream code may pick one arbitrarily or the latter silently overrides in transformations, leading to hard-to-debug payment inconsistencies.
Decide which set is correct and remove the other, or merge according to business rules. Below are two alternative diffs to remove one of the duplicates.
Option A: Keep the later, higher values (Lines 233–239), remove the earlier block:
@@
- {
- "skillCode": "HEALTH_FACILITY_SUPERVISOR",
- "rateBreakup": {
- "FOOD": 4.5,
- "TRAVEL": 5,
- "PER_DAY": 5.5
- }
- },Option B: Keep the earlier values (Lines 177–183), remove the later block:
@@
- {
- "skillCode": "HEALTH_FACILITY_SUPERVISOR",
- "rateBreakup": {
- "FOOD": 5.5,
- "TRAVEL": 6.5,
- "PER_DAY": 11.5
- }
- },Additionally, consider adding a pre-commit validation to fail builds on duplicate skillCodes within a campaign. I can provide a script.
📝 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.
| "name": "SMC_campaign_payments_test_2", | |
| "rates": [ | |
| { | |
| "skillCode": "CDD", | |
| "rateBreakup": { | |
| "FOOD": 2, | |
| "TRAVEL": 1, | |
| "PER_DAY": 2 | |
| } | |
| }, | |
| { | |
| "skillCode": "HEALTH_FACILITY_SUPERVISOR", | |
| "rateBreakup": { | |
| "FOOD": 4.5, | |
| "TRAVEL": 5, | |
| "PER_DAY": 5.5 | |
| } | |
| }, | |
| { | |
| "skillCode": "PROXIMITY_SUPERVISOR", | |
| "rateBreakup": { | |
| "FOOD": 3.5, | |
| "TRAVEL": 5, | |
| "PER_DAY": 11.5 | |
| } | |
| }, | |
| { | |
| "skillCode": "PAYMENT_SUPERVISOR", | |
| "rateBreakup": { | |
| "FOOD": 6, | |
| "TRAVEL": 6.5, | |
| "PER_DAY": 12.5 | |
| } | |
| }, | |
| { | |
| "skillCode": "MUNICIPAL_ADVISOR", | |
| "rateBreakup": { | |
| "FOOD": 6.5, | |
| "TRAVEL": 7, | |
| "PER_DAY": 9.5 | |
| } | |
| }, | |
| { | |
| "skillCode": "NATIONAL_SUPERVISOR", | |
| "rateBreakup": { | |
| "FOOD": 8, | |
| "TRAVEL": 8, | |
| "PER_DAY": 12 | |
| } | |
| }, | |
| { | |
| "skillCode": "DISTRICT_SUPERVISOR", | |
| "rateBreakup": { | |
| "FOOD": 6, | |
| "TRAVEL": 8, | |
| "PER_DAY": 10 | |
| } | |
| }, | |
| { | |
| "skillCode": "WAREHOUSE_MANAGER", | |
| "rateBreakup": { | |
| "FOOD": 5.5, | |
| "TRAVEL": 6.5, | |
| "PER_DAY": 10 | |
| } | |
| }, | |
| { | |
| "skillCode": "HEALTH_FACILITY_SUPERVISOR", | |
| "rateBreakup": { | |
| "FOOD": 5.5, | |
| "TRAVEL": 6.5, | |
| "PER_DAY": 11.5 | |
| } | |
| }, | |
| { | |
| "skillCode": "DISTRIBUTOR", | |
| "rateBreakup": { | |
| "FOOD": 5.5, | |
| "TRAVEL": 6.5, | |
| "PER_DAY": 12.5 | |
| } | |
| }, | |
| { | |
| "skillCode": "HEALTH_FACILITY_WORKER", | |
| "rateBreakup": { | |
| "FOOD": 5.5, | |
| "TRAVEL": 6.5, | |
| "PER_DAY": 9.5 | |
| } | |
| } | |
| ], | |
| "currency": "USD", | |
| "eventType": "CAMPAIGN", | |
| "campaignId": "c2220d30-aafb-474e-97c6-8f5a4f6da7b0" | |
| }, | |
| "rates": [ | |
| { | |
| "skillCode": "CDD", | |
| "rateBreakup": { | |
| "FOOD": 2, | |
| "TRAVEL": 1, | |
| "PER_DAY": 2 | |
| } | |
| }, | |
| { | |
| "skillCode": "PROXIMITY_SUPERVISOR", | |
| "rateBreakup": { | |
| "FOOD": 3.5, | |
| "TRAVEL": 5, | |
| "PER_DAY": 11.5 | |
| } | |
| }, | |
| { | |
| "skillCode": "PAYMENT_SUPERVISOR", | |
| "rateBreakup": { | |
| "FOOD": 6, | |
| "TRAVEL": 6.5, | |
| "PER_DAY": 12.5 | |
| } | |
| }, | |
| { | |
| "skillCode": "MUNICIPAL_ADVISOR", | |
| "rateBreakup": { | |
| "FOOD": 6.5, | |
| "TRAVEL": 7, | |
| "PER_DAY": 9.5 | |
| } | |
| }, | |
| { | |
| "skillCode": "NATIONAL_SUPERVISOR", | |
| "rateBreakup": { | |
| "FOOD": 8, | |
| "TRAVEL": 8, | |
| "PER_DAY": 12 | |
| } | |
| }, | |
| { | |
| "skillCode": "DISTRICT_SUPERVISOR", | |
| "rateBreakup": { | |
| "FOOD": 6, | |
| "TRAVEL": 8, | |
| "PER_DAY": 10 | |
| } | |
| }, | |
| { | |
| "skillCode": "WAREHOUSE_MANAGER", | |
| "rateBreakup": { | |
| "FOOD": 5.5, | |
| "TRAVEL": 6.5, | |
| "PER_DAY": 10 | |
| } | |
| }, | |
| { | |
| "skillCode": "HEALTH_FACILITY_SUPERVISOR", | |
| "rateBreakup": { | |
| "FOOD": 5.5, | |
| "TRAVEL": 6.5, | |
| "PER_DAY": 11.5 | |
| } | |
| }, | |
| { | |
| "skillCode": "DISTRIBUTOR", | |
| "rateBreakup": { | |
| "FOOD": 5.5, | |
| "TRAVEL": 6.5, | |
| "PER_DAY": 12.5 | |
| } | |
| }, | |
| { | |
| "skillCode": "HEALTH_FACILITY_WORKER", | |
| "rateBreakup": { | |
| "FOOD": 5.5, | |
| "TRAVEL": 6.5, | |
| "PER_DAY": 9.5 | |
| } | |
| } | |
| ], |
🤖 Prompt for AI Agents
In mdms/HCM/v1.7/workerRates.json around lines 166–260 there is a duplicate
skillCode "HEALTH_FACILITY_SUPERVISOR" with conflicting rateBreakup values;
decide which rate set is authoritative (Option A: keep the later higher values,
Option B: keep the earlier values), remove the other entry (or merge according
to business rules), fix any trailing commas so the JSON array remains valid, and
add a simple pre-commit or CI validation that fails on duplicate skillCode
entries within the same campaign to prevent regressions.
Summary by CodeRabbit