Files
Speech/docs/data-model.md
T
Eugenius Naumenko f3d42ee2b6 Mehrsprachige Bedienung und versionierte Aufgabenvarianten einführen
Übersetzungskataloge, getrennte Sprachpräferenzen und einen versionierten Aufgabenpilot ergänzen. Historische Aufgaben und Bewertungen bleiben erhalten; äquivalente Ansichten teilen Nachweise. Lokal mit Race-Tests und PostgreSQL, Vet, Web-Build, Bank-Audits und Browser-Fixtures geprüft. Dieser Stand dient als Ausgangspunkt für die anschließend beauftragte Zusammenführung zur Muttersprache.
2026-11-07 16:26:26 +00:00

3.0 KiB

Data Model

Core tables are created automatically by the Go API at startup:

  • users
  • learner_profiles
  • language_profiles
  • lessons
  • exercises
  • attempts
  • progress_events
  • conversation_sessions
  • conversation_turns

The MVP seeds en-US A1 lessons and exercises. Additional languages should be added by inserting a new language_profiles row and matching lessons/exercises.

Language roles

  • learner_profiles.target_language: language being learned; progress remains scoped by learner, target language and course version.
  • users.ui_language: interface preference; newly selected values are de-DE or en-US during the first rollout.
  • users.instruction_language: preferred explanation language. The additive startup migration copies the old ui_language only for rows without this field. New accounts default to de-DE; changing the interface never updates this field. Existing stored tasks and feedback keep their original language.

PATCH /me/preferences preserves omitted target language, level and daily goal. The profile update and interface preference are committed in one transaction. GET /me and auth responses expose both user language fields. The course also offers PUT /course/instruction-language for reviewed bank presentations; this changes no interface, target-language or learning-goal fields.

Reviewed task presentations

course_v2_bank_variants stores immutable IDs, base-entry references, canonical identity, explanation language, revision, reviewed data and checksum. A partial unique index allows one active presentation per base entry/explanation language; retired rows remain for frozen assignments. course_v2_tasks.variant_id links new variant snapshots. Its assignment uniqueness includes the variant, allowing separate frozen language presentations. Original German bank entries and old assigned JSON remain unchanged.

New task JSON may include instruction_language, instruction, stimulus, variant_id, content_revision, canonical_task_id, option language/role and private reference-answer language. The compatible combined prompt remains. Public(false) still removes solutions and listening transcripts and always removes the internal evidence_task_id.

New equivalent presentations reuse the earliest matching owned assignment's evidence_task_id (or its ID for legacy snapshots). Graded attempts remain separate; distinct-task aggregation uses that identity. New scripted speech observations also use it for repetition grouping. Previously stored observations and historical attempt JSON are unchanged; this does not retrospectively dedupe all old exam copies. Adaptations have new canonical/evidence identities.

course_v2_jobs.instruction_language freezes the effective preference when the job is inserted. Startup fills this additive field once for older jobs; retries and request replays keep it. The pilot adds twelve English presentations, nine translations and three adaptations. Catalog inventory uses the selected explanation language, so the German total remains 840 and the pilot total is 12.