Skip to main content
POST /businesses/{id}/evaluate

Path parameters

id
integer
required
The unique identifier of the business to evaluate.

Request body

No request body required.

What happens

When you call this endpoint, the server:
  1. Fetches the business record by id from the database.
  2. Calls evaluate_risk(business) from the risk engine to compute a score.
  3. Stores a new RiskEvaluation record in the database.
  4. Returns an HTML partial rendered from partials/risk_display.html.

Response

Returns an HTML partial containing the risk display for the evaluated business.
FieldTypeDescription
risk_scoreFloatFinal score from 0.0 to 100.0, rounded to one decimal place.
risk_levelStringOne of low, medium, high, or critical.
factorsObjectBreakdown of scoring components (see below).

Factors breakdown

FactorDescription
base_scoreRandom base score in the 10–70 range.
industry_modifierAdjustment based on the business’s industry category. High-risk industries add +15–30; low-risk industries subtract 5–20.
country_modifierAdjustment for sanctioned countries (+15–25). Zero for all others.
noiseRandom adjustment of ±5 applied to every evaluation.
final_scoreThe clamped and rounded result of all components combined. Equal to risk_score.

Risk levels

LevelScore range
low< 25
medium25–50
high50–75
critical75+

Example

curl -X POST http://localhost:8000/businesses/1/evaluate

Error responses

StatusDescription
404 Not FoundNo business exists with the given id.
422 Unprocessable EntityThe 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.

Build docs developers (and LLMs) love