Compliance Scoring
Parley computes a 0-100 compliance risk score for every facility based on its violation history, penalty severity, inspection frequency, and current compliance status.
How it works
The compliance score is a rule-based composite metric that aggregates five weighted factors into a single number. A score of 0 indicates the worst compliance profile; 100 indicates clean compliance.
The scoring model is deterministic and rule-based -- not ML. Given the same input data, the score is always the same. Scores are recomputed on every data ingestion (weekly).
Score Breakdown
Each factor is scored 0-100, then combined with the following weights:
violation_recencyHow recent the last violation is. A violation within the last 6 months scores high (bad); no violations in 3+ years scores 0 (good).
violation_frequencyNumber of violations in the last 3 years relative to facility size and program count. More violations = higher score.
penalty_severityTotal penalty amount in the last 5 years, normalized by facility type. Higher penalties = higher score.
active_violationsWhether the facility has any currently unresolved violations. Binary: 100 if any active violations, 0 otherwise.
inspection_gapTime since the last inspection. Longer gaps score higher, reflecting uncertainty. No inspection in 5+ years = 100.
The final score formula:
score = (violation_recency * 0.30) + (violation_frequency * 0.25) + (penalty_severity * 0.20) + (active_violations * 0.15) + (inspection_gap * 0.10)Interpreting Scores
| Range | Risk Level | Interpretation |
|---|---|---|
| 0 - 20 | Low | Clean compliance record. No recent violations, regular inspections. |
| 21 - 40 | Moderate | Minor issues. Possibly older violations, small penalties. |
| 41 - 60 | Elevated | Notable compliance concerns. Multiple violations or significant penalties. |
| 61 - 80 | High | Serious compliance problems. Recent HPV violations, active enforcement. |
| 81 - 100 | Critical | Severe and ongoing violations. Active enforcement cases, major penalties. |
Score in API responses
The compliance_score field appears in facility list and detail responses. The detail endpoint also includes the full score_breakdown.
curl "https://api.parley.dev/v1/facilities/f47ac10b-58cc-4372-a567-0e02b2c3d479" \ -H "X-API-Key: prl_YOUR_KEY_HERE"{ "data": { "id": "f47ac10b-58cc-4372-a567-0e02b2c3d479", "name": "ACME CHEMICAL PLANT", "compliance_score": 78, "score_breakdown": { "violation_recency": 100, "violation_frequency": 70, "penalty_severity": 75, "active_violations": 100, "inspection_gap": 0 } }}Filtering by score
Use min_score and max_score on the facilities list endpoint to filter by compliance risk:
curl "https://api.parley.dev/v1/facilities?state=CA&min_score=80&sort=score&order=desc" \ -H "X-API-Key: prl_YOUR_KEY_HERE"curl "https://api.parley.dev/v1/facilities?lat=34.0522&lng=-118.2437&radius=10&max_score=20" \ -H "X-API-Key: prl_YOUR_KEY_HERE"