kept icon indicating copy to clipboard operation
kept copied to clipboard

Binders and dividers for paper originals, filed through Paperless-ngx custom fields

Open strausmann opened this issue 4 weeks ago • 1 comments

What you're trying to do

Keep paper originals in lever-arch binders and find any one of them again in seconds. Paperless-ngx holds the scan; Kept knows the house. Together they should answer: where is the original of this document? Room, cupboard, shelf, binder, divider, and roughly how far into the binder.

A family binder is shared and split by dividers, for example Certificates with one section per person (a parent, each child). Filing should work from the phone: scan the binder, scan the document's ASN label, done.

The idea comes from fileee, which assigns scanned documents to a binder by QR code and shows on a colour scale where in the binder a document sits.

Mockups (five screens, English): https://claude.ai/artifact/2E2NQiFSYHjhoB9UQeKo5y

What gets in the way today

  • A box is a thing whose type has the container capability, so a type such as "Binder" can already be made, labelled and placed on a shelf. But nothing ties Paperless documents to it.
  • The Paperless connection (apps/server/src/paperless/, D248) is read-only. It reads title, created, document type, correspondent and tags (DOC_FIELDS in client.ts), but neither custom fields nor the archive serial number (ASN).
  • Paperless itself has no notion of a physical place. The ASN is the convention for "the original is filed", and the long-running request for several ASN series (paperless-ngx discussion 1841, open since 2022) shows that one number alone doesn't describe several binders.

What you'd like

1. Binders and dividers in Kept

  • A built-in container kind Binder, and Divider as a section inside it. Each has its own short ID and QR code; a divider's ID extends its binder's (A-0003.2).
  • A divider can carry Belongs to (a person), so "Child 1's certificates are in binder 3, section 2" can be shown.
  • A binder's page lists its documents from Paperless, per divider, in filing order, with the counts of originals and digital-only documents.

2. Where a document is filed, kept in Paperless

Two custom fields in Paperless, chosen in Kept's Paperless settings:

Field Paperless type Holds
Filed in Select one option per binder or divider
Position Text a sort key within the binder or divider
  • Option id = the Kept ID. Paperless lets the client set a select option's id (it generates one only when none is given, in the custom field serialiser's validate, src/documents/serialisers.py) and stores just that id on the document, at most 16 characters (value_select = CharField(max_length=16)). So the scanned QR code is the field's value, and renaming a binder in Kept only changes the option's label, for example A-0003.2 · Certificates › Child 1.
  • Position is read only where it is set. Order within a section: by Position where the document has one, otherwise by ASN, otherwise by created date. A text key allows inserting between two documents without renumbering the others (fractional indexing); Paperless text fields hold up to 128 characters.
  • Original or digital only: a document with an ASN counts as an original in the binder; without one, as digital only. Whether an original was taken out later is out of scope (see below).

3. Kept keeps Paperless up to date (optional, off by default)

When the person turns on "Kept manages the binder list in Paperless":

  • Creating a binder or divider in Kept adds its option to the Filed in field; renaming updates the label.
  • Moving a document to another binder or position in Kept sets Filed in and Position on the document in Paperless.
  • A document without these fields gets them the first time it is filed. Kept then asks where it went: at the front, at the back, or after a document the person picks from the section.

Three rules that come straight from Paperless's code (checked at v3.4.2, and the same at v2.16.0, Kept's minimum):

  1. Never remove a select option. Paperless replaces the whole select_options list on update, and on save it clears every document value whose option is gone (handlers.py: custom_field.fields.exclude(value_select__in=select_options.keys()).update(value_select=None)). A deleted binder keeps its option, with its label marked as retired; otherwise every document filed there silently loses its place.
  2. Read, change one option, write, read back. Paperless has no version check on custom fields, so a concurrent edit in Paperless could be overwritten. After writing, Kept re-reads the field and checks that every option that was there before is still there.
  3. Write document fields only through bulk edit, never through PATCH /api/documents/<id>/. The document serialiser uses drf-writable-nested's NestedUpdateMixin; a PATCH that includes custom_fields deletes every custom field instance not in the list (delete_reverse_relations_if_need), so it would wipe the person's other fields, and for document-link fields also the links back. POST /api/documents/bulk_edit/ with method: modify_custom_fields sets only what is in add_custom_fields ({field_id: value}) and removes only what is in remove_custom_fields; every other field stays as it is.

The connection test checks that the Paperless token may change custom fields and documents, and says so when it can't. Without that right, or with the option off, Kept only reads: the person picks the binder in Paperless's dropdown, and Kept shows the result.

4. Filing from the app

Two ways, both in the mockups:

  • Binder first. Scan the binder's or divider's QR code; every ASN scanned afterwards is filed there, at the back in scan order (or at the front). A document already filed elsewhere is not moved silently: Kept asks. One already in this section is left alone. Each filing can be undone from the list.
  • Document first. Scan an ASN; Kept shows where the original is. If it isn't filed yet, scan the binder, pick the divider and the position.

Kept finds the document by ASN with GET /api/documents/?archive_serial_number=<n>.

5. Where the original is, at a glance

On the document in Kept: the path room › furniture › shelf › binder › divider, the position as a percentage of the section on a colour scale, the documents before and after it, and the place in the whole binder. The scale also differs in lightness, and the percentage is always printed, so it reads without colour too.

6. Labels, on the stock the person has

  • Spine label for the binder (ID, name, a colour strip per divider, QR), divider tabs (ID, name, colour, QR) and a pre-printed ASN sheet reserved for a binder or divider.
  • Each label kind is printed on a stock the person chooses: the built-in stocks (packages/shared/src/label-stocks.ts: A4 65 labels 38 × 21 mm, A4 24 labels 70 × 37 mm, Letter 30 labels, tape) and custom sheets with printer calibration, which #389 asks for. Spine labels are tall (around 61 × 192 mm for an 8 cm binder) and need a custom sheet. What goes on each label follows the layouts in #390; printing to a network label printer follows #421.
  • Pre-printed ASN sheets: Paperless does not reserve numbers; next_asn returns the highest ASN plus one (views.py). Kept therefore keeps track of the ranges it has printed and warns when a printed number has since been used in Paperless. Paperless refuses a duplicate ASN, so a clash shows up instead of being silent. When a document with a reserved number arrives in Paperless, Kept files it in that binder or divider; only the position is left to set.
  • Open detail: if Paperless reads the ASN from a barcode on import, the printed code must match the barcode format that Paperless instance is set to.

Out of scope here

  • Lending an original out of its binder (Kept knows lent for things; whether that should cover documents is a design question).
  • Writing anything else to Paperless (tags, document types, notes).
  • Several ASN series per household (paperless-ngx discussion 1841). Ranges per binder cover sequential numbering.

Suggested order

  1. Binders, dividers and the read-only view: Kept reads Filed in, Position and the ASN.
  2. Kept writes to Paperless, behind the setting, with the three rules above.
  3. App filing, labels and pre-printed ASN sheets.

The first step is useful on its own and doesn't change the Paperless connection from read-only.

strausmann avatar Nov 05 '26 11:11 strausmann

Thanks for the write-up and the mockups. It's on the roadmap for later, with no date. Please hold off on a PR until the design is settled.

ibrahimroshdy avatar Nov 05 '26 13:11 ibrahimroshdy