Update documentation after collection split
This commit is contained in:
@ -4,11 +4,11 @@
|
||||
|
||||
This repository maintains a local SQLite index of WCX publications. Production code lives in `scripts/`: `wcx_sync.py` scrapes site metadata, `import_site.py` imports it into SQLite, and `update_wcx.sh` coordinates synchronization, import, and OCR. OCR is split across `process_pending_ocr.py`, `check_ocr.py`, `ocr.sh`, and `parse_ocr.py`.
|
||||
|
||||
`scripts/schema.sql` defines the database model. Generated databases belong in `database/`, while generated scraper output belongs in `import/`; both are ignored by Git. Historical source data is stored in `migration/`. Database design notes live in `docs/`. The main executable test/diagnostic script is `scripts/test_duration_matching.py`.
|
||||
`scripts/schema.sql` defines the database model. Generated databases belong in `database/`, while generated scraper output belongs in `import/`; both are ignored by Git. Historical source data is stored in `migration/`. Database design notes live in `docs/`. Filename matching and duration diagnostics live in the external `/storage/disk1/WCX-collection` repository.
|
||||
|
||||
## Architectural boundaries
|
||||
|
||||
This repository is the reference-data project. Filename matching and `scripts/match_filenames.py` have moved to the separate `/storage/disk1/WCX-collection` repository; this repository no longer contains or runs filename matching. The reference-data project owns the database schema, metadata, OCR, imports, history, and aliases, and it is the sole writer to the reference database.
|
||||
This repository is the reference-data project. Filename matching and duration diagnostics have moved to `/storage/disk1/WCX-collection/scripts/match_filenames.py` and `/storage/disk1/WCX-collection/scripts/diagnose_duration_match.py`; this repository no longer contains or runs that functionality. The reference-data project owns the database schema, metadata, OCR, imports, history, and aliases, and it is the sole writer to the reference database.
|
||||
|
||||
WCX-collection is an external read-only consumer of the reference database and may open it only in strict read-only mode using SQLite `mode=ro`. Local file status, paths, matching decisions, and collection status must never be stored in the reference database. Any future file-management registry or database must be owned separately and may refer to `movie.id` as the stable external ID. Do not introduce a shared Python library or API without a concrete need.
|
||||
|
||||
@ -19,7 +19,6 @@ There is no build step or third-party Python package installation; scripts use P
|
||||
- `scripts/update_wcx.sh --skip-ocr` synchronizes and imports site data without requiring a Vision API key.
|
||||
- `scripts/update_wcx.sh` runs the complete update, including pending OCR work.
|
||||
- `scripts/migrate_csv.py --dry-run` validates legacy CSV data without modifying SQLite.
|
||||
- `scripts/test_duration_matching.py` exercises duration-matching behavior against the configured database and media paths.
|
||||
- `python3 -m py_compile scripts/*.py` performs a quick syntax check.
|
||||
|
||||
Use a copied test database for commands that can write data. Never recreate or overwrite `database/wcx.db` casually because it contains manually maintained metadata.
|
||||
|
||||
@ -9,8 +9,9 @@ versionshanterade filer. Följande har inspekterats:
|
||||
`docs/project-split-analysis-summary.md`,
|
||||
- `scripts/schema.sql`,
|
||||
- databasberoendena i `import_site.py`, `migrate_csv.py`, `check_ocr.py`,
|
||||
`process_pending_ocr.py`, `match_filenames.py` och
|
||||
`test_duration_matching.py`,
|
||||
`process_pending_ocr.py` samt de externa read-only-konsumenterna
|
||||
`/storage/disk1/WCX-collection/scripts/match_filenames.py` och
|
||||
`/storage/disk1/WCX-collection/scripts/diagnose_duration_match.py`,
|
||||
- `sqlite_schema`, `PRAGMA table_xinfo`, `PRAGMA foreign_key_list`,
|
||||
`PRAGMA index_list` och `PRAGMA index_xinfo` i
|
||||
`/storage/disk1/WCX/database/wcx.db`, öppnad med `sqlite3 -readonly`, och
|
||||
@ -284,16 +285,16 @@ båda fallen och är inte ett gap.
|
||||
| `migrate_csv.py` | Läser `id`; infogar eller uppdaterar alla metadatafält samt `ocr_status`; uppdaterar `modified_at`. | Kräver `ocr_status`. Anger status explicit och förlitar sig därför inte på dess default i sina egna inserts. Skriptet aktiverar inte främmande nycklar. |
|
||||
| `check_ocr.py` | Läser `name`, `thumbnail`; skriver `nationality`, `shoot_location`, `shoot_date`, samtliga fyra OCR-kolumner och `modified_at`. | Kräver alla fyra OCR-kolumnerna. Använder statusvärdena `completed`, `manual_review` och `failed`, men schemat validerar inte statusdomänen. |
|
||||
| `process_pending_ocr.py` | Läser `id`, `name`, `published`, `ocr_status`, `ocr_error`. | Kräver `ocr_status` och `ocr_error`; förutsätter att nya obehandlade poster får status `pending`. |
|
||||
| `match_filenames.py` | Läser `id`, `name`, `duration_seconds`. | Fungerar mot både produktions- och Git-schemat. |
|
||||
| `test_duration_matching.py` | Läser `id`, `name`, `duration_seconds`. | Fungerar mot både produktions- och Git-schemat. |
|
||||
| `/storage/disk1/WCX-collection/scripts/match_filenames.py` | Läser `id`, `name`, `duration_seconds`. | Extern read-only-konsument; fungerar mot både produktions- och Git-schemat. |
|
||||
| `/storage/disk1/WCX-collection/scripts/diagnose_duration_match.py` | Läser `id`, `name`, `duration_seconds`. | Externt manuellt diagnosverktyg som öppnar facitdatabasen read-only. |
|
||||
|
||||
### 5.2 `movie_history`
|
||||
|
||||
| Skript | Beroende |
|
||||
| --- | --- |
|
||||
| `import_site.py` | Infogar den föregående kompletta `movie`-raden, inklusive samtliga OCR-fält, samt `change_source` och `change_summary`. `archived_at` lämnas till standardvärdet. |
|
||||
| `match_filenames.py` | Läser `movie_id`, `duration_seconds` och `archived_at`. |
|
||||
| `test_duration_matching.py` | Läser `movie_id` och `duration_seconds`. |
|
||||
| `/storage/disk1/WCX-collection/scripts/match_filenames.py` | Läser `movie_id`, `duration_seconds` och `archived_at`. |
|
||||
| `/storage/disk1/WCX-collection/scripts/diagnose_duration_match.py` | Läser `movie_id` och `duration_seconds`. |
|
||||
|
||||
**Verifierat faktum:** Inget skript förutsätter en historiseringstrigger;
|
||||
`import_site.py` gör historik-insert och film-update i samma anslutningskontext.
|
||||
@ -302,7 +303,7 @@ båda fallen och är inte ett gap.
|
||||
|
||||
| Skript | Beroende |
|
||||
| --- | --- |
|
||||
| `match_filenames.py` | Läser `movie_id`, `alias`, `normalized_alias` och `source`. |
|
||||
| `/storage/disk1/WCX-collection/scripts/match_filenames.py` | Läser `movie_id`, `alias`, `normalized_alias` och `source`. |
|
||||
|
||||
**Verifierat faktum:** Inget inspekterat skript skriver alias. Constraints och
|
||||
index på aliastabellen finns ändå likadant i produktion och Git.
|
||||
|
||||
@ -1,3 +1,20 @@
|
||||
# Historisk implementationsprompt för filnamnsmatchning
|
||||
|
||||
## Status efter projektuppdelningen
|
||||
|
||||
Detta dokument är den ursprungliga implementationsprompten från tiden före
|
||||
projektuppdelningen och bevaras endast som historiskt källmaterial. Gamla
|
||||
sökvägar och framtidsformuleringar nedan beskriver dåvarande repositorystruktur
|
||||
och är inte aktuella instruktioner.
|
||||
|
||||
Den implementerade filnamnsmatchningen finns nu i
|
||||
`/storage/disk1/WCX-collection/scripts/match_filenames.py`, och dess framtida
|
||||
tester hör hemma under `/storage/disk1/WCX-collection/tests/`.
|
||||
WCX-collection är en separat extern konsument som öppnar facitdatabasen strikt
|
||||
read-only med SQLite `mode=ro`; facitprojektet är fortsatt ensam skrivare.
|
||||
|
||||
## Ursprunglig prompt
|
||||
|
||||
Jag vill implementera en första, skrivskyddad version av funktionaliteten som beskrivs i:
|
||||
|
||||
```text
|
||||
|
||||
Reference in New Issue
Block a user