new-site/scripts/check_npi_slug_consistency.sh

23 lines
1.3 KiB
Bash
Executable file

#!/usr/bin/env bash
# Verify every NPI healthcare slug exists in all 5 wiring places.
set -u
SLUGS="npi-revalidation npi-reactivation nppes-update medicare-enrollment oig-sam-screening provider-compliance-bundle"
FAIL=0
for s in $SLUGS; do
# 1. API COMPLIANCE_SERVICES
grep -q "\"$s\"" api/src/routes/compliance-orders.ts || { echo "MISSING in compliance-orders.ts: $s"; FAIL=1; }
# 2. intake_manifest (both INTAKE_MANIFEST + SERVICE_META => expect >=2 hits)
n=$(grep -c "\"$s\"" site/src/lib/intake_manifest.ts)
[ "$n" -ge 2 ] || { echo "intake_manifest.ts has $n hits (<2) for: $s"; FAIL=1; }
# 3. worker handler registration
grep -q "$s" scripts/workers/services/__init__.py || { echo "MISSING in worker __init__.py: $s"; FAIL=1; }
# 4. ERPNext item.json (uppercase code)
U=$(echo "$s" | tr 'a-z-' 'A-Z_')
grep -qi "$U\|$s" performancewest_erpnext/performancewest_erpnext/fixtures/item.json || { echo "MISSING in item.json: $s ($U)"; FAIL=1; }
# 5. orders.py portal label
grep -q "$s" performancewest_erpnext/performancewest_erpnext/www/orders.py || { echo "MISSING in orders.py: $s"; FAIL=1; }
# 6. order page exists
[ -f "site/src/pages/order/$s.astro" ] || { echo "MISSING order page: $s.astro"; FAIL=1; }
done
[ "$FAIL" -eq 0 ] && echo "ALL 6 SLUGS CONSISTENT across all places" || echo "CONSISTENCY FAILURES ABOVE"
exit $FAIL