about summary refs log tree commit diff
path: root/docs
diff options
context:
space:
mode:
authorPjotr <wrk@bosa.lan>2026-11-10 19:03:50 +0000
committerPjotr <wrk@bosa.lan>2026-11-10 19:03:50 +0000
commitbb3a5454c76d9ad7542f884fb14f89998d978553 (patch)
treec5601c2cf9a0b65b0e68882418a9906b6e2b44b0 /docs
parentfc99de3a5e8dfe2f54ac7e34e7422672baaa97bc (diff)
downloadgenenetwork4-bb3a5454c76d9ad7542f884fb14f89998d978553.tar.gz
baskets: a user's own column of values, in their own SQLite file
The next phase is changing data, and the constraint is that MariaDB is
never written to. A basket is the storage half of that: take a trait's
values, edit some of them (or build a covariate column that does not
exist), keep the column under a name, and map that instead.

  * POST /baskets stores a complete column; GET /baskets lists yours;
    GET /baskets/{name} its metadata; GET /baskets/{name}/values the
    cells; PATCH /baskets/{name} replaces the column with a new revision;
    DELETE removes it.
  * POST /compute/qtl2 takes "basket": "<name>" in place of `samples`,
    and both at once is a 422 rather than a silent choice. The mapping
    code below it is untouched -- a basket resolves to the same
    (name, value) pairs a client would have posted.
  * One SQLite file per user: BASKET_DIR/<sha256(token sub)>.sqlite, 0600,
    WAL, busy_timeout. `GET /baskets` only ever lists the caller's own;
    the file name is a hash, so a directory listing does not name users.
  * The full column is stored, not a diff -- the caller has the original
    beside it, and a mapping needs one complete column.
  * Text with a parsed copy beside it: raw (what was typed), value (the
    number or NULL), status (ok/missing/bad). "NA" and 0 stay different
    claims, and a column with something that is neither a number nor a
    missing marker (NA, x, -, ., ?) is refused with the samples named --
    silently dropping it would change a trait without saying so.
  * A revision and a digest: an edit bumps the revision and changes the
    digest, and a mapping reply records both ("Basket 'wbc-edit'
    revision 2 (digest 9559a70e...)"), so two runs on one name cannot
    look alike. A result cache must key on the digest, not the name.

The loop, end to end on BXD trait 10001: 34 values posted as a basket,
one bumped by 5 and one marked NA, revision 2 mapped with /compute/qtl2
-- 3730 rows, peak chr8 112.9 Mb, and the reply's note naming the
revision and digest.

tests/baskets.rs walks that loop (create, list, values, patch, map by
name, delete) and the refusals: a non-number named in the error, a name
that cannot become a path, an unknown basket, and basket-plus-samples.
Unit tests cover parsing (NA/x/-/. vs NaN/inf vs "twelve"), the digest
changing on edit, per-user isolation, and name validation.

rqtl/gemma take the same 10-line change next -- their `samples` shapes
differ, so they are a separate commit rather than a rushed one.
Diffstat (limited to 'docs')
-rw-r--r--docs/www/SKILL.md9
1 files changed, 9 insertions, 0 deletions
diff --git a/docs/www/SKILL.md b/docs/www/SKILL.md
index 0f0638c..2b96c91 100644
--- a/docs/www/SKILL.md
+++ b/docs/www/SKILL.md
@@ -201,6 +201,15 @@ header (peak and, for GEMMA, the Bonferroni line).
   (`.../markers/{peak}/classes?trait={trait_id}`): filling in the trait id is
   how you check a peak before reporting it, and `/compute/qtl2`'s `notes`
   explains what a `riself` conversion did to `H`.
+* **Changing values**: there is no write endpoint for traits, and there never
+  will be — but a user's own column can be stored and mapped. `POST /baskets`
+  with `{"name", "values":[{name,value}…]}` (values may be numbers, strings
+  like `"NA"`, or null), `PATCH /baskets/{name}` to edit (a new revision, a new
+  digest), then `POST /compute/qtl2` with `"basket": "<name>"` instead of
+  `samples`. Baskets are private to the token's user, live in their own SQLite
+  file, and a mapping reply records the revision and digest it used — quote
+  them when reporting a result. `GET /baskets` lists them, `DELETE` removes
+  one.
 * Follow `next` freely: every link is a `GET` that returns 200, and the API
   offers the whole graph from any response (genotypes -> frequencies ->
   markers -> a marker's location/tally -> PheWAS; trait -> values ->