Ingest Perplexity Research
Adds 9 bibliography entries and 3 timeline events from HPPERPLEXITY.txt web research.
1"""Ingest new bibliography entries from HPPERPLEXITY.txt research into the database. 2 3Adds entries that are genuinely new scholarship not already in our bibliography, 4with proper source_method tagging. 5""" 6 7import sqlite3 8from pathlib import Path 9 10BASE_DIR = Path(__file__).resolve().parent.parent 11DB_PATH = BASE_DIR / "db" / "hp.db" 12 13# New entries from HPPERPLEXITY.txt that are NOT already in our bibliography 14NEW_ENTRIES = [ 15 # Scholarly articles discovered via Perplexity 16 { 17 "author": "Unknown (botanical study)", 18 "title": "On the Botanical Content of Hypnerotomachia Poliphili", 19 "year": "2016", 20 "pub_type": "article", 21 "journal": "Landscape Ecology / Taylor & Francis (Botanical Journal of the Linnean Society?)", 22 "hp_relevance": "DIRECT", 23 "topic_cluster": "architecture_gardens", 24 "url": "https://www.tandfonline.com/doi/full/10.1080/23818107.2016.1166070", 25 "notes": "Catalogues 285 plant entities referenced in the HP text. Via HPPERPLEXITY.txt.", 26 "source_method": "WEB_SEARCH", 27 "needs_verification": True, 28 }, 29 { 30 "author": "Unknown (musicological study)", 31 "title": "Music and Its Powers in the Hypnerotomachia Poliphili (1499)", 32 "year": "2020", 33 "pub_type": "article", 34 "journal": "Cahiers de recherches medievales et humanistes 39", 35 "hp_relevance": "DIRECT", 36 "topic_cluster": "text_image", 37 "url": "https://classiques-garnier.com/cahiers-de-recherches-medievales-et-humanistes-journal-of-medieval-and-humanistic-studies-2020-1-n-39-music-and-its-powers-in-the-hypnerotomachia-poliphili-1499.html", 38 "notes": "Musicological reading of musical scenes, instruments, and Ficinian spiritus. Via HPPERPLEXITY.txt.", 39 "source_method": "WEB_SEARCH", 40 "needs_verification": True, 41 }, 42 { 43 "author": "Unknown (UPenn repository)", 44 "title": "Architectures of the Text: An Inquiry Into the Hypnerotomachia Poliphili", 45 "year": None, 46 "pub_type": "article", 47 "journal": "University of Pennsylvania Repository", 48 "hp_relevance": "DIRECT", 49 "topic_cluster": "architecture_gardens", 50 "url": "https://repository.upenn.edu/items/37a3b059-be9a-4b2a-aad4-9fc2feb5b7f1", 51 "notes": "Architecture, design, and Aldine printing. Via HPPERPLEXITY.txt.", 52 "source_method": "WEB_SEARCH", 53 "needs_verification": True, 54 }, 55 { 56 "author": "Unknown (Polish publisher)", 57 "title": "Hypnerotomachia Poliphili: Thoughts on the Earliest Reception", 58 "year": None, 59 "pub_type": "article", 60 "journal": "Akademicka.pl (Polish academic press)", 61 "hp_relevance": "DIRECT", 62 "topic_cluster": "reception", 63 "url": "https://books.akademicka.pl/publishing/catalog/download/145/488/469?inline=1", 64 "notes": "Examines annotated copies and earliest readers. Via HPPERPLEXITY.txt.", 65 "source_method": "WEB_SEARCH", 66 "needs_verification": True, 67 }, 68 69 # Digital editions and resources (not scholarship per se, but important references) 70 { 71 "author": "MIT Press", 72 "title": "The Electronic Hypnerotomachia", 73 "year": "1999", 74 "pub_type": "book", 75 "journal": "MIT Press (digital edition)", 76 "hp_relevance": "PRIMARY", 77 "topic_cluster": "text_image", 78 "url": "https://mitp-content-server.mit.edu/books/content/sectbyfn/books_pres_0/4196/HP.zip/hyptext1.htm", 79 "notes": "Electronic text with typographic information. Companion to Lefaivre 1997.", 80 "source_method": "WEB_SEARCH", 81 "needs_verification": False, 82 }, 83 84 # Routledge volume 85 { 86 "author": "Various (ed. unknown)", 87 "title": "Francesco Colonna's Hypnerotomachia Poliphili and Its European Context", 88 "year": "2023", 89 "pub_type": "book", 90 "journal": "Routledge (Anglo-Italian Renaissance Studies)", 91 "hp_relevance": "DIRECT", 92 "topic_cluster": "reception", 93 "url": "https://api.pageplace.de/preview/DT0400.9781000911848_A46453224/preview-9781000911848_A46453224.pdf", 94 "notes": "Chapters on narrative, architecture, travel, love, self-transformation. Via HPPERPLEXITY.txt.", 95 "source_method": "WEB_SEARCH", 96 "needs_verification": True, 97 }, 98 99 # Music / creative works inspired by HP 100 { 101 "author": "Alexander Moosbrugger", 102 "title": "Wind (opera based on Hypnerotomachia Poliphili)", 103 "year": "2021", 104 "pub_type": "book", 105 "journal": "Contemporary opera", 106 "hp_relevance": "INDIRECT", 107 "topic_cluster": "reception", 108 "notes": "Libretto drawn from German and English HP translations. Via HPPERPLEXITY.txt.", 109 "source_method": "WEB_SEARCH", 110 "needs_verification": True, 111 }, 112 { 113 "author": "Sagenhaft", 114 "title": "Hypnerotomachia (dungeon synth EP)", 115 "year": "2021", 116 "pub_type": "book", 117 "journal": "Moonlit Castle Records", 118 "hp_relevance": "INDIRECT", 119 "topic_cluster": "reception", 120 "notes": "4-track EP inspired by the HP. Dungeon synth genre. Via HPPERPLEXITY.txt.", 121 "source_method": "WEB_SEARCH", 122 "needs_verification": True, 123 }, 124 125 # The Codex 99 essay - important web resource 126 { 127 "author": "Codex 99", 128 "title": "The Hypnerotomachia Poliphili (typographic essay)", 129 "year": None, 130 "pub_type": "article", 131 "journal": "Codex 99 (web)", 132 "hp_relevance": "INDIRECT", 133 "topic_cluster": "material_bibliographic", 134 "url": "http://www.codex99.com/typography/82.html", 135 "notes": "Substantial web essay on printing, typography, and images with links to digitized copies.", 136 "source_method": "WEB_SEARCH", 137 "needs_verification": False, 138 }, 139] 140 141# Timeline events from Perplexity findings 142NEW_TIMELINE = [ 143 (2021, None, 'OTHER', "Moosbrugger's opera Wind premieres", 144 "German composer Alexander Moosbrugger uses HP translations as libretto for opera Wind.", 145 'reception'), 146 (2016, None, 'PUBLICATION', 'Botanical content study published', 147 'Study cataloguing 285 plant entities referenced in the HP text.', 148 'architecture_gardens'), 149 (2020, None, 'PUBLICATION', 'Music and its powers study published', 150 'Musicological analysis of musical episodes and Ficinian spiritus in the HP.', 151 'text_image'), 152] 153 154 155def main(): 156 conn = sqlite3.connect(DB_PATH) 157 cur = conn.cursor() 158 159 print("Ingesting HPPERPLEXITY.txt entries...\n") 160 161 inserted = 0 162 skipped = 0 163 for e in NEW_ENTRIES: 164 # Check if already exists 165 cur.execute( 166 "SELECT id FROM bibliography WHERE title = ?", 167 (e["title"],) 168 ) 169 if cur.fetchone(): 170 skipped += 1 171 continue 172 173 cur.execute(""" 174 INSERT INTO bibliography 175 (author, title, year, pub_type, journal_or_publisher, 176 hp_relevance, topic_cluster, notes, 177 in_collection, review_status, needs_review) 178 VALUES (?, ?, ?, ?, ?, ?, ?, ?, 0, 'UNREVIEWED', 1) 179 """, (e["author"], e["title"], e.get("year"), 180 e["pub_type"], e.get("journal", ""), 181 e["hp_relevance"], e.get("topic_cluster", ""), 182 e.get("notes", ""))) 183 inserted += 1 184 185 conn.commit() 186 print(f" Inserted {inserted} new bibliography entries (skipped {skipped} duplicates)") 187 188 # Timeline events 189 print("\nInserting timeline events...") 190 tl_inserted = 0 191 for year, year_end, evt_type, title, desc, topic in NEW_TIMELINE: 192 cur.execute( 193 "SELECT id FROM timeline_events WHERE title = ?", (title,) 194 ) 195 if not cur.fetchone(): 196 cur.execute(""" 197 INSERT INTO timeline_events 198 (year, year_end, event_type, title, description, needs_review, source_method) 199 VALUES (?, ?, ?, ?, ?, 1, 'WEB_SEARCH') 200 """, (year, year_end, evt_type, title, desc)) 201 tl_inserted += 1 202 conn.commit() 203 print(f" Inserted {tl_inserted} timeline events") 204 205 # Summary 206 cur.execute("SELECT COUNT(*) FROM bibliography") 207 total = cur.fetchone()[0] 208 cur.execute("SELECT COUNT(*) FROM bibliography WHERE in_collection = 1") 209 have = cur.fetchone()[0] 210 print(f"\nBibliography total: {total} entries ({have} in collection)") 211 212 conn.close() 213 print("Done.") 214 215 216if __name__ == "__main__": 217 main()