# Surface analyses

> Surface swabs. What was tested, whether it passed, and the action plan when it did not.

Source: https://developers.backresto.com/en/docs/surface-analyses

A surface analysis is a swab. Someone runs a test over a work surface (a
cutting board, a slicer, a cold-room shelf) and records what came back. One
record per swab: what was tested, whether it was satisfactory, and what was
decided when it was not.

| Collection | Scope | What a record is |
| --- | --- | --- |
| `surface-analyses` | `surface-analyses:read` | One swab, its verdict, and the action plan behind it. |

It shares the [snapshot envelope](https://developers.backresto.com/en/docs/collections): `id`, `deleted`,
`capturedAt`, `receivedAt`, `sequence` and the rest sit around the `data`
below.

## `surface-analyses`

| Field | Type | Meaning |
| --- | --- | --- |
| `timestamp` | string, **required** | When the swab was taken, epoch milliseconds as a string. |
| `name` | string, **required** | What was tested. Free text, typed by the person. |
| `isSatisfactory` | boolean, **required** | The verdict that was recorded. |
| `actionPlan` | string \| null | What was decided about it. Free text. |
| `userId` | string \| null | The [staff member](https://developers.backresto.com/en/docs/facilities) who recorded it, when the app kept one. |

```json
{
  "id": "6f1d92c4-0b7a-4d31-9f18-3a6c2e5b7d40",
  "collection": "surface-analyses",
  "deleted": false,
  "capturedAt": "1789815240512",
  "receivedAt": "1789815312004",
  "sequence": "412",
  "data": {
    "timestamp": "1789812000000",
    "name": "Planche de découpe viande",
    "isSatisfactory": false,
    "actionPlan": "Désinfection renforcée, nouveau prélèvement lundi",
    "userId": "b3f7c1a0-5d42-4e88-9a16-7c0e2d4b9f31"
  }
}
```

## Reading them

**`isSatisfactory` is a verdict that was taken, not one you compute.** It is
what the laboratory reported or what the operator concluded on the spot,
recorded as given. There is no threshold, no count and no unit in the record to
recompute it from, and you should not go looking for one: present it as their
verdict, in their words, and let a disagreement be theirs to settle.

**`name` is text, not a reference.** It does not point at an
[area or a piece of equipment](https://developers.backresto.com/en/docs/facilities): there is no id here to join
on. Two swabs of the same surface a month apart can be spelled two different
ways, so group on it only if you are willing to normalise, and never present a
normalised name as the one that was recorded.

**`actionPlan` is free text and independent of the verdict.** It is null when
nothing was typed, which is not the same as nothing being done, and it can be
absent on an unsatisfactory swab. Do not infer one field from the other, and do
not build an enum out of a field people write sentences in.

And the caveat that applies to every collection applies here too: what you get
is what this API received, not the restaurant's complete history. See
[the envelope page](https://developers.backresto.com/en/docs/collections) before you count swabs, and
[the completeness note](https://developers.backresto.com/en/docs/support) before you report the count to anyone.
