Models¶
The data models returned throughout OpenCite. Paper is the central record;
IDSet is the frozen, immutable bundle of identifiers that makes cross-API
lookup and deduplication possible.
models ¶
Data models for opencite.
Paper
dataclass
¶
Central data model for an academic paper.
Designed to be populated incrementally: a search fills basic fields, then enrichment passes add TLDR, PDF locations, etc.
Source code in src/opencite/models.py
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 | |
Author
dataclass
¶
Structured author representation.
Source code in src/opencite/models.py
citation_name ¶
IDSet
dataclass
¶
All known identifiers for a single paper.
Immutable so it can be used for dedup lookups.
Source code in src/opencite/models.py
best_lookup_id ¶
Return the most useful ID for cross-API lookup.
Priority: DOI > PMID > PMCID > S2 > OpenAlex > ArXiv.
Source code in src/opencite/models.py
merge ¶
Create a new IDSet with the union of both sets' identifiers.
Source code in src/opencite/models.py
Source
dataclass
¶
PDFLocation
dataclass
¶
A known location where a PDF can be retrieved.
Source code in src/opencite/models.py
SearchResult
dataclass
¶
CitationResult
dataclass
¶
parse_identifier ¶
Auto-detect identifier type from a raw string.
Formats
10.xxx/yyy -> DOI pmid:12345 -> PMID pmc:PMC12345 -> PMCID PMC12345 -> PMCID arxiv:2106.15928 -> ArXiv 2106.15928[vN] -> ArXiv (bare new-style ID) cs.LG/0101001 -> ArXiv (bare old-style ID) https://arxiv.org/abs/… -> ArXiv (URL) https://arxiv.org/pdf/… -> ArXiv (URL) https://www.biorxiv.org/content/… -> DOI extracted from URL https://www.medrxiv.org/content/… -> DOI extracted from URL W1234567890 -> OpenAlex 40-char hex -> S2 paper ID
Source code in src/opencite/models.py
236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 | |