> ## Documentation Index
> Fetch the complete documentation index at: https://docs.a7manager.se/llms.txt
> Use this file to discover all available pages before exploring further.

# Inspections

> Campaigns, field reports and findings, and generated PDF reports.

Inspections are structured walk-arounds of a vehicle: an inspector works through a template,
records what is wrong, and submits a report. Field work happens on the separate
[inspector app](/pages/inspector-app), because depots and sidings have unreliable
connectivity.

***

## Tabs

| Tab                     | Shows                                                      |
| ----------------------- | ---------------------------------------------------------- |
| **Reports** *(default)* | Inspection reports, their completeness, and their findings |
| **Campaigns**           | The inspection templates that reports are built from       |

<Note>
  The **Campaigns** tab is where templates are managed — the label and the underlying concept
  use different words. A campaign *is* a template: the structure a report is filled in against.
</Note>

***

### Campaigns (templates)

A template belongs to a vehicle type and is built from the product-group tree. Each
**node** in the template points at a product group and can list location labels. Below the
nodes sit **checklist items**, the individual things to look at — either a specific mounting
slot or a named location, never both.

Items can be arranged into **sublists** for ordering. Templates can be deactivated but keep
their history.

***

### Reports

A report is one inspection of one vehicle against one template. It has just two states:

```mermaid theme={null}
stateDiagram-v2
    [*] --> DRAFT: created
    DRAFT --> SUBMITTED: submit
    SUBMITTED --> [*]
```

**Submission is terminal.** Once submitted the report is read-only — no further edits,
deletions or findings, and there is no un-submit.

* A **finding** is an *exception* — something wrong. It carries a severity of `LOW`,
  `MEDIUM`, `HIGH` or `CRITICAL`, a description, optional photos, and the component that was
  in the slot at the time.
* A **checklist item status** is an explicit *"checked and OK"* mark.

<Note>
  Both records **freeze the component** they were recorded against, storing its serial number
  at the time. A later remount never rewrites what was inspected.
</Note>

***

## Field work

Findings are recorded in the field on the [inspector app](/pages/inspector-app), a separate
offline-first application. This page is where reports are created, inspectors assigned, and
completed reports reviewed and submitted.

***

## Generated PDF reports

Two kinds of archival PDF can be generated, both stored immutably.

|          | **Per inspection**                                                                                     | **Aggregate**                                                                                                      |
| -------- | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ |
| Covers   | One submitted report                                                                                   | All submitted reports for one template                                                                             |
| Requires | Report submitted, at least one finding                                                                 | At least one submitted report                                                                                      |
| Contains | Severity breakdown, per-product-group breakdown, checklist completeness, every finding with its photos | Fleet severity totals, findings per vehicle, per-product-group counts normalised per vehicle, statistical outliers |
| Photos   | Yes                                                                                                    | No                                                                                                                 |
| Limits   | 300 photos                                                                                             | 100 reports, 1000 findings                                                                                         |

Each carries an **AI-written executive summary** — a four-to-six paragraph prose narrative in
English or Swedish. The AI writes only prose: the statistics and the outlier detection are
computed beforehand, and the aggregate summary explains outliers that were already
identified rather than finding them itself. You can supply context notes for the AI to weave
in, or verbatim notes that bypass it entirely.

***

## Tables

<Card title="Field reference" icon="table" href="/data/tables/inspections">
  Templates, nodes, checklist items, reports, findings, OK marks, photos and artifacts.
</Card>

***

## Roles

| Role                   | Capabilities                                                                                                     |
| ---------------------- | ---------------------------------------------------------------------------------------------------------------- |
| **Inspection Manager** | Create and manage templates and reports, assign inspectors, submit reports, generate both kinds of PDF           |
| **Inspector**          | Record findings and OK marks on reports they are assigned to; edit or delete their own while the report is draft |
| Report creator         | May record findings on a report they created without assigning themselves                                        |
| Other project roles    | Read templates, reports and findings, and download generated PDFs                                                |

A report that already has findings cannot be deleted — the findings must be removed first.
