From a4a14828e829072ee6a39e2cc8da4cf1a0f79e3a Mon Sep 17 00:00:00 2001 From: lila Date: Thu, 26 Mar 2026 10:11:25 +0100 Subject: [PATCH] no isPrimary --- documentation/decisions.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/documentation/decisions.md b/documentation/decisions.md index fe9c8cb..e27c233 100644 --- a/documentation/decisions.md +++ b/documentation/decisions.md @@ -134,6 +134,22 @@ Then `sudo sysctl -p` or restart Docker. --- +## Data Model + +### Translations: no isPrimary column + +WordNet synsets often have multiple lemmas per language (e.g. "dog", "domestic dog", "Canis familiaris"). An earlier design included an isPrimary boolean to mark which translation to display in the quiz. +This was dropped because: + +The schema cannot enforce a single primary per (term_id, language_code) with a boolean alone — multiple rows can be true simultaneously +Fixing that requires either a partial unique index or application-level logic, both adding complexity for no MVP benefit +The ambiguity can be resolved earlier and more cleanly + +Decision: the Python extraction script picks one translation per language per synset at extraction time, taking the first lemma (WordNet orders lemmas by frequency). By the time data enters the database the choice is already made. +The translations table carries a UNIQUE (term_id, language_code) constraint, which enforces exactly one translation per language at the database level. No isPrimary column exists. + +--- + ## Current State ### Completed checkboxes (Phase 0)