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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Configuration for the ML pipeline."""
|
| 2 |
+
|
| 3 |
+
import os
|
| 4 |
+
|
| 5 |
+
DB = {
|
| 6 |
+
"host": os.getenv("DB_HOST", "127.0.0.1"),
|
| 7 |
+
"port": int(os.getenv("DB_PORT", "5432")),
|
| 8 |
+
"dbname": os.getenv("DB_NAME", "epstein_research"),
|
| 9 |
+
"user": os.getenv("DB_USER", "epstein"),
|
| 10 |
+
"password": os.getenv("DB_PASSWORD", "di9vrLaJGskZrvlDRQJPtDYiFf3UCPl"),
|
| 11 |
+
}
|
| 12 |
+
|
| 13 |
+
RAW_DIR = "/data/raw"
|
| 14 |
+
|
| 15 |
+
# Use the existing venv's spaCy model
|
| 16 |
+
SPACY_MODEL = "en_core_web_lg"
|
| 17 |
+
|
| 18 |
+
# Zero-shot classification model
|
| 19 |
+
ZERO_SHOT_MODEL = "facebook/bart-large-mnli"
|
| 20 |
+
|
| 21 |
+
# Topic labels for zero-shot classification
|
| 22 |
+
TOPIC_LABELS = [
|
| 23 |
+
"national security",
|
| 24 |
+
"intelligence operations",
|
| 25 |
+
"assassination",
|
| 26 |
+
"military operations",
|
| 27 |
+
"civil rights",
|
| 28 |
+
"public health",
|
| 29 |
+
"government oversight",
|
| 30 |
+
"foreign policy",
|
| 31 |
+
"law enforcement",
|
| 32 |
+
"judicial proceedings",
|
| 33 |
+
"congressional legislation",
|
| 34 |
+
"scientific research",
|
| 35 |
+
"financial regulation",
|
| 36 |
+
"nuclear weapons",
|
| 37 |
+
"surveillance",
|
| 38 |
+
"propaganda",
|
| 39 |
+
"human experimentation",
|
| 40 |
+
"space exploration",
|
| 41 |
+
"terrorism",
|
| 42 |
+
"organized crime",
|
| 43 |
+
]
|
| 44 |
+
|
| 45 |
+
# Congress session date ranges (for date estimation from filenames)
|
| 46 |
+
CONGRESS_DATES = {
|
| 47 |
+
80: ("1947-01-03", "1949-01-03"),
|
| 48 |
+
81: ("1949-01-03", "1951-01-03"),
|
| 49 |
+
82: ("1951-01-03", "1953-01-03"),
|
| 50 |
+
103: ("1993-01-05", "1995-01-03"),
|
| 51 |
+
104: ("1995-01-04", "1997-01-03"),
|
| 52 |
+
105: ("1997-01-07", "1999-01-03"),
|
| 53 |
+
106: ("1999-01-06", "2001-01-03"),
|
| 54 |
+
107: ("2001-01-03", "2003-01-03"),
|
| 55 |
+
108: ("2003-01-07", "2005-01-03"),
|
| 56 |
+
109: ("2005-01-04", "2007-01-03"),
|
| 57 |
+
110: ("2007-01-04", "2009-01-03"),
|
| 58 |
+
111: ("2009-01-06", "2011-01-03"),
|
| 59 |
+
112: ("2011-01-05", "2013-01-03"),
|
| 60 |
+
113: ("2013-01-03", "2015-01-03"),
|
| 61 |
+
114: ("2015-01-06", "2017-01-03"),
|
| 62 |
+
115: ("2017-01-03", "2019-01-03"),
|
| 63 |
+
116: ("2019-01-03", "2021-01-03"),
|
| 64 |
+
117: ("2021-01-03", "2023-01-03"),
|
| 65 |
+
118: ("2023-01-03", "2025-01-03"),
|
| 66 |
+
119: ("2025-01-03", "2027-01-03"),
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
# Historical events for crisis correlation
|
| 70 |
+
HISTORICAL_EVENTS = [
|
| 71 |
+
{
|
| 72 |
+
"name": "Lincoln Assassination",
|
| 73 |
+
"start": "1865-04-14",
|
| 74 |
+
"end": "1865-07-07",
|
| 75 |
+
"category": "assassination",
|
| 76 |
+
"keywords": ["lincoln", "booth", "ford's theatre", "assassination", "conspirator"],
|
| 77 |
+
},
|
| 78 |
+
{
|
| 79 |
+
"name": "Civil War End / Reconstruction",
|
| 80 |
+
"start": "1865-04-09",
|
| 81 |
+
"end": "1877-03-31",
|
| 82 |
+
"category": "war",
|
| 83 |
+
"keywords": ["reconstruction", "appomattox", "confederate", "freedmen", "civil war"],
|
| 84 |
+
},
|
| 85 |
+
{
|
| 86 |
+
"name": "Bay of Pigs Invasion",
|
| 87 |
+
"start": "1961-04-17",
|
| 88 |
+
"end": "1961-04-20",
|
| 89 |
+
"category": "military",
|
| 90 |
+
"keywords": ["bay of pigs", "cuba", "castro", "brigade 2506"],
|
| 91 |
+
},
|
| 92 |
+
{
|
| 93 |
+
"name": "Cuban Missile Crisis",
|
| 94 |
+
"start": "1962-10-16",
|
| 95 |
+
"end": "1962-10-28",
|
| 96 |
+
"category": "nuclear",
|
| 97 |
+
"keywords": ["cuban missile", "nuclear", "blockade", "khrushchev"],
|
| 98 |
+
},
|
| 99 |
+
{
|
| 100 |
+
"name": "JFK Assassination",
|
| 101 |
+
"start": "1963-11-22",
|
| 102 |
+
"end": "1964-09-24",
|
| 103 |
+
"category": "assassination",
|
| 104 |
+
"keywords": ["kennedy", "oswald", "dallas", "warren commission", "grassy knoll", "dealey plaza"],
|
| 105 |
+
},
|
| 106 |
+
{
|
| 107 |
+
"name": "Gulf of Tonkin Incident",
|
| 108 |
+
"start": "1964-08-02",
|
| 109 |
+
"end": "1964-08-07",
|
| 110 |
+
"category": "military",
|
| 111 |
+
"keywords": ["gulf of tonkin", "vietnam", "tonkin resolution"],
|
| 112 |
+
},
|
| 113 |
+
{
|
| 114 |
+
"name": "MLK Assassination",
|
| 115 |
+
"start": "1968-04-04",
|
| 116 |
+
"end": "1968-04-04",
|
| 117 |
+
"category": "assassination",
|
| 118 |
+
"keywords": ["martin luther king", "mlk", "james earl ray", "memphis"],
|
| 119 |
+
},
|
| 120 |
+
{
|
| 121 |
+
"name": "RFK Assassination",
|
| 122 |
+
"start": "1968-06-05",
|
| 123 |
+
"end": "1968-06-06",
|
| 124 |
+
"category": "assassination",
|
| 125 |
+
"keywords": ["robert kennedy", "rfk", "sirhan", "ambassador hotel"],
|
| 126 |
+
},
|
| 127 |
+
{
|
| 128 |
+
"name": "Watergate Scandal",
|
| 129 |
+
"start": "1972-06-17",
|
| 130 |
+
"end": "1974-08-09",
|
| 131 |
+
"category": "scandal",
|
| 132 |
+
"keywords": ["watergate", "nixon", "impeach", "cover-up", "plumbers"],
|
| 133 |
+
},
|
| 134 |
+
{
|
| 135 |
+
"name": "Church Committee Investigations",
|
| 136 |
+
"start": "1975-01-27",
|
| 137 |
+
"end": "1976-04-29",
|
| 138 |
+
"category": "oversight",
|
| 139 |
+
"keywords": ["church committee", "intelligence abuses", "cointelpro", "mkultra", "assassination plots"],
|
| 140 |
+
},
|
| 141 |
+
{
|
| 142 |
+
"name": "MKUltra Program",
|
| 143 |
+
"start": "1953-04-13",
|
| 144 |
+
"end": "1973-01-01",
|
| 145 |
+
"category": "human_experimentation",
|
| 146 |
+
"keywords": ["mkultra", "mind control", "lsd", "behavioral", "gottlieb", "subproject"],
|
| 147 |
+
},
|
| 148 |
+
{
|
| 149 |
+
"name": "CIA Stargate / Remote Viewing Program",
|
| 150 |
+
"start": "1978-01-01",
|
| 151 |
+
"end": "1995-06-30",
|
| 152 |
+
"category": "intelligence",
|
| 153 |
+
"keywords": ["stargate", "remote viewing", "psychic", "grill flame", "sun streak"],
|
| 154 |
+
},
|
| 155 |
+
{
|
| 156 |
+
"name": "Iran-Contra Affair",
|
| 157 |
+
"start": "1985-08-01",
|
| 158 |
+
"end": "1987-11-18",
|
| 159 |
+
"category": "scandal",
|
| 160 |
+
"keywords": ["iran-contra", "contras", "nicaragua", "oliver north", "arms sales"],
|
| 161 |
+
},
|
| 162 |
+
{
|
| 163 |
+
"name": "Area 51 / U-2 Program",
|
| 164 |
+
"start": "1955-01-01",
|
| 165 |
+
"end": "1998-12-31",
|
| 166 |
+
"category": "intelligence",
|
| 167 |
+
"keywords": ["area 51", "groom lake", "u-2", "oxcart", "a-12", "classified aircraft"],
|
| 168 |
+
},
|
| 169 |
+
{
|
| 170 |
+
"name": "September 11 Attacks",
|
| 171 |
+
"start": "2001-09-11",
|
| 172 |
+
"end": "2001-12-31",
|
| 173 |
+
"category": "terrorism",
|
| 174 |
+
"keywords": ["september 11", "9/11", "world trade center", "pentagon", "al-qaeda", "bin laden"],
|
| 175 |
+
},
|
| 176 |
+
{
|
| 177 |
+
"name": "PATRIOT Act Passage",
|
| 178 |
+
"start": "2001-10-26",
|
| 179 |
+
"end": "2001-10-26",
|
| 180 |
+
"category": "legislation",
|
| 181 |
+
"keywords": ["patriot act", "surveillance", "domestic spying", "fisa"],
|
| 182 |
+
},
|
| 183 |
+
{
|
| 184 |
+
"name": "Iraq War Authorization",
|
| 185 |
+
"start": "2002-10-10",
|
| 186 |
+
"end": "2003-05-01",
|
| 187 |
+
"category": "military",
|
| 188 |
+
"keywords": ["iraq war", "weapons of mass destruction", "wmd", "saddam", "authorization for use"],
|
| 189 |
+
},
|
| 190 |
+
{
|
| 191 |
+
"name": "Snowden NSA Revelations",
|
| 192 |
+
"start": "2013-06-05",
|
| 193 |
+
"end": "2013-12-31",
|
| 194 |
+
"category": "surveillance",
|
| 195 |
+
"keywords": ["snowden", "nsa", "prism", "mass surveillance", "metadata"],
|
| 196 |
+
},
|
| 197 |
+
{
|
| 198 |
+
"name": "COVID-19 Pandemic",
|
| 199 |
+
"start": "2020-01-20",
|
| 200 |
+
"end": "2023-05-11",
|
| 201 |
+
"category": "pandemic",
|
| 202 |
+
"keywords": ["covid", "coronavirus", "pandemic", "lockdown", "vaccine"],
|
| 203 |
+
},
|
| 204 |
+
{
|
| 205 |
+
"name": "January 6 Capitol Attack",
|
| 206 |
+
"start": "2021-01-06",
|
| 207 |
+
"end": "2022-12-22",
|
| 208 |
+
"category": "insurrection",
|
| 209 |
+
"keywords": ["january 6", "capitol", "insurrection", "electoral college", "certification"],
|
| 210 |
+
},
|
| 211 |
+
]
|
| 212 |
+
|
| 213 |
+
BATCH_SIZE = 500
|