Alchemical Hands in the Hypnerotomachia Poliphili

Marginalia, Scholarship & Reception

← All Scripts

Seed Copies

seed_copies.py — 146 lines

Creates hp_copies table and seeds six annotated copies with full metadata from Russell 2014.

1"""Create hp_copies table and seed Russell's 6 annotated copies.
2
3Step 1 of the Manuscripts Pipeline (docs/MANUSCRIPTS_SPEC.md).
4Idempotent.
5"""
6
7import sqlite3
8from pathlib import Path
9
10BASE_DIR = Path(__file__).resolve().parent.parent
11DB_PATH = BASE_DIR / "db" / "hp.db"
12
13SCHEMA = """
14CREATE TABLE IF NOT EXISTS hp_copies (
15    id INTEGER PRIMARY KEY,
16    shelfmark TEXT NOT NULL UNIQUE,
17    institution TEXT NOT NULL,
18    city TEXT,
19    country TEXT,
20    edition TEXT DEFAULT '1499',
21    has_annotations BOOLEAN DEFAULT 0,
22    studied_by TEXT,
23    annotation_summary TEXT,
24    hand_count INTEGER DEFAULT 0,
25    copy_notes TEXT,
26    has_images_in_project BOOLEAN DEFAULT 0,
27    istc_id TEXT,
28    review_status TEXT DEFAULT 'DRAFT',
29    source_method TEXT DEFAULT 'DETERMINISTIC',
30    confidence TEXT DEFAULT 'MEDIUM'
31);
32"""
33
34COPIES = [
35    {
36        "shelfmark": "C.60.o.12",
37        "institution": "British Library",
38        "city": "London",
39        "country": "United Kingdom",
40        "edition": "1545",
41        "has_annotations": True,
42        "studied_by": "Russell 2014",
43        "hand_count": 2,
44        "has_images_in_project": True,
45        "copy_notes": "1545 second Aldine edition. Two hands: Ben Jonson (Hand A) and an anonymous alchemist (Hand B). Purchased by Thomas Bourne in 1641. The BL copy's sequential photo numbering makes folio-to-image matching provisional.",
46        "confidence": "LOW",
47    },
48    {
49        "shelfmark": "Buffalo RBR",
50        "institution": "Buffalo & Erie County Public Library",
51        "city": "Buffalo, NY",
52        "country": "United States",
53        "edition": "1499",
54        "has_annotations": True,
55        "studied_by": "Russell 2014",
56        "hand_count": 5,
57        "has_images_in_project": False,
58        "copy_notes": "The most densely annotated copy in Russell's study. Five interleaved hands (A-E). Hands A-B possibly Jesuit, St. Omer. Hand E is an alchemist following pseudo-Geber's sulphur and Sol/Luna framework.",
59        "confidence": "HIGH",
60    },
61    {
62        "shelfmark": "Inc.Stam.Chig.II.610",
63        "institution": "Vatican Library (Biblioteca Apostolica Vaticana)",
64        "city": "Vatican City",
65        "country": "Vatican City",
66        "edition": "1499",
67        "has_annotations": True,
68        "studied_by": "Russell 2014",
69        "hand_count": 1,
70        "has_images_in_project": False,
71        "copy_notes": "Annotated by Fabio Chigi (Pope Alexander VII). Focus on acutezze (verbal wit). Chigi later commissioned Bernini's elephant-obelisk sculpture (1667) drawing on the HP's woodcut.",
72        "confidence": "HIGH",
73    },
74    {
75        "shelfmark": "INCUN A.5.13",
76        "institution": "Cambridge University Library",
77        "city": "Cambridge",
78        "country": "United Kingdom",
79        "edition": "1499",
80        "has_annotations": True,
81        "studied_by": "Russell 2014",
82        "hand_count": 1,
83        "has_images_in_project": False,
84        "copy_notes": "Annotated by Benedetto Giovio. Natural-historical reading treating the HP as a Plinian reference compendium. Extractive annotation mode (inventio).",
85        "confidence": "HIGH",
86    },
87    {
88        "shelfmark": "Modena (Panini)",
89        "institution": "Biblioteca Panini",
90        "city": "Modena",
91        "country": "Italy",
92        "edition": "1499",
93        "has_annotations": True,
94        "studied_by": "Russell 2014",
95        "hand_count": 1,
96        "has_images_in_project": False,
97        "copy_notes": "Also annotated by Benedetto Giovio. Comparison with Cambridge copy annotations reveals consistent bibliographic and natural-historical interests. First studied by Stichel (1994).",
98        "confidence": "HIGH",
99    },
100    {
101        "shelfmark": "O.III.38",
102        "institution": "Biblioteca degli Intronati",
103        "city": "Siena",
104        "country": "Italy",
105        "edition": "1499",
106        "has_annotations": True,
107        "studied_by": "Russell 2014",
108        "hand_count": 1,
109        "has_images_in_project": True,
110        "copy_notes": "478-image digital facsimile with explicit folio-number filenames. Anonymous annotations. Basis for the project's most reliable concordance data (HIGH confidence matches).",
111        "confidence": "HIGH",
112    },
113]
114
115
116def main():
117    conn = sqlite3.connect(DB_PATH)
118    cur = conn.cursor()
119
120    print("Creating hp_copies table...")
121    cur.executescript(SCHEMA)
122
123    print("Seeding Russell's 6 annotated copies...")
124    inserted = 0
125    for c in COPIES:
126        cur.execute("""
127            INSERT OR IGNORE INTO hp_copies
128                (shelfmark, institution, city, country, edition,
129                 has_annotations, studied_by, hand_count,
130                 has_images_in_project, copy_notes, confidence,
131                 source_method, review_status)
132            VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 'DETERMINISTIC', 'DRAFT')
133        """, (c["shelfmark"], c["institution"], c["city"], c["country"],
134              c["edition"], c["has_annotations"], c["studied_by"],
135              c["hand_count"], c["has_images_in_project"],
136              c["copy_notes"], c["confidence"]))
137        inserted += cur.rowcount
138
139    conn.commit()
140    conn.close()
141    print(f"  Inserted {inserted} copies")
142    print("Done.")
143
144
145if __name__ == "__main__":
146    main()