> For the complete documentation index, see [llms.txt](https://docs.snapfix.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.snapfix.com/product/features/compliance/compliance-systems.md).

# Compliance systems

{% hint style="info" %}
Draft, written by an agent and not yet checked by a person ([how to read these docs](https://docs.snapfix.com/how-to-read.md)). [Source on GitHub](https://github.com/snapfix/docs/blob/main/product/features/compliance-systems.md).
{% endhint %}

A **compliance system** (in the app, a "system") is one thing a site must keep compliant, such as an insurance certificate or a monthly fire alarm test. Each system is filed under a **system type**, such as "Fire Safety". A system has an **expiry date** and an **expiry alert**, the number of days before the expiry when it turns amber, plus a frequency, a note, assigned users, one **contractor**, linked assets, **compliance documents** and an activity log. Tasks and planned tasks can be linked to a system, and the [Comply](https://docs.snapfix.com/product/features/compliance/comply.md) dashboard and timeline show these compliance tasks. Site admins manage systems on the web; the apps can only link a system to a task or a planned task.

## Rules

### System types

* A system type belongs to one site. Its name is unique among the site's live types; a taken or empty name is refused, and the page shows no message ([Systems](https://docs.snapfix.com/how-the-apps-work/screens/compliance/systems.md#inputs)).
* A new type goes first in the list (sort order 0). Types and the systems in each type are reordered by drag, saved in steps of 1000 ([Systems](https://docs.snapfix.com/how-the-apps-work/screens/compliance/systems.md#actions)).
* Any member of the site can reorder the types through the API, not only admins \[[ASK-112](https://github.com/snapfix/docs/blob/main/ASK.md#ask-112-which-comply-reads-should-members-who-are-not-admins-get)].
* Deleting a type deletes only the type row. Its systems keep their documents and their task and contractor links, drop out of every list, and answer "not found" on their own page, so they can no longer be opened or removed. The dialog says it "will permanently remove all related Systems and the data from their associated tasks and contractors". A system left this way on the QA site needs a person to remove it \[[ASK-108](https://github.com/snapfix/docs/blob/main/ASK.md#ask-108-remove-the-test-system-left-on-the-qa-site)] ([Delete Systems Type](https://docs.snapfix.com/how-the-apps-work/screens/compliance/systems.md#delete-systems-type)).

### Systems

* A new system is made by typing its name on its type's card. It starts with the frequency "None", an expiry alert of 30 days and no expiry date, and its page opens ([`POST /v1/app/comply/system`](https://docs.snapfix.com/engineering-reference/api/compliance.md#post-v1appcomplysystem)).
* Each field saves on its own ([System detail](https://docs.snapfix.com/how-the-apps-work/screens/compliance/system-detail.md#actions)).
* The expiry date is set by hand, or copied from one of the system's active documents ([Expiry Date](https://docs.snapfix.com/how-the-apps-work/screens/compliance/system-detail.md#expiry-date)).
* The expiry alert is 7, 30, 60, 90 or 180 days, or a custom whole number from 1 to 365. The server accepts any whole number. A custom number saved without pressing "Ok" becomes 0 days ([Expiry Alert](https://docs.snapfix.com/how-the-apps-work/screens/compliance/system-detail.md#expiry-alert)).
* The frequency is one of twelve names, from "None" to "5 years". Only the name is kept, and nothing acts on it: it changes neither the status nor any task \[[ASK-109](https://github.com/snapfix/docs/blob/main/ASK.md#ask-109-what-should-frequency-do-and-what-should-new-items-start-with)]. The frequency's ID that the web sends is never stored.
* The note box takes 2,000 characters; the server keeps 1,000 and cuts the rest without an error.
* Users are picked from the site's users. The web's "Users" dialog keeps one user: choosing one unassigns every other \[[ASK-113](https://github.com/snapfix/docs/blob/main/ASK.md#ask-113-should-a-system-or-contractor-have-one-assigned-user-or-several)]. The server does not check that the user belongs to the site ([Users](https://docs.snapfix.com/how-the-apps-work/screens/compliance/system-detail.md#users)).
* A system has one contractor, of the same site. Choosing another replaces the link; the old link is removed before the new contractor is checked, so a failed change leaves none ([`POST /v1/app/comply/system/link-contractor`](https://docs.snapfix.com/engineering-reference/api/compliance.md#post-v1appcomplysystemlink-contractor)).
* Several assets of the site's asset registers can be linked. The server does not check that they belong to the site ([Assets](https://docs.snapfix.com/how-the-apps-work/screens/compliance/system-detail.md#assets)).
* Documents are filed under the system; see [Compliance documents](https://docs.snapfix.com/product/features/compliance/compliance-documents.md).
* Deleting a system marks it deleted. Its document, user, asset, contractor and task links stay, and its tasks still count on the dashboard, although the dialog says the related data is removed from tasks and contractors ([Delete System](https://docs.snapfix.com/how-the-apps-work/screens/compliance/system-detail.md#delete-system)).

### Status

* A system is red ("Out of compliance") once its expiry date has passed, amber ("Expiring compliance") from its alert days before that, and green ("In compliance") otherwise, also when it has no expiry date or no alert days ([compliance item object](https://docs.snapfix.com/engineering-reference/api/compliance.md#compliance-item-object)).
* The status is worked out each time it is read. The traffic light on the system's page shows it, and a click on it does nothing; the colour the web sends is ignored.
* An alert of 0 or less means the system never turns amber; a very large one makes any future expiry amber.

### Activity

* Every change to a system is logged: created, changed, deleted, a user assigned or removed, assets added or removed, a contractor linked or unlinked. Documents, system types and task links write no log line ([common side effects](https://docs.snapfix.com/engineering-reference/api/compliance.md#common-side-effects)).
* The Activity tab lists the log, newest first. The "updated" line ends with a stray quotation mark. The names in the lines are put into the page as HTML.
* Any signed-in user who knows a system's ID can read its log through the API.

### Tasks linked to a system

* A task links one system. On the web it is picked in two steps, a system type and then a system; the apps use the tagging sheet ([Task detail](https://docs.snapfix.com/how-the-apps-work/screens/tasks/task-detail.md#compliance-system)).
* Linking replaces the task's current link, adds an "Added : {system}" line to the task's chat and pushes to the task's people; removing adds "Removed : {system}". Any member of the task's group who can change the task may do it ([`POST /v1/app/tasks/system-add`](https://docs.snapfix.com/engineering-reference/api/compliance.md#post-v1apptaskssystem-add)).
* A system of another site is skipped, but the current link is removed first, so the task can end up with none.
* A planned task carries the systems it names, and the scheduler links them to each task it creates, with no check that the system is in the group's site. The Timeline's "Tasks" view for that type then lists those tasks, whatever their site.

## Flow

```mermaid
flowchart LR
    type["Add a system type"] --> sys["Type a system name: frequency None, alert 30 days"]
    sys --> detail["System page"]
    detail --> dates["Expiry date and alert"]
    dates --> status["In, expiring or out of compliance"]
    detail --> links["Users, one contractor, assets, documents"]
    detail --> log["Activity tab"]
    task["Task or planned task"] --> link["Link one system"]
    status --> comply["Comply dashboard and timeline"]
    link --> comply
```

## Platforms

| Capability                                                                                  | Web                             | iOS               | Android           |
| ------------------------------------------------------------------------------------------- | ------------------------------- | ----------------- | ----------------- |
| Add, rename, reorder and delete types; add and reorder systems                              | Site admins                     | No                | No                |
| A system's dates, alert, frequency, note, users, contractor, assets, documents and activity | Site admins                     | No                | No                |
| Link a system to a task                                                                     | System type, then system        | The tagging sheet | The tagging sheet |
| Pick a system for a planned task                                                            | The editor's compliance section | Yes               | Yes               |

## Screens

* [Systems](https://docs.snapfix.com/how-the-apps-work/screens/compliance/systems.md): system types and their systems.
* [System detail](https://docs.snapfix.com/how-the-apps-work/screens/compliance/system-detail.md): one system.
* [Task detail](https://docs.snapfix.com/how-the-apps-work/screens/tasks/task-detail.md#compliance-system): a task's compliance system.
* [Create planned task](https://docs.snapfix.com/how-the-apps-work/screens/planner/planned-task.md): a planned task's compliance system.

## API and data

* [Compliance API](https://docs.snapfix.com/engineering-reference/api/compliance.md), system types: [list](https://docs.snapfix.com/engineering-reference/api/compliance.md#get-v1appcomplysystem-type), [create](https://docs.snapfix.com/engineering-reference/api/compliance.md#post-v1appcomplysystem-type), [rename](https://docs.snapfix.com/engineering-reference/api/compliance.md#put-v1appcomplysystem-typeuuid), [delete](https://docs.snapfix.com/engineering-reference/api/compliance.md#delete-v1appcomplysystem-typeuuid) and [sort](https://docs.snapfix.com/engineering-reference/api/compliance.md#post-v1appcomplysystem-typesort).
* Systems: [list](https://docs.snapfix.com/engineering-reference/api/compliance.md#get-v1appcomplysystem), [create](https://docs.snapfix.com/engineering-reference/api/compliance.md#post-v1appcomplysystem), [get](https://docs.snapfix.com/engineering-reference/api/compliance.md#get-v1appcomplysystemuuid), [change one field](https://docs.snapfix.com/engineering-reference/api/compliance.md#put-v1appcomplysystemuuid), [delete](https://docs.snapfix.com/engineering-reference/api/compliance.md#delete-v1appcomplysystemuuid), [sort](https://docs.snapfix.com/engineering-reference/api/compliance.md#post-v1appcomplysystemsort) and [activity](https://docs.snapfix.com/engineering-reference/api/compliance.md#get-v1appcomplysystemuuidactivities).
* Links: [assign](https://docs.snapfix.com/engineering-reference/api/compliance.md#post-v1appcomplysystemassign) and [unassign](https://docs.snapfix.com/engineering-reference/api/compliance.md#post-v1appcomplysystemunassign) users; [link](https://docs.snapfix.com/engineering-reference/api/compliance.md#post-v1appcomplysystemlink-asset) and [unlink](https://docs.snapfix.com/engineering-reference/api/compliance.md#post-v1appcomplysystemunlink-asset) assets; [link](https://docs.snapfix.com/engineering-reference/api/compliance.md#post-v1appcomplysystemlink-contractor) and [unlink](https://docs.snapfix.com/engineering-reference/api/compliance.md#post-v1appcomplysystemunlink-contractor) the contractor; the [frequency list](https://docs.snapfix.com/engineering-reference/api/compliance.md#get-v1appfrequencies).
* Tasks: [`POST /v1/app/tasks/system-add`](https://docs.snapfix.com/engineering-reference/api/compliance.md#post-v1apptaskssystem-add) and [`system-remove`](https://docs.snapfix.com/engineering-reference/api/compliance.md#post-v1apptaskssystem-remove); the apps' [`?action=read_parent_comply_data`](https://docs.snapfix.com/engineering-reference/api/compliance.md#post-actionread_parent_comply_data) and [`?action=save_job_comply_system`](https://docs.snapfix.com/engineering-reference/api/compliance.md#post-actionsave_job_comply_system).
* Tables: [`comply_SystemType`](https://docs.snapfix.com/engineering-reference/db/tables/comply_systemtype.md), [`comply_System`](https://docs.snapfix.com/engineering-reference/db/tables/comply_system.md), [`comply_SystemUserAssigned`](https://docs.snapfix.com/engineering-reference/db/tables/comply_systemuserassigned.md), [`comply_SystemAsset`](https://docs.snapfix.com/engineering-reference/db/tables/comply_systemasset.md), [`comply_SystemContractor`](https://docs.snapfix.com/engineering-reference/db/tables/comply_systemcontractor.md), [`comply_SystemDocument`](https://docs.snapfix.com/engineering-reference/db/tables/comply_systemdocument.md), [`comply_SystemLog`](https://docs.snapfix.com/engineering-reference/db/tables/comply_systemlog.md), [`comply_Log`](https://docs.snapfix.com/engineering-reference/db/tables/comply_log.md) and [`tPri_JobComplySystem`](https://docs.snapfix.com/engineering-reference/db/tables/tpri_jobcomplysystem.md).

## Depends on

* [Comply](https://docs.snapfix.com/product/features/compliance/comply.md): the dashboard and timeline that show the status and the linked tasks.
* [Contractors](https://docs.snapfix.com/product/features/compliance/contractors.md), [Compliance documents](https://docs.snapfix.com/product/features/compliance/compliance-documents.md) and [Asset registers](https://docs.snapfix.com/product/features/assets/asset-registers.md): a system's contractor, documents and assets.
* [Site users](https://docs.snapfix.com/product/features/console/site-users.md): the users a system is assigned to.
* [Tasks](https://docs.snapfix.com/product/features/tasks/tasks.md) and [Planned tasks](https://docs.snapfix.com/product/features/planner/planned-tasks.md): the tasks linked to a system, by hand or by a planner.
* [Push notifications](https://docs.snapfix.com/product/features/notifications/push-notifications.md): a task link pushes to the task's people.

## Edge cases

* **Deleted type:** its systems leave the lists, answer "not found" and cannot be removed afterwards.
* **No type in the address:** a system page opened without its type's ID hides the "Attachment" card; a document can still be added from the Expiry Date dialog ([System detail](https://docs.snapfix.com/how-the-apps-work/screens/compliance/system-detail.md)).
* **Deleted contractor:** the link stays, and the system stops showing the contractor.
* **Duplicate or empty type name:** refused with no message.
* **Failed lists:** a failed type list leaves the Comply tabs disabled until the page reloads.
* **Several sites:** a system belongs to the site of its type, and the pages show the current site only; a planner can still link a system of another site.
* **Offline:** the web needs a connection; task links made in the apps sync later.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.snapfix.com/product/features/compliance/compliance-systems.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
