POST /businesses/{id}/evaluate
Path parameters
The unique identifier of the business to evaluate.
Request body
No request body required.
What happens
When you call this endpoint, the server:
- Fetches the business record by
id from the database.
- Calls
evaluate_risk(business) from the risk engine to compute a score.
- Stores a new
RiskEvaluation record in the database.
- Returns an HTML partial rendered from
partials/risk_display.html.
Response
Returns an HTML partial containing the risk display for the evaluated business.
| Field | Type | Description |
|---|
risk_score | Float | Final score from 0.0 to 100.0, rounded to one decimal place. |
risk_level | String | One of low, medium, high, or critical. |
factors | Object | Breakdown of scoring components (see below). |
Factors breakdown
| Factor | Description |
|---|
base_score | Random base score in the 10–70 range. |
industry_modifier | Adjustment based on the business’s industry category. High-risk industries add +15–30; low-risk industries subtract 5–20. |
country_modifier | Adjustment for sanctioned countries (+15–25). Zero for all others. |
noise | Random adjustment of ±5 applied to every evaluation. |
final_score | The clamped and rounded result of all components combined. Equal to risk_score. |
Risk levels
| Level | Score range |
|---|
low | < 25 |
medium | 25–50 |
high | 50–75 |
critical | 75+ |
Example
curl -X POST http://localhost:8000/businesses/1/evaluate
Error responses
| Status | Description |
|---|
404 Not Found | No business exists with the given id. |
422 Unprocessable Entity | The id is not a valid integer. |
Each call to this endpoint creates a new RiskEvaluation record. All evaluations are stored and contribute to the business’s history — no previous record is overwritten.
See Risk engine for the full scoring algorithm, including which industries and countries carry modifiers.