feat(domain): finding kind observation → consultation_reason; Step 4 business decisions in spec + memory (BDR-033)
This commit is contained in:
1 parent
1cc70c3589
commit
12f0b21fdf
5 files changed
+41
-33
No files matched your search
@@ -57,7 +57,7 @@ AnatomicalSheetDocument
|
||||
│ Geometry = circle { cx, cy, r } | polygon { points: [x, y][] ≥ 3 } | path { d }
|
||||
└─ finding_zones: FindingZone[]
|
||||
FindingZone = { id, name: LocalizedText, categories: FindingCategory[] }
|
||||
FindingCategory = { id, kind: dysfunction | observation | anamnesis | custom, name, description?, children: FindingNode[] }
|
||||
FindingCategory = { id, kind: dysfunction | consultation_reason | anamnesis | custom, name, description?, children: FindingNode[] }
|
||||
FindingNode = { id, name, description?, requires_vet_referral?, sources?, children? } (recursive)
|
||||
SourceRef = { type: manual | journal | database | web, citation, url? }
|
||||
```
|
||||
@@ -269,28 +269,21 @@ with the community step (§17.4).
|
||||
| Migrations reproducible | PGlite replays from zero in `pnpm test:run`; `pnpm db:reset` on the real stack |
|
||||
| Previous tests pass | root `pnpm check` |
|
||||
|
||||
## 5. Decisions left to the user
|
||||
## 5. Business decisions (user, 2026-10-09)
|
||||
|
||||
1. **Follow = permission to use a public sheet** (§2.9) is not yet modelled:
|
||||
today every authenticated user can use any public active sheet. Grants
|
||||
and follows will narrow `can_use_sheet` at the community step.
|
||||
2. **Who may create sheets**: any active account for now. Should creation
|
||||
wait for professional verification (Step 7)?
|
||||
3. **Deprecation policy**: publishing v2 does not deprecate v1. Should it,
|
||||
automatically, or stay a manual act?
|
||||
4. **Table name `anatomical_sheet_assets` and the content-addressed Storage
|
||||
layout** (`<sha256>.svg`): confirm before the importer writes files.
|
||||
5. **Official equine sheet owner**: platform-owned (`creator_user_id = null`,
|
||||
`is_official = true`, edited by platform admins) or owned by the client's
|
||||
account?
|
||||
6. **Finding category kind naming**: `observation` collides with the report
|
||||
"Observation" (OPEN_QUESTIONS C7). Alternative: `consultation_reason`.
|
||||
7. **Server-side shape validation**: SQL re-checks references, sizes and the
|
||||
species, not the full Zod shape (ids pattern, enums, unknown keys). A
|
||||
client calling the RPC directly can publish a shape-invalid document to
|
||||
its own sheet. Options: a plpgsql shape check, or publication through an
|
||||
Edge Function running the Zod schema (community step at the latest).
|
||||
8. **Account erasure**: `creator_user_id` is `on delete restrict` and the
|
||||
immutability guard blocks `set null` on `published_by` of published rows,
|
||||
so deleting an `auth.users` row that owns sheets fails by design until the
|
||||
retention step (§16) defines reassignment or anonymisation.
|
||||
The open points of Step 4 were decided as follows. Each line names where
|
||||
the decision lands; only the naming one is implemented in this document.
|
||||
|
||||
| # | Decision | Where it lands |
|
||||
| --- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| 1 | Public sheets are readable according to their visibility, but **using** a community sheet for a report requires following its author. Official Faunosteo sheets need no follow. | `can_use_sheet` gains the follow predicate at the community step; official sheets (`is_official`) bypass it. Until then every active account may use any public sheet. |
|
||||
| 2 | Any account may prepare private drafts; **community publication** is reserved to authorised, verified accounts. Student and professor roles keep their own rules. | `publish_sheet_version` + `set_sheet_visibility('public')` gain a verification check at the identity / verification step. |
|
||||
| 3 | A new publication becomes the current version; older versions are **not deprecated automatically** and stay readable under the access rules. | Already the behaviour of `publish_sheet_version`; deprecation stays a manual act. |
|
||||
| 4 | Official sheets are **platform-owned**, administered by authorised accounts. | Already the model: `creator_user_id = null`, `is_official = true`, platform admins edit. |
|
||||
| 5 | Name anatomical findings apart from the observations typed during a report. | Finding category kind `observation` renamed **`consultation_reason`** (`dysfunction` / `consultation_reason` / `anamnesis` / `custom`). The report-side object keeps the name Observation. |
|
||||
| 6 | Server-side validation and integrity for every publication; the frontend is never a security boundary. | SQL already re-checks references, sizes and species. The full shape check (Zod) moves server-side before community publication: plpgsql shape rules or an Edge Function gate, decided at the community step. |
|
||||
| 7 | Account deletion handles dependencies and transfers explicitly (RGPD); no dependency may block the erasure of personal data forever. | Retention step (§16): published versions get their `created_by` / `published_by` anonymised through a dedicated system path (the immutability guard will allow that single transition), personal sheets are transferred or archived, `creator_user_id` keeps `on delete restrict` only as the backstop that forces the explicit path. |
|
||||
|
||||
Still open, technical only: the Storage layout `<sha256>.svg` is applied by
|
||||
the importer step (4b) with a bucket policy that authorises through the
|
||||
sheet, never through a hash alone.
|
||||
Reference in new issue
Block a user