---
name: aria_search
description: >-
  Recherche full-text dans la base d'accidents industriels ARIA (BARPI,
  ~64k accidents France/étranger 1992–présent). Retourne les top-K
  accidents pertinents avec leur numéro ARIA, URL data.gouv, titre,
  date, équipements, conséquences, et un extrait. Utilisé pour sourcer
  un initiating event LOPA, alimenter un HAZID, ou justifier une
  fréquence de demande par retour d'expérience français. Ranking BM25
  déterministe FTS5 (reproductible audit DREAL/HSE/ASN).
version: 1.0.0
namespace: system
category: knowledge
iec_reference: IEC 61511-1 §8.2.2 (hazard & risk assessment — incident evidence)
parameters:
  type: object
  properties:
    query:
      type: string
      description: >-
        Texte recherche full-text (FR/EN OK, le tokenizer FTS5 unicode61
        normalise les accents). Ex: 'incendie raffinerie', 'rupture
        tuyauterie hydrocarbure', 'explosion réacteur chimique'.
    type_accident:
      type: string
      description: >-
        Filtre exact sur accident_types (code BARPI ou label FR). Ex:
        'Incendie', 'Explosion', 'Rejet de matières dangereuses', 'IC'.
    pays:
      type: string
      description: "Filtre pays canonical FR — 'FRANCE', 'BELGIQUE', 'ETATS-UNIS', etc."
    equipement:
      type: string
      description: "Filtre équipement (LIKE matching, label FR). Ex: 'Tuyauterie', 'Réservoir', 'Capteur'."
    annee_min:
      type: integer
      minimum: 1900
      maximum: 2030
      description: "Année min inclusive (ex: 2010)"
    annee_max:
      type: integer
      minimum: 1900
      maximum: 2030
      description: "Année max inclusive (ex: 2024)"
    top_k:
      type: integer
      minimum: 1
      maximum: 50
      description: "Nb résultats retournés. Défaut 10."
  required: [query]
status_label_fr: "Recherche dans la base ARIA…"
status_label_en: "Searching ARIA database…"
---

# aria_search

Full-text search over the BARPI ARIA accident database. Returns
top-K accidents ranked by BM25 (FTS5 default, deterministic), with
the canonical traceability fields :

- `numero_aria` — public ARIA identifier (BARPI natural key)
- `url_data_gouv` — link to the official fact sheet
- `db_source_sha256_prefix` — first 8 hex chars of the source CSV
  SHA-256, recorded at ingest time in `ingest_meta`. Lets the auditor
  verify which BARPI export this search ran on.

## Audit-grade guarantees

- **Deterministic ranking** : same query → same result order, byte-for-byte.
  Tie-break is `ORDER BY rank, numero_aria ASC`.
- **No hallucination** : the LLM can only cite results from this skill's
  output ; cross-checking against `numero_aria` + `url_data_gouv`
  is trivial for any auditor.
- **Bilingual normalisation** : EN tokens were folded to FR canonical
  at ingest time via `EN_TO_FR_VALUES_ARIA` (187 entries). A query for
  "incendie" matches both "Incendie" (FR) and the folded "Fire" → "Incendie".

## Return shape

```json
{
  "count": 12,
  "query": "incendie raffinerie",
  "filters_applied": {"pays": "FRANCE", "annee_min": 2010},
  "ranking": "BM25 (FTS5 unicode61, deterministic tie-break on numero_aria)",
  "db_format_version": "1.0.0",
  "ingest_version": "1.0.0",
  "db_source_sha256_prefix": "1b68938d",
  "results": [
    {
      "numero_aria": 58245,
      "url_data_gouv": "https://aria.developpement-durable.gouv.fr/fiche_detaillee/58245-2/",
      "titre": "Feu d'un bâtiment d'expédition de marchandises",
      "date_evenement": "2022-06-20",
      "pays": "FRANCE",
      "commune": "CRISSEY",
      "types": ["Rejet prolongé", "Incendie"],
      "equipements": ["Bâtiment", "Engin terrestre"],
      "echelle": {"H": 0, "En": 0, "Ec": 4, "M": 1},
      "bm25_score": -7.214,
      "extrait": "Vers 10 h un samedi, un feu se déclare dans un bâtiment…"
    }
  ]
}
```
