# Book-Movement Database Schema — Scaffold Sketch

**Purpose**: Track prominent-name library book movements across the Wittelsbach-Burgundy-Bohemia-Silesia-Padua corridor 1400–1500+ and adjacent traditions. Designed for eventual website tab "Library's Books" per Ed directive 2026-04-23.

**Scope**: Minimal usable schema. Not implementing — designing structure for later build.

## Tables

### `books`
Canonical record per physical manuscript / incunable.

| column | type | notes |
|---|---|---|
| book_id | PK int | internal |
| current_shelfmark | text | e.g. `Pal.lat.1298` or `Harley MS 2897` |
| current_library | FK `libraries.library_id` | |
| title | text | canonical title |
| author | text | primary named author (null if anonymous/compiled) |
| compilation_authors | text[] | additional compiled authors (Sammelhandschrift) |
| date_origin | text | date-range string e.g. `1430-1431` or `c.1420` |
| date_origin_min | int | year (lowerbound) |
| date_origin_max | int | year (upperbound) |
| place_origin | text | e.g. `Pavia/Padua` or `Heidelberg` |
| content_genre | text[] | `medical`, `herbal`, `astronomy`, `computus`, `iatromathematical`, `liturgical`, `cipher`, etc. |
| physical_format | text | `codex` / `scroll` / `folded_almanac` / `single_sheet` |
| illumination_level | text | `none` / `simple` / `ornate` / `illuminated` |
| iiif_manifest_url | text | nullable |
| wiglaf_entry_url | text | nullable |
| notes | text | free-form |
| thesis_relevance | text | nullable tag: `vms_comparandum`, `operator_grammar`, `wittelsbach_provenance`, etc. |

### `owners`
Any named person or institution with documented ownership / commissioning.

| column | type | notes |
|---|---|---|
| owner_id | PK int | |
| name | text | canonical form e.g. `Margaret of Bavaria-Straubing` |
| name_variants | text[] | e.g. `Margareta von Bayern`, `Marguerite de Bavière` |
| dates | text | e.g. `1363-1423` |
| dynasty_or_affiliation | text | e.g. `Wittelsbach-Straubing` |
| role | text | `duchess`, `physician`, `abbot`, `humanist`, `illuminator` |
| court_location | text | e.g. `Burgundian court (Dijon/Lille/Brussels)` |
| person_or_institution | text | `person` / `institution` |

### `movements`
Discrete book-ownership transitions.

| column | type | notes |
|---|---|---|
| movement_id | PK int | |
| book_id | FK `books.book_id` | |
| from_owner_id | FK `owners.owner_id` | nullable (unknown prior state) |
| to_owner_id | FK `owners.owner_id` | |
| movement_date | text | as known — may be range |
| movement_date_min | int | |
| movement_date_max | int | |
| movement_type | text | `inheritance`, `purchase`, `gift`, `dowry`, `seizure`, `dispersal`, `commission`, `bequest` |
| evidence_source | text | citation — e.g. `Lille ADN B NN inventaire 1423 fol.NN` or `booksofduchesses.com` |
| evidence_strength | text | `documented`, `inferred`, `speculative` |
| location_change | text | e.g. `Straubing court → Burgundian court` |
| notes | text | |

### `libraries`
Repositories past and present.

| column | type | notes |
|---|---|---|
| library_id | PK int | |
| canonical_name | text | e.g. `Bibliotheca Palatina (Heidelberg)` or `Biblioteca Apostolica Vaticana` |
| present_location | text | null if dispersed |
| period_active | text | e.g. `1386-1622` for Palatina |
| parent_dynasty_or_institution | text | e.g. `Wittelsbach-Palatine` |
| absorbed_into | FK `libraries.library_id` | for dispersed libraries — e.g. Palatina → Vatican |
| notes | text | e.g. `transferred 1623 via Maximilian I gift to Gregory XV` |

### `attestations`
Primary-source references tying a book to an owner at a specific date.

| column | type | notes |
|---|---|---|
| attestation_id | PK int | |
| book_id | FK | |
| owner_id | FK | |
| attestation_date | text | |
| source_document | text | e.g. `Inventaire Lille ADN B NN fol.N` |
| source_type | text | `inventory`, `will`, `ex_libris`, `arms_painted`, `colophon`, `charter`, `correspondence` |
| strength | text | `primary`, `secondary`, `inferred` |
| quote_or_passage | text | nullable transcribed text |

## Example records (Honeycutt Ai Labs corpus material)

### Pal.lat.1115
```
books:
  current_shelfmark = 'Pal.lat.1115'
  current_library → library_id('BAV Pal.lat')
  compilation_authors = ['Avicenna','Hippocrates','Isaac Judaeus','Cermisone','Calderia','Hugo Senensis',...]
  date_origin = '1430-1431'
  place_origin = 'Pavia/Padua'
  content_genre = ['medical','consilia','iatromathematical']
  thesis_relevance = 'vms_window_padua_cohort'

owners:
  Bibliotheca Palatina (Heidelberg), active 1386-1622
  Biblioteca Apostolica Vaticana, 1623-present

movements:
  Pavia/Padua production 1430-1431
  → Heidelberg acquisition (Ottheinrich or Fugger channel, 1550s-1580s)
  → Vatican 1623 via Maximilian gift (type='seizure_gift')
```

### Harley MS 2897 (Summer breviary)
```
books:
  current_shelfmark = 'Harley MS 2897'
  current_library → library_id('BL London')
  title = 'Breviary of John the Fearless and Margaret of Bavaria (summer portion)'
  date_origin = '1413-1419'
  place_origin = 'Paris'
  content_genre = ['liturgical','breviary']
  illumination_level = 'illuminated'
  iiif_manifest_url = 'https://bl.digirati.io/iiif/ark:/81055/vdc_100161511640.0x000001'
  thesis_relevance = 'breviarium_exemplar_margaret_provenance'

owners: John the Fearless + Margaret of Bavaria (commissioners) → Philip the Good → ... → BL

movements: Paris workshop (Bedford Master + Chief Associate) 1413-1419, commissioned
  → Burgundian ducal library post-1419
  → [gaps — Louis XI 1483 acquisition pathway uncertain]
  → Harley Collection → BL
```

## Website-tab data view (for eventual build)

Suggested per-owner tab structure:
1. Owner bio card (name, dates, dynasty, role, court)
2. **Books sorted by acquisition date** (movements table JOIN books)
3. **Books by current repository** (where they survive)
4. **Books by genre** (their intellectual interests)
5. **Dispersal trace** (post-death fate of library)
6. **Attestation quality heatmap** (documented vs inferred)

For Margaret of Bavaria specifically, tab would filter `movements.from_owner_id = Margaret_of_Bavaria_owner_id` OR `movements.to_owner_id = Margaret_of_Bavaria_owner_id` + pre-regency natal inheritance.

## Vision-analysis teaching integration (future)

The marker-class analysis / folio-visual comparison / corridor mapping pipelines built this session should be incorporated as:
- `books.visual_features` JSON column (circular_diagrams, volvelles, plant_illustrations, zodiac_wheels, bloodletting_man, etc.)
- `books.layout_class` categorical (illustrated_herbal, alphabetical_tabula, consilia_prose, breviary_modular, astronomical_compendium, etc.)
- Per-folio feature extraction via existing PIL scripts — `composite_strips`, `crop_margins`, `count_rays`, `classify_tone`

Auto-populate `visual_features` when IIIF is available + a protocol script runs against canvases.

## Not implementing yet

Schema is design-only. When Ed approves, options for realization:
- SQLite DB at `../../../resources/tools/provenance/index.html#s-851b3e4e735bbc19` with a small FastAPI layer for the website
- Or flat-file JSON-Lines + static site generator
- Or direct integration with PROM's existing DB
