Q&A-2Design and defend a knowledge-data workflow for namespaced accessions.
Answer
Core answer (first 90 seconds)
Assume a knowledge base that ingests from several providers, stores entities, and exports to downstream consumers: the same entity arrives under different identifiers and prefixes get deprecated. My design is two-layer identity. The primary key is an internal surrogate that never changes. The external identity is a CURIE: prefix:accession, e.g. HGNC:11998, UniProtKB:P04637, GO:0008150: stored as a unique index next to a version and a resolution timestamp. Every prefix is resolved through a registry (identifiers.org, OBO Foundry PURLs, Bioregistry) at ingest time; nothing is hardcoded. That gives stable joins internally and portable identity at the boundary.
Workflow
- Ingest and normalize (pipeline). Reject anything failing the CURIE regex
^[A-Za-z][A-Za-z0-9._-]*:[A-Za-z0-9._:-]+$. Trim whitespace, lowercase the prefix, preserve accession case. - Registry lookup (pipeline). Prefix → namespace, expected entity type, URL pattern, status (active / deprecated / replaced-by).
- Type and species check. The resolved record's entity type must match the expected type, and its taxid must match the expected taxid (9606 for human).
- Version pin. Store accession + provider version + resolution timestamp + registry snapshot hash.
- Resolve and cache. Fetch via the registry URL, cache with a TTL, fall back to the stored snapshot when the provider is down.
- Store. Surrogate PK, CURIE unique index, version column.
- Monitor. Unresolved rate, deprecated-prefix count, resolver error rate.
Trade-offs
| option | stability | readable | resolution cost | collision risk | use it for |
|---|---|---|---|---|---|
compact CURIE HGNC:11998 | prefix can be deprecated | high | one registry lookup | low if registry-checked | storage, joins, APIs |
URI https://identifiers.org/hgnc:11998 | host can move | medium | none, self-resolving | low | citations, exports, RDF |
internal surrogate 8812 | never changes | none | none | none | primary key, foreign keys |
Defense: CURIE is the stored external identity because it survives a host change; the URI is generated only at export; the surrogate is the PK because prefixes do get deprecated and you do not want to rewrite foreign keys when they do. If your consumers are all RDF, invert this and store the URI, accepting that a provider host move becomes a migration.
Failure modes
| failure | mechanism | detection |
|---|---|---|
| namespace collision | two registries register the same prefix for different entity types | registry lookup returns >1 namespace, or resolved entity type ≠ expected |
| deprecated prefix | registry marks the prefix replaced-by another | registry status field = deprecated |
| wrong species | accession is valid but from another organism | taxid on record ≠ expected taxid |
| URL stored as identity | provider changes host, key breaks | key fails the CURIE regex |
| provider outage | resolver returns 5xx or times out | resolver error rate; fall back to snapshot |
| spreadsheet coercion | Excel turns 1-2 into a date, long digits into 1.23E+15 | round-trip test on ingest |
Trace
Ingest P04637 → prefix uniprotkb → registry returns namespace, entity type protein, URL pattern → resolve → record taxid 9606, expected 9606 → store surrogate 8812, curie UniProtKB:P04637, version from the provider, resolved_at now. Later the provider moves its host: the CURIE is unchanged, only the registry URL pattern changes, and the snapshot keeps reads working until the next successful resolve.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.