SPB Git forge

spb/cancerindex

Public
37commits 1branches 0releases
2.9 MBsize
maindefault branch
10 days agolast push
TypeScript 97.2% SQL 1.5% CSS 0.6% JavaScript 0.5%

Foundation for wave 3: intelligence schema (trial_intelligence, trial_site_country_counts, drug_pipeline, drug_codes, research_gap_components; migration 0002), trial intervention→drug reconciliation (alias/salt-stripped/probabilistic), new metric definitions (trial growth, termination share, sponsor HHI, per-1000-deaths, gap ratios), maintenance.intel job, API route stubs (epidemiology/approvals/graph/intelligence), navigation restructure

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Simon-Pierre Boucher committed 13 days ago (Sep 11, 2026) parent 718f988

27 changed files +8,980 −12

modified apps/api/src/app.ts +12 −0
@@ -26,6 +26,10 @@ import { sourceRoutes } from './routes/sources.js';
26 26 import { statsRoutes } from './routes/stats.js';
27 27 import { changeRoutes } from './routes/changes.js';
28 28 import { adminRoutes } from './routes/admin.js';
29 +import { graphRoutes } from './routes/graph.js';
30 +import { epidemiologyRoutes } from './routes/epidemiology.js';
31 +import { approvalRoutes } from './routes/approvals.js';
32 +import { intelligenceRoutes } from './routes/intelligence.js';
29 33
30 34 export interface BuildOptions {
31 35 db?: Database;
@@ -103,6 +107,10 @@ export async function buildApp(opts: BuildOptions = {}): Promise<FastifyInstance
103 107 { name: 'sources', description: 'Source registry, licenses, connector health' },
104 108 { name: 'stats' },
105 109 { name: 'changes' },
110 + { name: 'epidemiology', description: 'Time-aware incidence/mortality/prevalence observations with provenance (Data Explorer)' },
111 + { name: 'approvals', description: 'Jurisdiction-aware regulatory approvals and the drug development pipeline' },
112 + { name: 'graph', description: 'Cancer–gene–variant–drug–trial knowledge graph (contextual neighbourhoods)' },
113 + { name: 'intelligence', description: 'Derived clinical-trial intelligence and research-gap components (computed metrics with formula versions)' },
106 114 { name: 'admin', description: 'Operator endpoints (x-admin-token)' },
107 115 { name: 'system' },
108 116 ],
@@ -152,6 +160,10 @@ export async function buildApp(opts: BuildOptions = {}): Promise<FastifyInstance
152 160 await v1.register(sourceRoutes);
153 161 await v1.register(statsRoutes);
154 162 await v1.register(changeRoutes);
163 + await v1.register(epidemiologyRoutes);
164 + await v1.register(approvalRoutes);
165 + await v1.register(graphRoutes);
166 + await v1.register(intelligenceRoutes);
155 167 await v1.register(adminRoutes, { prefix: '/admin' });
156 168 },
157 169 { prefix: '/v1' },
modified apps/api/src/lib/queue.ts +1 −0
@@ -8,6 +8,7 @@ export const JOBS = {
8 8 connectorRun: 'connector.run',
9 9 counters: 'maintenance.counters',
10 10 rank: 'maintenance.rank',
11 + intel: 'maintenance.intel',
11 12 healthProbe: 'health.probe',
12 13 } as const;
13 14 export type JobName = (typeof JOBS)[keyof typeof JOBS];
added apps/api/src/routes/approvals.ts +10 −0
@@ -0,0 +1,10 @@
1 +import type { FastifyPluginAsyncZod } from 'fastify-type-provider-zod';
2 +
3 +/**
4 + * Regulatory routes (SPEC §13-15, §63): `GET /approvals` (jurisdiction-aware, dated, filterable by
5 + * authority, cancer, drug, date range), `GET /approvals/recent`, `GET /pipeline` (drug development
6 + * stages). Filled by the Approvals & Pipeline work package.
7 + */
8 +export const approvalRoutes: FastifyPluginAsyncZod = async (_app) => {
9 + /* routes added by the approvals work package */
10 +};
added apps/api/src/routes/epidemiology.ts +10 −0
@@ -0,0 +1,10 @@
1 +import type { FastifyPluginAsyncZod } from 'fastify-type-provider-zod';
2 +
3 +/**
4 + * Epidemiology routes (SPEC §20, §63, §110): `GET /epidemiology` → observations filtered by metric,
5 + * cancer, geography, sex, age group and year range; `GET /epidemiology/coverage` → which
6 + * metric × geography × year combinations exist. Filled by the Data Explorer work package.
7 + */
8 +export const epidemiologyRoutes: FastifyPluginAsyncZod = async (_app) => {
9 + /* routes added by the data-explorer work package */
10 +};
added apps/api/src/routes/graph.ts +10 −0
@@ -0,0 +1,10 @@
1 +import type { FastifyPluginAsyncZod } from 'fastify-type-provider-zod';
2 +
3 +/**
4 + * Knowledge-graph routes (SPEC §18, §80): `GET /graph/:type/:id` → contextual neighbours of one
5 + * entity (cancer | gene | variant | drug | biomarker | trial) with relationship type, cancer context,
6 + * evidence level and provenance on every edge. Filled by the Knowledge Graph work package.
7 + */
8 +export const graphRoutes: FastifyPluginAsyncZod = async (_app) => {
9 + /* routes added by the knowledge-graph work package */
10 +};
added apps/api/src/routes/intelligence.ts +18 −0
@@ -0,0 +1,18 @@
1 +import type { FastifyPluginAsyncZod } from 'fastify-type-provider-zod';
2 +
3 +/**
4 + * Intelligence routes (SPEC §10-11, §34): `GET /trials/intelligence` (per-cancer trial metrics),
5 + * `GET /trials/sites` (country/city aggregates for the map), `GET /research-gap` (components and
6 + * ratios per scope). Filled by the Trial Intelligence and Research Gap work packages
7 + * (each adds its own routes to this file; keep route groups in separate functions).
8 + */
9 +export const intelligenceRoutes: FastifyPluginAsyncZod = async (app) => {
10 + await app.register(trialIntelligenceRoutes);
11 + await app.register(researchGapRoutes);
12 +};
13 +
14 +/** Filled by the Trial Intelligence work package. */
15 +export const trialIntelligenceRoutes: FastifyPluginAsyncZod = async (_app) => {};
16 +
17 +/** Filled by the Research Gap work package. */
18 +export const researchGapRoutes: FastifyPluginAsyncZod = async (_app) => {};
modified apps/web/src/components/layout/mobile-nav.tsx +2 −2
@@ -1,6 +1,6 @@
1 1 import Link from 'next/link';
2 2 import { Menu } from 'lucide-react';
3 −import { NAV, FOOTER_NAV } from '@/lib/site';
3 +import { NAV, MORE_NAV, FOOTER_NAV } from '@/lib/site';
4 4
5 5 /** CSS-only disclosure menu for small screens (no client JS). */
6 6 export function MobileNav() {
@@ -16,7 +16,7 @@ export function MobileNav() {
16 16 </Link>
17 17 ))}
18 18 <div className="my-1 border-t border-rule" />
19 − {FOOTER_NAV.filter((f) => !NAV.some((n) => n.href === f.href)).map((n) => (
19 + {[...MORE_NAV, ...FOOTER_NAV.filter((f) => !NAV.some((n) => n.href === f.href) && !MORE_NAV.some((m) => m.href === f.href))].map((n) => (
20 20 <Link key={n.href} href={n.href} className="block px-3 py-1.5 text-[13px] text-ink-2 no-underline hover:bg-paper-2">
21 21 {n.label}
22 22 </Link>
modified apps/web/src/lib/site.ts +20 −5
@@ -7,13 +7,24 @@ export const CONTACT_EMAIL = 'corrections@cancerindex.io';
7 7
8 8 export const NAV = [
9 9 { href: '/cancers', label: 'Cancers' },
10 − { href: '/taxonomy', label: 'Taxonomy' },
10 + { href: '/explore', label: 'Data' },
11 + { href: '/trials', label: 'Trials' },
12 + { href: '/drugs', label: 'Drugs' },
13 + { href: '/genes', label: 'Genes' },
14 + { href: '/approvals', label: 'Approvals' },
11 15 { href: '/rankings', label: 'Rankings' },
16 + { href: '/research-gap', label: 'Research gap' },
17 + { href: '/graph', label: 'Graph' },
18 +] as const;
19 +
20 +/** Secondary navigation (mobile menu + footer): everything not in the primary bar. */
21 +export const MORE_NAV = [
22 + { href: '/taxonomy', label: 'Taxonomy' },
12 23 { href: '/countries', label: 'Countries' },
13 24 { href: '/compare', label: 'Compare' },
14 − { href: '/genes', label: 'Genes' },
15 − { href: '/drugs', label: 'Drugs' },
16 − { href: '/trials', label: 'Trials' },
25 + { href: '/trials/intelligence', label: 'Trial intelligence' },
26 + { href: '/trials/map', label: 'Trial map' },
27 + { href: '/pipeline', label: 'Drug pipeline' },
17 28 { href: '/sources', label: 'Sources' },
18 29 { href: '/methodology', label: 'Methodology' },
19 30 ] as const;
@@ -21,10 +32,14 @@ export const NAV = [
21 32 export const FOOTER_NAV = [
22 33 { href: '/about', label: 'About' },
23 34 { href: '/trust', label: 'Trust & policies' },
35 + { href: '/explore', label: 'Data explorer' },
24 36 { href: '/data', label: 'Data downloads' },
25 − { href: '/developers', label: 'Developers' },
37 + { href: '/developers', label: 'Developers (API)' },
26 38 { href: '/sources', label: 'Sources' },
27 39 { href: '/methodology', label: 'Methodology' },
40 + { href: '/taxonomy', label: 'Taxonomy' },
41 + { href: '/countries', label: 'Countries' },
42 + { href: '/compare', label: 'Compare' },
28 43 ] as const;
29 44
30 45 /** External identifier browsers (chips on cancer pages link out to the authority). */
added packages/connectors/src/connectors/clinicaltrials/drugs.test.ts +39 −0
@@ -0,0 +1,39 @@
1 +import { describe, expect, it } from 'vitest';
2 +import { stripToMolecule, NON_DRUG_RE } from './drugs.js';
3 +
4 +describe('stripToMolecule (trial intervention → molecule)', () => {
5 + it('strips leading registry labels', () => {
6 + expect(stripToMolecule('Drug: Cisplatin')).toBe('cisplatin');
7 + expect(stripToMolecule('Biological: Pembrolizumab')).toBe('pembrolizumab');
8 + });
9 + it('strips salts and esters', () => {
10 + expect(stripToMolecule('Doxorubicin Hydrochloride')).toBe('doxorubicin');
11 + expect(stripToMolecule('Gemcitabine Hydrochloride Injection')).toBe('gemcitabine');
12 + expect(stripToMolecule('Imatinib Mesylate')).toBe('imatinib');
13 + expect(stripToMolecule('Vincristine Sulfate')).toBe('vincristine');
14 + });
15 + it('strips doses, routes and parentheticals', () => {
16 + expect(stripToMolecule('Pembrolizumab 200 mg IV')).toBe('pembrolizumab');
17 + expect(stripToMolecule('Pembrolizumab (MK-3475)')).toBe('pembrolizumab');
18 + expect(stripToMolecule('Oral capecitabine 1000 mg/m2')).toBe('capecitabine');
19 + });
20 + it('returns null when nothing changes (pass 1 already covered it)', () => {
21 + expect(stripToMolecule('Pembrolizumab')).toBeNull();
22 + expect(stripToMolecule('nab-paclitaxel')).toBeNull();
23 + });
24 + it('never collapses a distinct product to its parent molecule', () => {
25 + // "protein bound" is not a salt/formulation token: the qualifier is kept, so the label is either
26 + // unchanged (null → stays in pass 1 territory) or only loses its dose.
27 + expect(stripToMolecule('Paclitaxel protein-bound')).toBeNull();
28 + expect(stripToMolecule('Paclitaxel protein-bound 100 mg/m2')).toBe('paclitaxel protein bound');
29 + });
30 +});
31 +
32 +describe('NON_DRUG_RE', () => {
33 + it('flags placebo / procedures / care as non-drugs', () => {
34 + for (const s of ['Placebo', 'placebo matching pembrolizumab', 'Standard of care', 'Best Supportive Care', 'Surgery', 'Radiation therapy']) expect(NON_DRUG_RE.test(s)).toBe(true);
35 + });
36 + it('lets molecule names through', () => {
37 + for (const s of ['Cisplatin', 'Dexamethasone', 'Placebo-controlled nivolumab']) expect(NON_DRUG_RE.test(s)).toBe(false);
38 + });
39 +});
added packages/connectors/src/connectors/clinicaltrials/drugs.ts +265 −0
@@ -0,0 +1,265 @@
1 +import { sql } from 'drizzle-orm';
2 +import type { Database } from '@cancerindex/database';
3 +import { normalizeLabel } from '@cancerindex/shared';
4 +
5 +/**
6 + * Trial intervention → canonical drug reconciliation (CLAUDE.md §69, §221; SPEC §9, §97).
7 + *
8 + * Registrants type intervention names freely ("Pembrolizumab", "MK-3475", "Keytruda 200 mg",
9 + * "Drug: cisplatin", "Doxorubicin Hydrochloride"). We reconcile in three deterministic passes, each
10 + * recorded as its own `match_type` so the UI can show how a link was made:
11 + *
12 + * 1. ALIAS — normalized name equals a `drug_aliases.normalized` (generic, brand,
13 + * development code or synonym) that maps to exactly one drug.
14 + * 2. ALIAS — the same after stripping registry noise: a leading "drug:"/"biological:"
15 + * label, dose/route suffixes ("200 mg", "iv", "tablets"), and a trailing salt
16 + * or ester ("hydrochloride", "sulfate", "acetate"…). Stored with `via` in the
17 + * normalized form so the strip is auditable.
18 + * 3. PROBABILISTIC — the first word of a multi-word name is itself an unambiguous generic alias
19 + * (e.g. "paclitaxel protein bound" → paclitaxel is *not* accepted here because
20 + * nab-paclitaxel is a distinct product; the pass is limited to names whose
21 + * remaining words are dose/route/formulation tokens only).
22 + *
23 + * Aliases that point to several drugs are skipped (ambiguous) — never guessed. Placebo, "standard
24 + * of care", procedures and classes are left UNRESOLVED on purpose; they are not drugs.
25 + *
26 + * Everything is set-based SQL (fast on ~250 k rows) and idempotent: rows already mapped are left
27 + * untouched unless `remap` is requested (after an alias-set change).
28 + */
29 +
30 +/** Salts / esters / counter-ions that name the same molecule (trailing tokens). */
31 +export const SALT_TOKENS = [
32 + 'hydrochloride',
33 + 'dihydrochloride',
34 + 'hcl',
35 + 'sulfate',
36 + 'sulphate',
37 + 'acetate',
38 + 'sodium',
39 + 'disodium',
40 + 'potassium',
41 + 'calcium',
42 + 'magnesium',
43 + 'mesylate',
44 + 'mesilate',
45 + 'dimesylate',
46 + 'citrate',
47 + 'tartrate',
48 + 'bitartrate',
49 + 'maleate',
50 + 'malate',
51 + 'fumarate',
52 + 'phosphate',
53 + 'diphosphate',
54 + 'succinate',
55 + 'tosylate',
56 + 'besylate',
57 + 'bromide',
58 + 'chloride',
59 + 'lactate',
60 + 'gluconate',
61 + 'pamoate',
62 + 'trihydrate',
63 + 'dihydrate',
64 + 'monohydrate',
65 + 'hydrate',
66 + 'anhydrous',
67 + 'ditosylate',
68 + 'camsylate',
69 + 'hemihydrate',
70 + 'hydrobromide',
71 + 'nitrate',
72 + 'oxalate',
73 + 'propionate',
74 + 'valerate',
75 + 'decanoate',
76 + 'enanthate',
77 + 'undecanoate',
78 + 'cypionate',
79 + 'pivalate',
80 + 'isethionate',
81 + 'trifluoroacetate',
82 +];
83 +
84 +/** Formulation / dose / route tokens that never change the molecule. */
85 +export const FORMULATION_TOKENS = [
86 + 'mg',
87 + 'mcg',
88 + 'ug',
89 + 'g',
90 + 'ml',
91 + 'iu',
92 + 'units',
93 + 'unit',
94 + 'tablet',
95 + 'tablets',
96 + 'capsule',
97 + 'capsules',
98 + 'injection',
99 + 'injections',
100 + 'infusion',
101 + 'solution',
102 + 'suspension',
103 + 'oral',
104 + 'iv',
105 + 'intravenous',
106 + 'subcutaneous',
107 + 'sc',
108 + 'im',
109 + 'intramuscular',
110 + 'topical',
111 + 'cream',
112 + 'gel',
113 + 'patch',
114 + 'kg',
115 + 'm2',
116 + 'daily',
117 + 'weekly',
118 + 'bid',
119 + 'qd',
120 + 'dose',
121 + 'doses',
122 + 'low',
123 + 'high',
124 + 'standard',
125 + 'extended',
126 + 'release',
127 + 'er',
128 + 'xr',
129 + 'sr',
130 + 'depot',
131 + 'vial',
132 + 'for',
133 + 'per',
134 + 'x',
135 +];
136 +
137 +const LEADING_LABEL = /^(drug|biological|biologic|medication|agent|intervention|treatment|arm [a-z0-9]+|experimental|active comparator|placebo comparator)\s*:\s*/i;
138 +
139 +/**
140 + * Pure normalizer for pass 2: label → salt/formulation-stripped normalized string, or null when
141 + * nothing changes (so pass 2 never repeats pass 1) or when the result is empty.
142 + */
143 +export function stripToMolecule(label: string): string | null {
144 + let s = label.replace(LEADING_LABEL, '');
145 + s = s.replace(/\([^)]*\)/g, ' '); // parentheticals: "(MK-3475)", "(200 mg)"
146 + s = s.replace(/\[[^\]]*\]/g, ' ');
147 + s = s.replace(/\b\d+(\.\d+)?\s*(mg|mcg|ug|g|ml|iu|units?)(\s*\/\s*(kg|m2|ml|day|d|week|wk|dose))?\b/gi, ' '); // doses
148 + s = s.replace(/\b\d+(\.\d+)?\s*%/g, ' ');
149 + let norm = normalizeLabel(s);
150 + if (!norm) return null;
151 + const tokens = norm.split(' ');
152 + // strip trailing salt / formulation tokens (repeat: "doxorubicin hydrochloride injection")
153 + while (tokens.length > 1) {
154 + const last = tokens[tokens.length - 1]!;
155 + if (SALT_TOKENS.includes(last) || FORMULATION_TOKENS.includes(last) || /^\d+(\.\d+)?$/.test(last)) tokens.pop();
156 + else break;
157 + }
158 + // strip leading formulation tokens ("oral capecitabine", "iv cisplatin")
159 + while (tokens.length > 1) {
160 + const first = tokens[0]!;
161 + if (FORMULATION_TOKENS.includes(first)) tokens.shift();
162 + else break;
163 + }
164 + norm = tokens.join(' ').trim();
165 + if (!norm || norm === normalizeLabel(label)) return null;
166 + return norm;
167 +}
168 +
169 +/** Names that are never a drug entity (kept UNRESOLVED without being queued as drug labels). */
170 +export const NON_DRUG_RE = /^(placebo|placebos|saline|normal saline|sham|vehicle|standard of care|standard care|best supportive care|supportive care|observation|no intervention|no treatment|control|usual care|chemotherapy|radiotherapy|radiation|radiation therapy|surgery|questionnaire|survey|blood draw|blood sample|biopsy|imaging|mri|ct scan|pet scan|exercise|diet|counseling|education|physical therapy|acupuncture|massage|yoga|music therapy|hypnosis|dexamethasone placebo)( .*)?$/i;
171 +
172 +export interface DrugReconcileResult {
173 + pass1: number;
174 + pass2: number;
175 + pass3: number;
176 + ambiguousSkipped: number;
177 + remainingUnresolved: number;
178 + distinctUnresolved: number;
179 +}
180 +
181 +/**
182 + * Set-based reconciliation of `trial_interventions` (DRUG/BIOLOGICAL rows) to `drugs`.
183 + * `remap = true` resets ALIAS/PROBABILISTIC rows first (after alias changes); default only fills
184 + * UNRESOLVED rows.
185 + */
186 +export async function reconcileInterventionDrugs(db: Database, opts: { remap?: boolean } = {}): Promise<DrugReconcileResult> {
187 + if (opts.remap) {
188 + await db.execute(sql`UPDATE trial_interventions SET drug_id = NULL, match_type = 'UNRESOLVED' WHERE intervention_type IN ('DRUG','BIOLOGICAL') AND match_type IN ('ALIAS','PROBABILISTIC')`);
189 + }
190 + // Unambiguous alias map: normalized → drug_id (aliases shared by several drugs are excluded).
191 + await db.execute(sql`CREATE TEMP TABLE IF NOT EXISTS _alias_map (normalized text PRIMARY KEY, drug_id varchar(32) NOT NULL)`);
192 + await db.execute(sql`TRUNCATE _alias_map`);
193 + await db.execute(sql`
194 + INSERT INTO _alias_map (normalized, drug_id)
195 + SELECT normalized, min(drug_id) FROM drug_aliases WHERE length(normalized) >= 3
196 + GROUP BY normalized HAVING count(DISTINCT drug_id) = 1`);
197 + const [amb] = await db.execute<{ n: string }>(sql`SELECT count(*)::text AS n FROM (SELECT normalized FROM drug_aliases GROUP BY normalized HAVING count(DISTINCT drug_id) > 1) x`);
198 +
199 + // Pass 1: exact normalized alias.
200 + const p1 = await db.execute<{ n: string }>(sql`
201 + WITH u AS (
202 + UPDATE trial_interventions ti SET drug_id = m.drug_id, match_type = 'ALIAS'
203 + FROM _alias_map m
204 + WHERE ti.intervention_type IN ('DRUG','BIOLOGICAL') AND ti.match_type = 'UNRESOLVED' AND ti.normalized = m.normalized
205 + RETURNING 1)
206 + SELECT count(*)::text AS n FROM u`);
207 +
208 + // Pass 2: salt/dose/label-stripped form. Distinct labels are stripped in JS (pure function) then
209 + // matched in one statement.
210 + const remaining = await db.execute<{ normalized: string; name: string }>(sql`
211 + SELECT normalized, min(name) AS name FROM trial_interventions
212 + WHERE intervention_type IN ('DRUG','BIOLOGICAL') AND match_type = 'UNRESOLVED' GROUP BY normalized`);
213 + const stripped: Array<[string, string]> = [];
214 + for (const r of remaining) {
215 + if (NON_DRUG_RE.test(r.name)) continue;
216 + const m = stripToMolecule(r.name);
217 + if (m) stripped.push([r.normalized, m]);
218 + }
219 + let p2 = 0;
220 + for (let i = 0; i < stripped.length; i += 2000) {
221 + const chunk = stripped.slice(i, i + 2000);
222 + const res = await db.execute<{ n: string }>(sql`
223 + WITH s(normalized, molecule) AS (SELECT * FROM unnest(${sql.param(chunk.map((c) => c[0]))}::text[], ${sql.param(chunk.map((c) => c[1]))}::text[])),
224 + u AS (
225 + UPDATE trial_interventions ti SET drug_id = m.drug_id, match_type = 'ALIAS'
226 + FROM s JOIN _alias_map m ON m.normalized = s.molecule
227 + WHERE ti.intervention_type IN ('DRUG','BIOLOGICAL') AND ti.match_type = 'UNRESOLVED' AND ti.normalized = s.normalized
228 + RETURNING 1)
229 + SELECT count(*)::text AS n FROM u`);
230 + p2 += Number(res[0]?.n ?? 0);
231 + }
232 +
233 + // Pass 3 (PROBABILISTIC): "<generic> <formulation words only>" where the generic is a *generic*
234 + // alias (not brand/synonym) — e.g. "cisplatin 75 mg/m2 iv d1" already handled by pass 2; this
235 + // catches "pembrolizumab injection solution" style remainders whose extra tokens are all
236 + // formulation tokens. Names with any non-formulation extra token stay UNRESOLVED.
237 + const rem2 = await db.execute<{ normalized: string; name: string }>(sql`
238 + SELECT normalized, min(name) AS name FROM trial_interventions
239 + WHERE intervention_type IN ('DRUG','BIOLOGICAL') AND match_type = 'UNRESOLVED' GROUP BY normalized`);
240 + const heads: Array<[string, string]> = [];
241 + for (const r of rem2) {
242 + if (NON_DRUG_RE.test(r.name)) continue;
243 + const tokens = r.normalized.split(' ');
244 + if (tokens.length < 2) continue;
245 + const rest = tokens.slice(1);
246 + if (rest.every((t) => FORMULATION_TOKENS.includes(t) || SALT_TOKENS.includes(t) || /^\d+(\.\d+)?$/.test(t))) heads.push([r.normalized, tokens[0]!]);
247 + }
248 + let p3 = 0;
249 + for (let i = 0; i < heads.length; i += 2000) {
250 + const chunk = heads.slice(i, i + 2000);
251 + const res = await db.execute<{ n: string }>(sql`
252 + WITH s(normalized, head) AS (SELECT * FROM unnest(${sql.param(chunk.map((c) => c[0]))}::text[], ${sql.param(chunk.map((c) => c[1]))}::text[])),
253 + g AS (SELECT a.normalized, min(a.drug_id) AS drug_id FROM drug_aliases a WHERE a.alias_type = 'generic' GROUP BY a.normalized HAVING count(DISTINCT a.drug_id) = 1),
254 + u AS (
255 + UPDATE trial_interventions ti SET drug_id = g.drug_id, match_type = 'PROBABILISTIC'
256 + FROM s JOIN g ON g.normalized = s.head
257 + WHERE ti.intervention_type IN ('DRUG','BIOLOGICAL') AND ti.match_type = 'UNRESOLVED' AND ti.normalized = s.normalized
258 + RETURNING 1)
259 + SELECT count(*)::text AS n FROM u`);
260 + p3 += Number(res[0]?.n ?? 0);
261 + }
262 +
263 + const [left] = await db.execute<{ n: string; d: string }>(sql`SELECT count(*)::text AS n, count(DISTINCT normalized)::text AS d FROM trial_interventions WHERE intervention_type IN ('DRUG','BIOLOGICAL') AND match_type = 'UNRESOLVED'`);
264 + return { pass1: Number(p1[0]?.n ?? 0), pass2: p2, pass3: p3, ambiguousSkipped: Number(amb?.n ?? 0), remainingUnresolved: Number(left?.n ?? 0), distinctUnresolved: Number(left?.d ?? 0) };
265 +}
modified packages/connectors/src/connectors/clinicaltrials/index.ts +4 −0
@@ -8,10 +8,12 @@ import { manifest } from './manifest.js';
8 8 import { ONCOLOGY_EXPRESSION, STUDY_FIELDS, normalizeStudy, trimStudyPayload, type ApiPage, type ApiStudy, type ApiVersion, type NormalizedTrial } from './normalize.js';
9 9 import { reconcileConditions, type ConditionMapping, type ResolverLike } from './reconcile.js';
10 10 import { refreshTrialPulse } from './pulse.js';
11 +import { reconcileInterventionDrugs } from './drugs.js';
11 12
12 13 export { ONCOLOGY_EXPRESSION, STUDY_FIELDS, normalizeStudy, trimStudyPayload } from './normalize.js';
13 14 export { reconcileConditions, conditionCandidates } from './reconcile.js';
14 15 export { refreshTrialPulse } from './pulse.js';
16 +export { reconcileInterventionDrugs, stripToMolecule, NON_DRUG_RE } from './drugs.js';
15 17
16 18 export const PAGE_SIZE = 1000;
17 19 /** Trigram suggestions are computed for at most this many unresolved labels per run (curation aid only). */
@@ -200,6 +202,8 @@ export class ClinicalTrialsConnector extends Connector {
200 202 const re = await this.rereconcileUnresolved(ctx, resolver);
201 203 const pulse = await refreshTrialPulse(ctx.db);
202 204 ctx.info(`re-reconciled ${re.labels} unresolved labels → ${re.rows} trial_conditions rows updated; trial_pulse rows ${pulse}`);
205 + const dr = await reconcileInterventionDrugs(ctx.db);
206 + ctx.info(`interventions → drugs: alias ${dr.pass1}, stripped ${dr.pass2}, probabilistic ${dr.pass3}; ambiguous aliases skipped ${dr.ambiguousSkipped}; still unresolved ${dr.remainingUnresolved} rows (${dr.distinctUnresolved} distinct labels)`);
203 207 }
204 208 const pct = agg.conditionsTotal ? Math.round((agg.conditionsResolved / agg.conditionsTotal) * 1000) / 10 : 0;
205 209 const top = [...agg.unresolved.values()].sort((a, b) => b.count - a.count).slice(0, 15).map((u) => `${u.sourceText} (${u.count})`);
modified packages/connectors/src/index.ts +1 −0
@@ -3,3 +3,4 @@ export * from './registry.js';
3 3 export * from './sources-sync.js';
4 4 export * from './planned.js';
5 5 export * from './ops/index.js';
6 +export { reconcileInterventionDrugs, stripToMolecule, NON_DRUG_RE, SALT_TOKENS, FORMULATION_TOKENS } from './connectors/clinicaltrials/drugs.js';
added packages/database/migrations/0002_dizzy_pete_wisdom.sql +126 −0
@@ -0,0 +1,126 @@
1 +CREATE TABLE "drug_codes" (
2 + "id" bigserial PRIMARY KEY NOT NULL,
3 + "drug_id" varchar(32) NOT NULL,
4 + "system" text NOT NULL,
5 + "code" text NOT NULL,
6 + "label" text,
7 + "match_type" text DEFAULT 'EXACT_IDENTIFIER' NOT NULL,
8 + "source_id" varchar(32)
9 +);
10 +--> statement-breakpoint
11 +CREATE TABLE "drug_pipeline" (
12 + "id" bigserial PRIMARY KEY NOT NULL,
13 + "drug_id" varchar(32) NOT NULL,
14 + "cancer_id" varchar(32),
15 + "stage" text NOT NULL,
16 + "max_phase" text,
17 + "active_trials" integer DEFAULT 0 NOT NULL,
18 + "recruiting_trials" integer DEFAULT 0 NOT NULL,
19 + "phase3_trials" integer DEFAULT 0 NOT NULL,
20 + "total_trials" integer DEFAULT 0 NOT NULL,
21 + "approvals" integer DEFAULT 0 NOT NULL,
22 + "jurisdictions" text[] DEFAULT '{}' NOT NULL,
23 + "first_approval_date" text,
24 + "latest_approval_date" text,
25 + "first_trial_date" text,
26 + "formula_version" text NOT NULL,
27 + "inputs" jsonb DEFAULT '{}'::jsonb NOT NULL,
28 + "updated_at" timestamp with time zone DEFAULT now() NOT NULL
29 +);
30 +--> statement-breakpoint
31 +CREATE TABLE "research_gap_components" (
32 + "id" bigserial PRIMARY KEY NOT NULL,
33 + "cancer_id" varchar(32) NOT NULL,
34 + "geography" text NOT NULL,
35 + "year" integer NOT NULL,
36 + "sex" text DEFAULT 'all' NOT NULL,
37 + "burden_source_id" varchar(32) NOT NULL,
38 + "deaths" double precision,
39 + "incidence" double precision,
40 + "active_trials" integer DEFAULT 0 NOT NULL,
41 + "phase3_trials" integer DEFAULT 0 NOT NULL,
42 + "publications_5y" integer DEFAULT 0 NOT NULL,
43 + "approved_drugs" integer DEFAULT 0 NOT NULL,
44 + "death_share" real,
45 + "trial_share" real,
46 + "publication_share" real,
47 + "trial_gap_ratio" real,
48 + "research_gap_ratio" real,
49 + "trials_per_1000_deaths" real,
50 + "publications_per_1000_deaths" real,
51 + "eligible" boolean DEFAULT true NOT NULL,
52 + "ineligible_reason" text,
53 + "formula_version" text NOT NULL,
54 + "inputs" jsonb DEFAULT '{}'::jsonb NOT NULL,
55 + "updated_at" timestamp with time zone DEFAULT now() NOT NULL
56 +);
57 +--> statement-breakpoint
58 +CREATE TABLE "trial_intelligence" (
59 + "id" bigserial PRIMARY KEY NOT NULL,
60 + "cancer_id" varchar(32) NOT NULL,
61 + "entity_level" text DEFAULT 'all' NOT NULL,
62 + "total_trials" integer DEFAULT 0 NOT NULL,
63 + "active_trials" integer DEFAULT 0 NOT NULL,
64 + "recruiting_trials" integer DEFAULT 0 NOT NULL,
65 + "phase1_active" integer DEFAULT 0 NOT NULL,
66 + "phase2_active" integer DEFAULT 0 NOT NULL,
67 + "phase3_active" integer DEFAULT 0 NOT NULL,
68 + "phase3_recruiting" integer DEFAULT 0 NOT NULL,
69 + "phase4_active" integer DEFAULT 0 NOT NULL,
70 + "completed_trials" integer DEFAULT 0 NOT NULL,
71 + "terminated_trials" integer DEFAULT 0 NOT NULL,
72 + "withdrawn_trials" integer DEFAULT 0 NOT NULL,
73 + "suspended_trials" integer DEFAULT 0 NOT NULL,
74 + "with_results" integer DEFAULT 0 NOT NULL,
75 + "new_trials_12m" integer DEFAULT 0 NOT NULL,
76 + "new_trials_prior_12m" integer DEFAULT 0 NOT NULL,
77 + "trial_growth_yoy" real,
78 + "avg_enrollment" real,
79 + "median_enrollment" real,
80 + "total_enrollment_active" integer,
81 + "distinct_sponsors" integer DEFAULT 0 NOT NULL,
82 + "industry_share" real,
83 + "sponsor_hhi" real,
84 + "top_sponsor" text,
85 + "top_sponsor_share" real,
86 + "distinct_countries" integer DEFAULT 0 NOT NULL,
87 + "us_share" real,
88 + "top_country" text,
89 + "top_country_share" real,
90 + "country_hhi" real,
91 + "termination_share" real,
92 + "why_stopped_breakdown" jsonb DEFAULT '{}'::jsonb NOT NULL,
93 + "trials_per_1000_deaths" real,
94 + "trials_per_100k_cases" real,
95 + "burden_geography" text,
96 + "burden_year" integer,
97 + "burden_source_id" varchar(32),
98 + "formula_version" text NOT NULL,
99 + "inputs" jsonb DEFAULT '{}'::jsonb NOT NULL,
100 + "updated_at" timestamp with time zone DEFAULT now() NOT NULL
101 +);
102 +--> statement-breakpoint
103 +CREATE TABLE "trial_site_country_counts" (
104 + "id" bigserial PRIMARY KEY NOT NULL,
105 + "cancer_id" varchar(32),
106 + "phase" text,
107 + "recruiting_only" boolean DEFAULT false NOT NULL,
108 + "country" text NOT NULL,
109 + "iso3" text,
110 + "sites" integer NOT NULL,
111 + "trials" integer NOT NULL,
112 + "formula_version" text NOT NULL,
113 + "updated_at" timestamp with time zone DEFAULT now() NOT NULL
114 +);
115 +--> statement-breakpoint
116 +CREATE UNIQUE INDEX "drug_codes_uq" ON "drug_codes" USING btree ("drug_id","system","code");--> statement-breakpoint
117 +CREATE INDEX "drug_codes_lookup_idx" ON "drug_codes" USING btree ("system","code");--> statement-breakpoint
118 +CREATE UNIQUE INDEX "drug_pipeline_uq" ON "drug_pipeline" USING btree ("drug_id","cancer_id");--> statement-breakpoint
119 +CREATE INDEX "drug_pipeline_stage_idx" ON "drug_pipeline" USING btree ("stage");--> statement-breakpoint
120 +CREATE INDEX "drug_pipeline_cancer_idx" ON "drug_pipeline" USING btree ("cancer_id","stage");--> statement-breakpoint
121 +CREATE UNIQUE INDEX "research_gap_components_uq" ON "research_gap_components" USING btree ("cancer_id","geography","year","sex","burden_source_id");--> statement-breakpoint
122 +CREATE INDEX "research_gap_scope_idx" ON "research_gap_components" USING btree ("geography","year","sex");--> statement-breakpoint
123 +CREATE UNIQUE INDEX "trial_intelligence_uq" ON "trial_intelligence" USING btree ("cancer_id","entity_level");--> statement-breakpoint
124 +CREATE INDEX "trial_intelligence_active_idx" ON "trial_intelligence" USING btree ("entity_level","active_trials");--> statement-breakpoint
125 +CREATE UNIQUE INDEX "trial_site_country_uq" ON "trial_site_country_counts" USING btree ("cancer_id","phase","recruiting_only","country");--> statement-breakpoint
126 +CREATE INDEX "trial_site_country_lookup_idx" ON "trial_site_country_counts" USING btree ("cancer_id","phase","recruiting_only");
\ No newline at end of file
added packages/database/migrations/meta/0002_snapshot.json +8029 −0
@@ -0,0 +1,8029 @@
1 +{
2 + "id": "a5612c71-46f1-44b1-b6d9-41f42464fd55",
3 + "prevId": "dc7abeda-b455-4b0f-86ae-e01f476fb4f0",
4 + "version": "7",
5 + "dialect": "postgresql",
6 + "tables": {
7 + "public.audit_log": {
8 + "name": "audit_log",
9 + "schema": "",
10 + "columns": {
11 + "id": {
12 + "name": "id",
13 + "type": "bigserial",
14 + "primaryKey": true,
15 + "notNull": true
16 + },
17 + "actor": {
18 + "name": "actor",
19 + "type": "text",
20 + "primaryKey": false,
21 + "notNull": true
22 + },
23 + "action": {
24 + "name": "action",
25 + "type": "text",
26 + "primaryKey": false,
27 + "notNull": true
28 + },
29 + "entity_type": {
30 + "name": "entity_type",
31 + "type": "text",
32 + "primaryKey": false,
33 + "notNull": false
34 + },
35 + "entity_id": {
36 + "name": "entity_id",
37 + "type": "text",
38 + "primaryKey": false,
39 + "notNull": false
40 + },
41 + "before": {
42 + "name": "before",
43 + "type": "jsonb",
44 + "primaryKey": false,
45 + "notNull": false
46 + },
47 + "after": {
48 + "name": "after",
49 + "type": "jsonb",
50 + "primaryKey": false,
51 + "notNull": false
52 + },
53 + "reason": {
54 + "name": "reason",
55 + "type": "text",
56 + "primaryKey": false,
57 + "notNull": false
58 + },
59 + "created_at": {
60 + "name": "created_at",
61 + "type": "timestamp with time zone",
62 + "primaryKey": false,
63 + "notNull": true,
64 + "default": "now()"
65 + }
66 + },
67 + "indexes": {},
68 + "foreignKeys": {},
69 + "compositePrimaryKeys": {},
70 + "uniqueConstraints": {},
71 + "policies": {},
72 + "checkConstraints": {},
73 + "isRLSEnabled": false
74 + },
75 + "public.change_events": {
76 + "name": "change_events",
77 + "schema": "",
78 + "columns": {
79 + "id": {
80 + "name": "id",
81 + "type": "bigserial",
82 + "primaryKey": true,
83 + "notNull": true
84 + },
85 + "entity_type": {
86 + "name": "entity_type",
87 + "type": "text",
88 + "primaryKey": false,
89 + "notNull": true
90 + },
91 + "entity_id": {
92 + "name": "entity_id",
93 + "type": "text",
94 + "primaryKey": false,
95 + "notNull": true
96 + },
97 + "kind": {
98 + "name": "kind",
99 + "type": "text",
100 + "primaryKey": false,
101 + "notNull": true
102 + },
103 + "summary": {
104 + "name": "summary",
105 + "type": "text",
106 + "primaryKey": false,
107 + "notNull": true
108 + },
109 + "before": {
110 + "name": "before",
111 + "type": "jsonb",
112 + "primaryKey": false,
113 + "notNull": false
114 + },
115 + "after": {
116 + "name": "after",
117 + "type": "jsonb",
118 + "primaryKey": false,
119 + "notNull": false
120 + },
121 + "ingest_run_id": {
122 + "name": "ingest_run_id",
123 + "type": "text",
124 + "primaryKey": false,
125 + "notNull": false
126 + },
127 + "created_at": {
128 + "name": "created_at",
129 + "type": "timestamp with time zone",
130 + "primaryKey": false,
131 + "notNull": true,
132 + "default": "now()"
133 + }
134 + },
135 + "indexes": {
136 + "change_events_entity_idx": {
137 + "name": "change_events_entity_idx",
138 + "columns": [
139 + {
140 + "expression": "entity_type",
141 + "isExpression": false,
142 + "asc": true,
143 + "nulls": "last"
144 + },
145 + {
146 + "expression": "entity_id",
147 + "isExpression": false,
148 + "asc": true,
149 + "nulls": "last"
150 + },
151 + {
152 + "expression": "created_at",
153 + "isExpression": false,
154 + "asc": true,
155 + "nulls": "last"
156 + }
157 + ],
158 + "isUnique": false,
159 + "concurrently": false,
160 + "method": "btree",
161 + "with": {}
162 + }
163 + },
164 + "foreignKeys": {},
165 + "compositePrimaryKeys": {},
166 + "uniqueConstraints": {},
167 + "policies": {},
168 + "checkConstraints": {},
169 + "isRLSEnabled": false
170 + },
171 + "public.connector_cursors": {
172 + "name": "connector_cursors",
173 + "schema": "",
174 + "columns": {
175 + "connector_id": {
176 + "name": "connector_id",
177 + "type": "text",
178 + "primaryKey": true,
179 + "notNull": true
180 + },
181 + "cursor": {
182 + "name": "cursor",
183 + "type": "jsonb",
184 + "primaryKey": false,
185 + "notNull": true,
186 + "default": "'{}'::jsonb"
187 + },
188 + "last_success_at": {
189 + "name": "last_success_at",
190 + "type": "timestamp with time zone",
191 + "primaryKey": false,
192 + "notNull": false
193 + },
194 + "last_attempt_at": {
195 + "name": "last_attempt_at",
196 + "type": "timestamp with time zone",
197 + "primaryKey": false,
198 + "notNull": false
199 + },
200 + "paused": {
201 + "name": "paused",
202 + "type": "boolean",
203 + "primaryKey": false,
204 + "notNull": true,
205 + "default": false
206 + },
207 + "health": {
208 + "name": "health",
209 + "type": "text",
210 + "primaryKey": false,
211 + "notNull": true,
212 + "default": "'unknown'"
213 + },
214 + "health_detail": {
215 + "name": "health_detail",
216 + "type": "text",
217 + "primaryKey": false,
218 + "notNull": false
219 + },
220 + "updated_at": {
221 + "name": "updated_at",
222 + "type": "timestamp with time zone",
223 + "primaryKey": false,
224 + "notNull": true,
225 + "default": "now()"
226 + }
227 + },
228 + "indexes": {},
229 + "foreignKeys": {},
230 + "compositePrimaryKeys": {},
231 + "uniqueConstraints": {},
232 + "policies": {},
233 + "checkConstraints": {},
234 + "isRLSEnabled": false
235 + },
236 + "public.connector_field_stats": {
237 + "name": "connector_field_stats",
238 + "schema": "",
239 + "columns": {
240 + "id": {
241 + "name": "id",
242 + "type": "bigserial",
243 + "primaryKey": true,
244 + "notNull": true
245 + },
246 + "connector_id": {
247 + "name": "connector_id",
248 + "type": "text",
249 + "primaryKey": false,
250 + "notNull": true
251 + },
252 + "entity": {
253 + "name": "entity",
254 + "type": "text",
255 + "primaryKey": false,
256 + "notNull": true
257 + },
258 + "field": {
259 + "name": "field",
260 + "type": "text",
261 + "primaryKey": false,
262 + "notNull": true
263 + },
264 + "types": {
265 + "name": "types",
266 + "type": "text[]",
267 + "primaryKey": false,
268 + "notNull": true,
269 + "default": "'{}'"
270 + },
271 + "seen_count": {
272 + "name": "seen_count",
273 + "type": "integer",
274 + "primaryKey": false,
275 + "notNull": true,
276 + "default": 0
277 + },
278 + "null_count": {
279 + "name": "null_count",
280 + "type": "integer",
281 + "primaryKey": false,
282 + "notNull": true,
283 + "default": 0
284 + },
285 + "first_seen_run": {
286 + "name": "first_seen_run",
287 + "type": "text",
288 + "primaryKey": false,
289 + "notNull": false
290 + },
291 + "last_seen_run": {
292 + "name": "last_seen_run",
293 + "type": "text",
294 + "primaryKey": false,
295 + "notNull": false
296 + },
297 + "updated_at": {
298 + "name": "updated_at",
299 + "type": "timestamp with time zone",
300 + "primaryKey": false,
301 + "notNull": true,
302 + "default": "now()"
303 + }
304 + },
305 + "indexes": {
306 + "connector_field_stats_uq": {
307 + "name": "connector_field_stats_uq",
308 + "columns": [
309 + {
310 + "expression": "connector_id",
311 + "isExpression": false,
312 + "asc": true,
313 + "nulls": "last"
314 + },
315 + {
316 + "expression": "entity",
317 + "isExpression": false,
318 + "asc": true,
319 + "nulls": "last"
320 + },
321 + {
322 + "expression": "field",
323 + "isExpression": false,
324 + "asc": true,
325 + "nulls": "last"
326 + }
327 + ],
328 + "isUnique": true,
329 + "concurrently": false,
330 + "method": "btree",
331 + "with": {}
332 + }
333 + },
334 + "foreignKeys": {},
335 + "compositePrimaryKeys": {},
336 + "uniqueConstraints": {},
337 + "policies": {},
338 + "checkConstraints": {},
339 + "isRLSEnabled": false
340 + },
341 + "public.entity_merges": {
342 + "name": "entity_merges",
343 + "schema": "",
344 + "columns": {
345 + "id": {
346 + "name": "id",
347 + "type": "bigserial",
348 + "primaryKey": true,
349 + "notNull": true
350 + },
351 + "entity_type": {
352 + "name": "entity_type",
353 + "type": "text",
354 + "primaryKey": false,
355 + "notNull": true
356 + },
357 + "keep_id": {
358 + "name": "keep_id",
359 + "type": "text",
360 + "primaryKey": false,
361 + "notNull": true
362 + },
363 + "merge_id": {
364 + "name": "merge_id",
365 + "type": "text",
366 + "primaryKey": false,
367 + "notNull": true
368 + },
369 + "evidence": {
370 + "name": "evidence",
371 + "type": "jsonb",
372 + "primaryKey": false,
373 + "notNull": true,
374 + "default": "'{}'::jsonb"
375 + },
376 + "status": {
377 + "name": "status",
378 + "type": "text",
379 + "primaryKey": false,
380 + "notNull": true,
381 + "default": "'proposed'"
382 + },
383 + "decided_by": {
384 + "name": "decided_by",
385 + "type": "text",
386 + "primaryKey": false,
387 + "notNull": false
388 + },
389 + "decided_at": {
390 + "name": "decided_at",
391 + "type": "timestamp with time zone",
392 + "primaryKey": false,
393 + "notNull": false
394 + },
395 + "created_at": {
396 + "name": "created_at",
397 + "type": "timestamp with time zone",
398 + "primaryKey": false,
399 + "notNull": true,
400 + "default": "now()"
401 + }
402 + },
403 + "indexes": {},
404 + "foreignKeys": {},
405 + "compositePrimaryKeys": {},
406 + "uniqueConstraints": {},
407 + "policies": {},
408 + "checkConstraints": {},
409 + "isRLSEnabled": false
410 + },
411 + "public.id_sequences": {
412 + "name": "id_sequences",
413 + "schema": "",
414 + "columns": {
415 + "namespace": {
416 + "name": "namespace",
417 + "type": "varchar(16)",
418 + "primaryKey": true,
419 + "notNull": true
420 + },
421 + "next": {
422 + "name": "next",
423 + "type": "bigint",
424 + "primaryKey": false,
425 + "notNull": true,
426 + "default": 1
427 + }
428 + },
429 + "indexes": {},
430 + "foreignKeys": {},
431 + "compositePrimaryKeys": {},
432 + "uniqueConstraints": {},
433 + "policies": {},
434 + "checkConstraints": {},
435 + "isRLSEnabled": false
436 + },
437 + "public.ingest_runs": {
438 + "name": "ingest_runs",
439 + "schema": "",
440 + "columns": {
441 + "id": {
442 + "name": "id",
443 + "type": "text",
444 + "primaryKey": true,
445 + "notNull": true
446 + },
447 + "connector_id": {
448 + "name": "connector_id",
449 + "type": "text",
450 + "primaryKey": false,
451 + "notNull": true
452 + },
453 + "source_id": {
454 + "name": "source_id",
455 + "type": "varchar(32)",
456 + "primaryKey": false,
457 + "notNull": true
458 + },
459 + "mode": {
460 + "name": "mode",
461 + "type": "text",
462 + "primaryKey": false,
463 + "notNull": true,
464 + "default": "'incremental'"
465 + },
466 + "status": {
467 + "name": "status",
468 + "type": "text",
469 + "primaryKey": false,
470 + "notNull": true,
471 + "default": "'running'"
472 + },
473 + "started_at": {
474 + "name": "started_at",
475 + "type": "timestamp with time zone",
476 + "primaryKey": false,
477 + "notNull": true,
478 + "default": "now()"
479 + },
480 + "finished_at": {
481 + "name": "finished_at",
482 + "type": "timestamp with time zone",
483 + "primaryKey": false,
484 + "notNull": false
485 + },
486 + "duration_ms": {
487 + "name": "duration_ms",
488 + "type": "integer",
489 + "primaryKey": false,
490 + "notNull": false
491 + },
492 + "records_fetched": {
493 + "name": "records_fetched",
494 + "type": "integer",
495 + "primaryKey": false,
496 + "notNull": true,
497 + "default": 0
498 + },
499 + "records_created": {
500 + "name": "records_created",
501 + "type": "integer",
502 + "primaryKey": false,
503 + "notNull": true,
504 + "default": 0
505 + },
506 + "records_updated": {
507 + "name": "records_updated",
508 + "type": "integer",
509 + "primaryKey": false,
510 + "notNull": true,
511 + "default": 0
512 + },
513 + "records_unchanged": {
514 + "name": "records_unchanged",
515 + "type": "integer",
516 + "primaryKey": false,
517 + "notNull": true,
518 + "default": 0
519 + },
520 + "records_rejected": {
521 + "name": "records_rejected",
522 + "type": "integer",
523 + "primaryKey": false,
524 + "notNull": true,
525 + "default": 0
526 + },
527 + "http_requests": {
528 + "name": "http_requests",
529 + "type": "integer",
530 + "primaryKey": false,
531 + "notNull": true,
532 + "default": 0
533 + },
534 + "http_failures": {
535 + "name": "http_failures",
536 + "type": "integer",
537 + "primaryKey": false,
538 + "notNull": true,
539 + "default": 0
540 + },
541 + "rate_limit_events": {
542 + "name": "rate_limit_events",
543 + "type": "integer",
544 + "primaryKey": false,
545 + "notNull": true,
546 + "default": 0
547 + },
548 + "validation_failures": {
549 + "name": "validation_failures",
550 + "type": "integer",
551 + "primaryKey": false,
552 + "notNull": true,
553 + "default": 0
554 + },
555 + "schema_drift": {
556 + "name": "schema_drift",
557 + "type": "jsonb",
558 + "primaryKey": false,
559 + "notNull": true,
560 + "default": "'[]'::jsonb"
561 + },
562 + "cursor_before": {
563 + "name": "cursor_before",
564 + "type": "jsonb",
565 + "primaryKey": false,
566 + "notNull": false
567 + },
568 + "cursor_after": {
569 + "name": "cursor_after",
570 + "type": "jsonb",
571 + "primaryKey": false,
572 + "notNull": false
573 + },
574 + "error": {
575 + "name": "error",
576 + "type": "text",
577 + "primaryKey": false,
578 + "notNull": false
579 + },
580 + "log": {
581 + "name": "log",
582 + "type": "jsonb",
583 + "primaryKey": false,
584 + "notNull": true,
585 + "default": "'[]'::jsonb"
586 + },
587 + "dataset_version": {
588 + "name": "dataset_version",
589 + "type": "text",
590 + "primaryKey": false,
591 + "notNull": false
592 + },
593 + "anomaly": {
594 + "name": "anomaly",
595 + "type": "text",
596 + "primaryKey": false,
597 + "notNull": false
598 + }
599 + },
600 + "indexes": {
601 + "ingest_runs_connector_idx": {
602 + "name": "ingest_runs_connector_idx",
603 + "columns": [
604 + {
605 + "expression": "connector_id",
606 + "isExpression": false,
607 + "asc": true,
608 + "nulls": "last"
609 + },
610 + {
611 + "expression": "started_at",
612 + "isExpression": false,
613 + "asc": true,
614 + "nulls": "last"
615 + }
616 + ],
617 + "isUnique": false,
618 + "concurrently": false,
619 + "method": "btree",
620 + "with": {}
621 + }
622 + },
623 + "foreignKeys": {},
624 + "compositePrimaryKeys": {},
625 + "uniqueConstraints": {},
626 + "policies": {},
627 + "checkConstraints": {},
628 + "isRLSEnabled": false
629 + },
630 + "public.provenance": {
631 + "name": "provenance",
632 + "schema": "",
633 + "columns": {
634 + "id": {
635 + "name": "id",
636 + "type": "bigserial",
637 + "primaryKey": true,
638 + "notNull": true
639 + },
640 + "public_id": {
641 + "name": "public_id",
642 + "type": "varchar(32)",
643 + "primaryKey": false,
644 + "notNull": false
645 + },
646 + "source_id": {
647 + "name": "source_id",
648 + "type": "varchar(32)",
649 + "primaryKey": false,
650 + "notNull": true
651 + },
652 + "source_record_id": {
653 + "name": "source_record_id",
654 + "type": "text",
655 + "primaryKey": false,
656 + "notNull": false
657 + },
658 + "source_url": {
659 + "name": "source_url",
660 + "type": "text",
661 + "primaryKey": false,
662 + "notNull": false
663 + },
664 + "dataset": {
665 + "name": "dataset",
666 + "type": "text",
667 + "primaryKey": false,
668 + "notNull": false
669 + },
670 + "dataset_version": {
671 + "name": "dataset_version",
672 + "type": "text",
673 + "primaryKey": false,
674 + "notNull": false
675 + },
676 + "publication_id": {
677 + "name": "publication_id",
678 + "type": "varchar(32)",
679 + "primaryKey": false,
680 + "notNull": false
681 + },
682 + "pmid": {
683 + "name": "pmid",
684 + "type": "text",
685 + "primaryKey": false,
686 + "notNull": false
687 + },
688 + "doi": {
689 + "name": "doi",
690 + "type": "text",
691 + "primaryKey": false,
692 + "notNull": false
693 + },
694 + "retrieved_at": {
695 + "name": "retrieved_at",
696 + "type": "timestamp with time zone",
697 + "primaryKey": false,
698 + "notNull": true
699 + },
700 + "published_at": {
701 + "name": "published_at",
702 + "type": "text",
703 + "primaryKey": false,
704 + "notNull": false
705 + },
706 + "updated_at_source": {
707 + "name": "updated_at_source",
708 + "type": "text",
709 + "primaryKey": false,
710 + "notNull": false
711 + },
712 + "geography": {
713 + "name": "geography",
714 + "type": "text",
715 + "primaryKey": false,
716 + "notNull": false
717 + },
718 + "population": {
719 + "name": "population",
720 + "type": "text",
721 + "primaryKey": false,
722 + "notNull": false
723 + },
724 + "cohort_size": {
725 + "name": "cohort_size",
726 + "type": "integer",
727 + "primaryKey": false,
728 + "notNull": false
729 + },
730 + "methodology": {
731 + "name": "methodology",
732 + "type": "text",
733 + "primaryKey": false,
734 + "notNull": false
735 + },
736 + "evidence_type": {
737 + "name": "evidence_type",
738 + "type": "text",
739 + "primaryKey": false,
740 + "notNull": true
741 + },
742 + "access_level": {
743 + "name": "access_level",
744 + "type": "text",
745 + "primaryKey": false,
746 + "notNull": true,
747 + "default": "'open'"
748 + },
749 + "confidence": {
750 + "name": "confidence",
751 + "type": "real",
752 + "primaryKey": false,
753 + "notNull": false
754 + },
755 + "license": {
756 + "name": "license",
757 + "type": "text",
758 + "primaryKey": false,
759 + "notNull": false
760 + },
761 + "ingest_run_id": {
762 + "name": "ingest_run_id",
763 + "type": "text",
764 + "primaryKey": false,
765 + "notNull": false
766 + },
767 + "created_at": {
768 + "name": "created_at",
769 + "type": "timestamp with time zone",
770 + "primaryKey": false,
771 + "notNull": true,
772 + "default": "now()"
773 + }
774 + },
775 + "indexes": {
776 + "provenance_source_idx": {
777 + "name": "provenance_source_idx",
778 + "columns": [
779 + {
780 + "expression": "source_id",
781 + "isExpression": false,
782 + "asc": true,
783 + "nulls": "last"
784 + },
785 + {
786 + "expression": "source_record_id",
787 + "isExpression": false,
788 + "asc": true,
789 + "nulls": "last"
790 + }
791 + ],
792 + "isUnique": false,
793 + "concurrently": false,
794 + "method": "btree",
795 + "with": {}
796 + },
797 + "provenance_pmid_idx": {
798 + "name": "provenance_pmid_idx",
799 + "columns": [
800 + {
801 + "expression": "pmid",
802 + "isExpression": false,
803 + "asc": true,
804 + "nulls": "last"
805 + }
806 + ],
807 + "isUnique": false,
808 + "concurrently": false,
809 + "method": "btree",
810 + "with": {}
811 + }
812 + },
813 + "foreignKeys": {},
814 + "compositePrimaryKeys": {},
815 + "uniqueConstraints": {},
816 + "policies": {},
817 + "checkConstraints": {},
818 + "isRLSEnabled": false
819 + },
820 + "public.source_records": {
821 + "name": "source_records",
822 + "schema": "",
823 + "columns": {
824 + "id": {
825 + "name": "id",
826 + "type": "bigserial",
827 + "primaryKey": true,
828 + "notNull": true
829 + },
830 + "source_id": {
831 + "name": "source_id",
832 + "type": "varchar(32)",
833 + "primaryKey": false,
834 + "notNull": true
835 + },
836 + "entity_kind": {
837 + "name": "entity_kind",
838 + "type": "text",
839 + "primaryKey": false,
840 + "notNull": true
841 + },
842 + "source_record_id": {
843 + "name": "source_record_id",
844 + "type": "text",
845 + "primaryKey": false,
846 + "notNull": true
847 + },
848 + "payload_hash": {
849 + "name": "payload_hash",
850 + "type": "text",
851 + "primaryKey": false,
852 + "notNull": true
853 + },
854 + "raw_path": {
855 + "name": "raw_path",
856 + "type": "text",
857 + "primaryKey": false,
858 + "notNull": false
859 + },
860 + "status": {
861 + "name": "status",
862 + "type": "text",
863 + "primaryKey": false,
864 + "notNull": true,
865 + "default": "'active'"
866 + },
867 + "first_seen_run": {
868 + "name": "first_seen_run",
869 + "type": "text",
870 + "primaryKey": false,
871 + "notNull": false
872 + },
873 + "last_seen_run": {
874 + "name": "last_seen_run",
875 + "type": "text",
876 + "primaryKey": false,
877 + "notNull": false
878 + },
879 + "retrieved_at": {
880 + "name": "retrieved_at",
881 + "type": "timestamp with time zone",
882 + "primaryKey": false,
883 + "notNull": true,
884 + "default": "now()"
885 + },
886 + "source_updated_at": {
887 + "name": "source_updated_at",
888 + "type": "timestamp with time zone",
889 + "primaryKey": false,
890 + "notNull": false
891 + },
892 + "canonical_type": {
893 + "name": "canonical_type",
894 + "type": "text",
895 + "primaryKey": false,
896 + "notNull": false
897 + },
898 + "canonical_id": {
899 + "name": "canonical_id",
900 + "type": "text",
901 + "primaryKey": false,
902 + "notNull": false
903 + },
904 + "created_at": {
905 + "name": "created_at",
906 + "type": "timestamp with time zone",
907 + "primaryKey": false,
908 + "notNull": true,
909 + "default": "now()"
910 + },
911 + "updated_at": {
912 + "name": "updated_at",
913 + "type": "timestamp with time zone",
914 + "primaryKey": false,
915 + "notNull": true,
916 + "default": "now()"
917 + }
918 + },
919 + "indexes": {
920 + "source_records_uq": {
921 + "name": "source_records_uq",
922 + "columns": [
923 + {
924 + "expression": "source_id",
925 + "isExpression": false,
926 + "asc": true,
927 + "nulls": "last"
928 + },
929 + {
930 + "expression": "entity_kind",
931 + "isExpression": false,
932 + "asc": true,
933 + "nulls": "last"
934 + },
935 + {
936 + "expression": "source_record_id",
937 + "isExpression": false,
938 + "asc": true,
939 + "nulls": "last"
940 + }
941 + ],
942 + "isUnique": true,
943 + "concurrently": false,
944 + "method": "btree",
945 + "with": {}
946 + },
947 + "source_records_canonical_idx": {
948 + "name": "source_records_canonical_idx",
949 + "columns": [
950 + {
951 + "expression": "canonical_type",
952 + "isExpression": false,
953 + "asc": true,
954 + "nulls": "last"
955 + },
956 + {
957 + "expression": "canonical_id",
958 + "isExpression": false,
959 + "asc": true,
960 + "nulls": "last"
961 + }
962 + ],
963 + "isUnique": false,
964 + "concurrently": false,
965 + "method": "btree",
966 + "with": {}
967 + }
968 + },
969 + "foreignKeys": {},
970 + "compositePrimaryKeys": {},
971 + "uniqueConstraints": {},
972 + "policies": {},
973 + "checkConstraints": {},
974 + "isRLSEnabled": false
975 + },
976 + "public.sources": {
977 + "name": "sources",
978 + "schema": "",
979 + "columns": {
980 + "id": {
981 + "name": "id",
982 + "type": "varchar(32)",
983 + "primaryKey": true,
984 + "notNull": true
985 + },
986 + "slug": {
987 + "name": "slug",
988 + "type": "text",
989 + "primaryKey": false,
990 + "notNull": true
991 + },
992 + "name": {
993 + "name": "name",
994 + "type": "text",
995 + "primaryKey": false,
996 + "notNull": true
997 + },
998 + "organization": {
999 + "name": "organization",
1000 + "type": "text",
1001 + "primaryKey": false,
1002 + "notNull": false
1003 + },
1004 + "category": {
1005 + "name": "category",
1006 + "type": "text",
1007 + "primaryKey": false,
1008 + "notNull": true
1009 + },
1010 + "description": {
1011 + "name": "description",
1012 + "type": "text",
1013 + "primaryKey": false,
1014 + "notNull": false
1015 + },
1016 + "homepage": {
1017 + "name": "homepage",
1018 + "type": "text",
1019 + "primaryKey": false,
1020 + "notNull": false
1021 + },
1022 + "docs_url": {
1023 + "name": "docs_url",
1024 + "type": "text",
1025 + "primaryKey": false,
1026 + "notNull": false
1027 + },
1028 + "terms_url": {
1029 + "name": "terms_url",
1030 + "type": "text",
1031 + "primaryKey": false,
1032 + "notNull": false
1033 + },
1034 + "access_type": {
1035 + "name": "access_type",
1036 + "type": "text",
1037 + "primaryKey": false,
1038 + "notNull": true
1039 + },
1040 + "access_auth": {
1041 + "name": "access_auth",
1042 + "type": "text",
1043 + "primaryKey": false,
1044 + "notNull": true
1045 + },
1046 + "license": {
1047 + "name": "license",
1048 + "type": "text",
1049 + "primaryKey": false,
1050 + "notNull": false
1051 + },
1052 + "license_status": {
1053 + "name": "license_status",
1054 + "type": "text",
1055 + "primaryKey": false,
1056 + "notNull": true,
1057 + "default": "'review'"
1058 + },
1059 + "commercial_use": {
1060 + "name": "commercial_use",
1061 + "type": "text",
1062 + "primaryKey": false,
1063 + "notNull": true,
1064 + "default": "'unknown'"
1065 + },
1066 + "redistribution": {
1067 + "name": "redistribution",
1068 + "type": "text",
1069 + "primaryKey": false,
1070 + "notNull": true,
1071 + "default": "'unknown'"
1072 + },
1073 + "attribution": {
1074 + "name": "attribution",
1075 + "type": "text",
1076 + "primaryKey": false,
1077 + "notNull": false
1078 + },
1079 + "license_reviewed_at": {
1080 + "name": "license_reviewed_at",
1081 + "type": "timestamp with time zone",
1082 + "primaryKey": false,
1083 + "notNull": false
1084 + },
1085 + "approved_for_production": {
1086 + "name": "approved_for_production",
1087 + "type": "boolean",
1088 + "primaryKey": false,
1089 + "notNull": true,
1090 + "default": false
1091 + },
1092 + "update_frequency": {
1093 + "name": "update_frequency",
1094 + "type": "text",
1095 + "primaryKey": false,
1096 + "notNull": false
1097 + },
1098 + "supports_incremental": {
1099 + "name": "supports_incremental",
1100 + "type": "boolean",
1101 + "primaryKey": false,
1102 + "notNull": true,
1103 + "default": false
1104 + },
1105 + "entities": {
1106 + "name": "entities",
1107 + "type": "text[]",
1108 + "primaryKey": false,
1109 + "notNull": true,
1110 + "default": "'{}'"
1111 + },
1112 + "metrics": {
1113 + "name": "metrics",
1114 + "type": "text[]",
1115 + "primaryKey": false,
1116 + "notNull": true,
1117 + "default": "'{}'"
1118 + },
1119 + "rate_limit": {
1120 + "name": "rate_limit",
1121 + "type": "text",
1122 + "primaryKey": false,
1123 + "notNull": false
1124 + },
1125 + "status": {
1126 + "name": "status",
1127 + "type": "text",
1128 + "primaryKey": false,
1129 + "notNull": true,
1130 + "default": "'planned'"
1131 + },
1132 + "tier": {
1133 + "name": "tier",
1134 + "type": "integer",
1135 + "primaryKey": false,
1136 + "notNull": true,
1137 + "default": 0
1138 + },
1139 + "manifest": {
1140 + "name": "manifest",
1141 + "type": "jsonb",
1142 + "primaryKey": false,
1143 + "notNull": true,
1144 + "default": "'{}'::jsonb"
1145 + },
1146 + "created_at": {
1147 + "name": "created_at",
1148 + "type": "timestamp with time zone",
1149 + "primaryKey": false,
1150 + "notNull": true,
1151 + "default": "now()"
1152 + },
1153 + "updated_at": {
1154 + "name": "updated_at",
1155 + "type": "timestamp with time zone",
1156 + "primaryKey": false,
1157 + "notNull": true,
1158 + "default": "now()"
1159 + }
1160 + },
1161 + "indexes": {
1162 + "sources_slug_uq": {
1163 + "name": "sources_slug_uq",
1164 + "columns": [
1165 + {
1166 + "expression": "slug",
1167 + "isExpression": false,
1168 + "asc": true,
1169 + "nulls": "last"
1170 + }
1171 + ],
1172 + "isUnique": true,
1173 + "concurrently": false,
1174 + "method": "btree",
1175 + "with": {}
1176 + }
1177 + },
1178 + "foreignKeys": {},
1179 + "compositePrimaryKeys": {},
1180 + "uniqueConstraints": {},
1181 + "policies": {},
1182 + "checkConstraints": {},
1183 + "isRLSEnabled": false
1184 + },
1185 + "public.unresolved_labels": {
1186 + "name": "unresolved_labels",
1187 + "schema": "",
1188 + "columns": {
1189 + "id": {
1190 + "name": "id",
1191 + "type": "bigserial",
1192 + "primaryKey": true,
1193 + "notNull": true
1194 + },
1195 + "source_id": {
1196 + "name": "source_id",
1197 + "type": "varchar(32)",
1198 + "primaryKey": false,
1199 + "notNull": true
1200 + },
1201 + "entity_kind": {
1202 + "name": "entity_kind",
1203 + "type": "text",
1204 + "primaryKey": false,
1205 + "notNull": true
1206 + },
1207 + "source_text": {
1208 + "name": "source_text",
1209 + "type": "text",
1210 + "primaryKey": false,
1211 + "notNull": true
1212 + },
1213 + "normalized": {
1214 + "name": "normalized",
1215 + "type": "text",
1216 + "primaryKey": false,
1217 + "notNull": true
1218 + },
1219 + "context": {
1220 + "name": "context",
1221 + "type": "jsonb",
1222 + "primaryKey": false,
1223 + "notNull": true,
1224 + "default": "'{}'::jsonb"
1225 + },
1226 + "count": {
1227 + "name": "count",
1228 + "type": "integer",
1229 + "primaryKey": false,
1230 + "notNull": true,
1231 + "default": 1
1232 + },
1233 + "status": {
1234 + "name": "status",
1235 + "type": "text",
1236 + "primaryKey": false,
1237 + "notNull": true,
1238 + "default": "'open'"
1239 + },
1240 + "suggested_id": {
1241 + "name": "suggested_id",
1242 + "type": "text",
1243 + "primaryKey": false,
1244 + "notNull": false
1245 + },
1246 + "suggested_match_type": {
1247 + "name": "suggested_match_type",
1248 + "type": "text",
1249 + "primaryKey": false,
1250 + "notNull": false
1251 + },
1252 + "suggested_score": {
1253 + "name": "suggested_score",
1254 + "type": "real",
1255 + "primaryKey": false,
1256 + "notNull": false
1257 + },
1258 + "resolved_id": {
1259 + "name": "resolved_id",
1260 + "type": "text",
1261 + "primaryKey": false,
1262 + "notNull": false
1263 + },
1264 + "resolved_by": {
1265 + "name": "resolved_by",
1266 + "type": "text",
1267 + "primaryKey": false,
1268 + "notNull": false
1269 + },
1270 + "created_at": {
1271 + "name": "created_at",
1272 + "type": "timestamp with time zone",
1273 + "primaryKey": false,
1274 + "notNull": true,
1275 + "default": "now()"
1276 + },
1277 + "updated_at": {
1278 + "name": "updated_at",
1279 + "type": "timestamp with time zone",
1280 + "primaryKey": false,
1281 + "notNull": true,
1282 + "default": "now()"
1283 + }
1284 + },
1285 + "indexes": {
1286 + "unresolved_labels_uq": {
1287 + "name": "unresolved_labels_uq",
1288 + "columns": [
1289 + {
1290 + "expression": "source_id",
1291 + "isExpression": false,
1292 + "asc": true,
1293 + "nulls": "last"
1294 + },
1295 + {
1296 + "expression": "entity_kind",
1297 + "isExpression": false,
1298 + "asc": true,
1299 + "nulls": "last"
1300 + },
1301 + {
1302 + "expression": "normalized",
1303 + "isExpression": false,
1304 + "asc": true,
1305 + "nulls": "last"
1306 + }
1307 + ],
1308 + "isUnique": true,
1309 + "concurrently": false,
1310 + "method": "btree",
1311 + "with": {}
1312 + },
1313 + "unresolved_labels_count_idx": {
1314 + "name": "unresolved_labels_count_idx",
1315 + "columns": [
1316 + {
1317 + "expression": "status",
1318 + "isExpression": false,
1319 + "asc": true,
1320 + "nulls": "last"
1321 + },
1322 + {
1323 + "expression": "count",
1324 + "isExpression": false,
1325 + "asc": true,
1326 + "nulls": "last"
1327 + }
1328 + ],
1329 + "isUnique": false,
1330 + "concurrently": false,
1331 + "method": "btree",
1332 + "with": {}
1333 + }
1334 + },
1335 + "foreignKeys": {},
1336 + "compositePrimaryKeys": {},
1337 + "uniqueConstraints": {},
1338 + "policies": {},
1339 + "checkConstraints": {},
1340 + "isRLSEnabled": false
1341 + },
1342 + "public.anatomical_sites": {
1343 + "name": "anatomical_sites",
1344 + "schema": "",
1345 + "columns": {
1346 + "id": {
1347 + "name": "id",
1348 + "type": "varchar(32)",
1349 + "primaryKey": true,
1350 + "notNull": true
1351 + },
1352 + "name": {
1353 + "name": "name",
1354 + "type": "text",
1355 + "primaryKey": false,
1356 + "notNull": true
1357 + },
1358 + "slug": {
1359 + "name": "slug",
1360 + "type": "text",
1361 + "primaryKey": false,
1362 + "notNull": true
1363 + },
1364 + "ncit_code": {
1365 + "name": "ncit_code",
1366 + "type": "text",
1367 + "primaryKey": false,
1368 + "notNull": false
1369 + },
1370 + "uberon_id": {
1371 + "name": "uberon_id",
1372 + "type": "text",
1373 + "primaryKey": false,
1374 + "notNull": false
1375 + },
1376 + "parent_id": {
1377 + "name": "parent_id",
1378 + "type": "varchar(32)",
1379 + "primaryKey": false,
1380 + "notNull": false
1381 + },
1382 + "system": {
1383 + "name": "system",
1384 + "type": "text",
1385 + "primaryKey": false,
1386 + "notNull": false
1387 + }
1388 + },
1389 + "indexes": {
1390 + "anatomical_sites_slug_uq": {
1391 + "name": "anatomical_sites_slug_uq",
1392 + "columns": [
1393 + {
1394 + "expression": "slug",
1395 + "isExpression": false,
1396 + "asc": true,
1397 + "nulls": "last"
1398 + }
1399 + ],
1400 + "isUnique": true,
1401 + "concurrently": false,
1402 + "method": "btree",
1403 + "with": {}
1404 + }
1405 + },
1406 + "foreignKeys": {},
1407 + "compositePrimaryKeys": {},
1408 + "uniqueConstraints": {},
1409 + "policies": {},
1410 + "checkConstraints": {},
1411 + "isRLSEnabled": false
1412 + },
1413 + "public.cancer_aliases": {
1414 + "name": "cancer_aliases",
1415 + "schema": "",
1416 + "columns": {
1417 + "id": {
1418 + "name": "id",
1419 + "type": "bigserial",
1420 + "primaryKey": true,
1421 + "notNull": true
1422 + },
1423 + "cancer_id": {
1424 + "name": "cancer_id",
1425 + "type": "varchar(32)",
1426 + "primaryKey": false,
1427 + "notNull": true
1428 + },
1429 + "alias": {
1430 + "name": "alias",
1431 + "type": "text",
1432 + "primaryKey": false,
1433 + "notNull": true
1434 + },
1435 + "normalized": {
1436 + "name": "normalized",
1437 + "type": "text",
1438 + "primaryKey": false,
1439 + "notNull": true
1440 + },
1441 + "alias_type": {
1442 + "name": "alias_type",
1443 + "type": "text",
1444 + "primaryKey": false,
1445 + "notNull": true,
1446 + "default": "'synonym'"
1447 + },
1448 + "source_id": {
1449 + "name": "source_id",
1450 + "type": "varchar(32)",
1451 + "primaryKey": false,
1452 + "notNull": false
1453 + },
1454 + "source_terminology": {
1455 + "name": "source_terminology",
1456 + "type": "text",
1457 + "primaryKey": false,
1458 + "notNull": false
1459 + },
1460 + "language": {
1461 + "name": "language",
1462 + "type": "text",
1463 + "primaryKey": false,
1464 + "notNull": true,
1465 + "default": "'en'"
1466 + }
1467 + },
1468 + "indexes": {
1469 + "cancer_aliases_uq": {
1470 + "name": "cancer_aliases_uq",
1471 + "columns": [
1472 + {
1473 + "expression": "cancer_id",
1474 + "isExpression": false,
1475 + "asc": true,
1476 + "nulls": "last"
1477 + },
1478 + {
1479 + "expression": "normalized",
1480 + "isExpression": false,
1481 + "asc": true,
1482 + "nulls": "last"
1483 + },
1484 + {
1485 + "expression": "alias_type",
1486 + "isExpression": false,
1487 + "asc": true,
1488 + "nulls": "last"
1489 + }
1490 + ],
1491 + "isUnique": true,
1492 + "concurrently": false,
1493 + "method": "btree",
1494 + "with": {}
1495 + },
1496 + "cancer_aliases_norm_idx": {
1497 + "name": "cancer_aliases_norm_idx",
1498 + "columns": [
1499 + {
1500 + "expression": "normalized",
1501 + "isExpression": false,
1502 + "asc": true,
1503 + "nulls": "last"
1504 + }
1505 + ],
1506 + "isUnique": false,
1507 + "concurrently": false,
1508 + "method": "btree",
1509 + "with": {}
1510 + }
1511 + },
1512 + "foreignKeys": {},
1513 + "compositePrimaryKeys": {},
1514 + "uniqueConstraints": {},
1515 + "policies": {},
1516 + "checkConstraints": {},
1517 + "isRLSEnabled": false
1518 + },
1519 + "public.cancer_anatomy": {
1520 + "name": "cancer_anatomy",
1521 + "schema": "",
1522 + "columns": {
1523 + "id": {
1524 + "name": "id",
1525 + "type": "bigserial",
1526 + "primaryKey": true,
1527 + "notNull": true
1528 + },
1529 + "cancer_id": {
1530 + "name": "cancer_id",
1531 + "type": "varchar(32)",
1532 + "primaryKey": false,
1533 + "notNull": true
1534 + },
1535 + "site_id": {
1536 + "name": "site_id",
1537 + "type": "varchar(32)",
1538 + "primaryKey": false,
1539 + "notNull": true
1540 + },
1541 + "relation": {
1542 + "name": "relation",
1543 + "type": "text",
1544 + "primaryKey": false,
1545 + "notNull": true,
1546 + "default": "'primary'"
1547 + },
1548 + "source_id": {
1549 + "name": "source_id",
1550 + "type": "varchar(32)",
1551 + "primaryKey": false,
1552 + "notNull": false
1553 + }
1554 + },
1555 + "indexes": {
1556 + "cancer_anatomy_uq": {
1557 + "name": "cancer_anatomy_uq",
1558 + "columns": [
1559 + {
1560 + "expression": "cancer_id",
1561 + "isExpression": false,
1562 + "asc": true,
1563 + "nulls": "last"
1564 + },
1565 + {
1566 + "expression": "site_id",
1567 + "isExpression": false,
1568 + "asc": true,
1569 + "nulls": "last"
1570 + },
1571 + {
1572 + "expression": "relation",
1573 + "isExpression": false,
1574 + "asc": true,
1575 + "nulls": "last"
1576 + }
1577 + ],
1578 + "isUnique": true,
1579 + "concurrently": false,
1580 + "method": "btree",
1581 + "with": {}
1582 + }
1583 + },
1584 + "foreignKeys": {},
1585 + "compositePrimaryKeys": {},
1586 + "uniqueConstraints": {},
1587 + "policies": {},
1588 + "checkConstraints": {},
1589 + "isRLSEnabled": false
1590 + },
1591 + "public.cancer_codes": {
1592 + "name": "cancer_codes",
1593 + "schema": "",
1594 + "columns": {
1595 + "id": {
1596 + "name": "id",
1597 + "type": "bigserial",
1598 + "primaryKey": true,
1599 + "notNull": true
1600 + },
1601 + "cancer_id": {
1602 + "name": "cancer_id",
1603 + "type": "varchar(32)",
1604 + "primaryKey": false,
1605 + "notNull": true
1606 + },
1607 + "system": {
1608 + "name": "system",
1609 + "type": "text",
1610 + "primaryKey": false,
1611 + "notNull": true
1612 + },
1613 + "code": {
1614 + "name": "code",
1615 + "type": "text",
1616 + "primaryKey": false,
1617 + "notNull": true
1618 + },
1619 + "match_type": {
1620 + "name": "match_type",
1621 + "type": "text",
1622 + "primaryKey": false,
1623 + "notNull": true,
1624 + "default": "'EXACT_IDENTIFIER'"
1625 + },
1626 + "source_id": {
1627 + "name": "source_id",
1628 + "type": "varchar(32)",
1629 + "primaryKey": false,
1630 + "notNull": false
1631 + },
1632 + "valid_from": {
1633 + "name": "valid_from",
1634 + "type": "text",
1635 + "primaryKey": false,
1636 + "notNull": false
1637 + },
1638 + "valid_to": {
1639 + "name": "valid_to",
1640 + "type": "text",
1641 + "primaryKey": false,
1642 + "notNull": false
1643 + }
1644 + },
1645 + "indexes": {
1646 + "cancer_codes_uq": {
1647 + "name": "cancer_codes_uq",
1648 + "columns": [
1649 + {
1650 + "expression": "cancer_id",
1651 + "isExpression": false,
1652 + "asc": true,
1653 + "nulls": "last"
1654 + },
1655 + {
1656 + "expression": "system",
1657 + "isExpression": false,
1658 + "asc": true,
1659 + "nulls": "last"
1660 + },
1661 + {
1662 + "expression": "code",
1663 + "isExpression": false,
1664 + "asc": true,
1665 + "nulls": "last"
1666 + }
1667 + ],
1668 + "isUnique": true,
1669 + "concurrently": false,
1670 + "method": "btree",
1671 + "with": {}
1672 + },
1673 + "cancer_codes_lookup_idx": {
1674 + "name": "cancer_codes_lookup_idx",
1675 + "columns": [
1676 + {
1677 + "expression": "system",
1678 + "isExpression": false,
1679 + "asc": true,
1680 + "nulls": "last"
1681 + },
1682 + {
1683 + "expression": "code",
1684 + "isExpression": false,
1685 + "asc": true,
1686 + "nulls": "last"
1687 + }
1688 + ],
1689 + "isUnique": false,
1690 + "concurrently": false,
1691 + "method": "btree",
1692 + "with": {}
1693 + }
1694 + },
1695 + "foreignKeys": {},
1696 + "compositePrimaryKeys": {},
1697 + "uniqueConstraints": {},
1698 + "policies": {},
1699 + "checkConstraints": {},
1700 + "isRLSEnabled": false
1701 + },
1702 + "public.cancer_hierarchy": {
1703 + "name": "cancer_hierarchy",
1704 + "schema": "",
1705 + "columns": {
1706 + "id": {
1707 + "name": "id",
1708 + "type": "bigserial",
1709 + "primaryKey": true,
1710 + "notNull": true
1711 + },
1712 + "parent_id": {
1713 + "name": "parent_id",
1714 + "type": "varchar(32)",
1715 + "primaryKey": false,
1716 + "notNull": true
1717 + },
1718 + "child_id": {
1719 + "name": "child_id",
1720 + "type": "varchar(32)",
1721 + "primaryKey": false,
1722 + "notNull": true
1723 + },
1724 + "hierarchy_type": {
1725 + "name": "hierarchy_type",
1726 + "type": "text",
1727 + "primaryKey": false,
1728 + "notNull": true
1729 + },
1730 + "source_id": {
1731 + "name": "source_id",
1732 + "type": "varchar(32)",
1733 + "primaryKey": false,
1734 + "notNull": false
1735 + }
1736 + },
1737 + "indexes": {
1738 + "cancer_hierarchy_uq": {
1739 + "name": "cancer_hierarchy_uq",
1740 + "columns": [
1741 + {
1742 + "expression": "parent_id",
1743 + "isExpression": false,
1744 + "asc": true,
1745 + "nulls": "last"
1746 + },
1747 + {
1748 + "expression": "child_id",
1749 + "isExpression": false,
1750 + "asc": true,
1751 + "nulls": "last"
1752 + },
1753 + {
1754 + "expression": "hierarchy_type",
1755 + "isExpression": false,
1756 + "asc": true,
1757 + "nulls": "last"
1758 + }
1759 + ],
1760 + "isUnique": true,
1761 + "concurrently": false,
1762 + "method": "btree",
1763 + "with": {}
1764 + },
1765 + "cancer_hierarchy_child_idx": {
1766 + "name": "cancer_hierarchy_child_idx",
1767 + "columns": [
1768 + {
1769 + "expression": "child_id",
1770 + "isExpression": false,
1771 + "asc": true,
1772 + "nulls": "last"
1773 + }
1774 + ],
1775 + "isUnique": false,
1776 + "concurrently": false,
1777 + "method": "btree",
1778 + "with": {}
1779 + }
1780 + },
1781 + "foreignKeys": {},
1782 + "compositePrimaryKeys": {},
1783 + "uniqueConstraints": {},
1784 + "policies": {},
1785 + "checkConstraints": {},
1786 + "isRLSEnabled": false
1787 + },
1788 + "public.cancers": {
1789 + "name": "cancers",
1790 + "schema": "",
1791 + "columns": {
1792 + "id": {
1793 + "name": "id",
1794 + "type": "varchar(32)",
1795 + "primaryKey": true,
1796 + "notNull": true
1797 + },
1798 + "slug": {
1799 + "name": "slug",
1800 + "type": "text",
1801 + "primaryKey": false,
1802 + "notNull": true
1803 + },
1804 + "canonical_name": {
1805 + "name": "canonical_name",
1806 + "type": "text",
1807 + "primaryKey": false,
1808 + "notNull": true
1809 + },
1810 + "short_name": {
1811 + "name": "short_name",
1812 + "type": "text",
1813 + "primaryKey": false,
1814 + "notNull": false
1815 + },
1816 + "entity_type": {
1817 + "name": "entity_type",
1818 + "type": "text",
1819 + "primaryKey": false,
1820 + "notNull": true,
1821 + "default": "'cancer'"
1822 + },
1823 + "malignant": {
1824 + "name": "malignant",
1825 + "type": "boolean",
1826 + "primaryKey": false,
1827 + "notNull": true,
1828 + "default": true
1829 + },
1830 + "solid_tumor": {
1831 + "name": "solid_tumor",
1832 + "type": "boolean",
1833 + "primaryKey": false,
1834 + "notNull": true,
1835 + "default": true
1836 + },
1837 + "hematologic": {
1838 + "name": "hematologic",
1839 + "type": "boolean",
1840 + "primaryKey": false,
1841 + "notNull": true,
1842 + "default": false
1843 + },
1844 + "pediatric_relevant": {
1845 + "name": "pediatric_relevant",
1846 + "type": "boolean",
1847 + "primaryKey": false,
1848 + "notNull": true,
1849 + "default": false
1850 + },
1851 + "rare_cancer": {
1852 + "name": "rare_cancer",
1853 + "type": "boolean",
1854 + "primaryKey": false,
1855 + "notNull": false
1856 + },
1857 + "top_level": {
1858 + "name": "top_level",
1859 + "type": "boolean",
1860 + "primaryKey": false,
1861 + "notNull": true,
1862 + "default": false
1863 + },
1864 + "description": {
1865 + "name": "description",
1866 + "type": "text",
1867 + "primaryKey": false,
1868 + "notNull": false
1869 + },
1870 + "description_provenance_id": {
1871 + "name": "description_provenance_id",
1872 + "type": "integer",
1873 + "primaryKey": false,
1874 + "notNull": false
1875 + },
1876 + "primary_ncit_code": {
1877 + "name": "primary_ncit_code",
1878 + "type": "text",
1879 + "primaryKey": false,
1880 + "notNull": false
1881 + },
1882 + "primary_oncotree_code": {
1883 + "name": "primary_oncotree_code",
1884 + "type": "text",
1885 + "primaryKey": false,
1886 + "notNull": false
1887 + },
1888 + "depth": {
1889 + "name": "depth",
1890 + "type": "integer",
1891 + "primaryKey": false,
1892 + "notNull": true,
1893 + "default": 0
1894 + },
1895 + "status": {
1896 + "name": "status",
1897 + "type": "text",
1898 + "primaryKey": false,
1899 + "notNull": true,
1900 + "default": "'active'"
1901 + },
1902 + "merged_into": {
1903 + "name": "merged_into",
1904 + "type": "varchar(32)",
1905 + "primaryKey": false,
1906 + "notNull": false
1907 + },
1908 + "deprecated_reason": {
1909 + "name": "deprecated_reason",
1910 + "type": "text",
1911 + "primaryKey": false,
1912 + "notNull": false
1913 + },
1914 + "classification_version": {
1915 + "name": "classification_version",
1916 + "type": "text",
1917 + "primaryKey": false,
1918 + "notNull": false
1919 + },
1920 + "semantic_types": {
1921 + "name": "semantic_types",
1922 + "type": "text[]",
1923 + "primaryKey": false,
1924 + "notNull": true,
1925 + "default": "'{}'"
1926 + },
1927 + "created_at": {
1928 + "name": "created_at",
1929 + "type": "timestamp with time zone",
1930 + "primaryKey": false,
1931 + "notNull": true,
1932 + "default": "now()"
1933 + },
1934 + "updated_at": {
1935 + "name": "updated_at",
1936 + "type": "timestamp with time zone",
1937 + "primaryKey": false,
1938 + "notNull": true,
1939 + "default": "now()"
1940 + }
1941 + },
1942 + "indexes": {
1943 + "cancers_slug_uq": {
1944 + "name": "cancers_slug_uq",
1945 + "columns": [
1946 + {
1947 + "expression": "slug",
1948 + "isExpression": false,
1949 + "asc": true,
1950 + "nulls": "last"
1951 + }
1952 + ],
1953 + "isUnique": true,
1954 + "concurrently": false,
1955 + "method": "btree",
1956 + "with": {}
1957 + },
1958 + "cancers_ncit_uq": {
1959 + "name": "cancers_ncit_uq",
1960 + "columns": [
1961 + {
1962 + "expression": "primary_ncit_code",
1963 + "isExpression": false,
1964 + "asc": true,
1965 + "nulls": "last"
1966 + }
1967 + ],
1968 + "isUnique": true,
1969 + "concurrently": false,
1970 + "method": "btree",
1971 + "with": {}
1972 + },
1973 + "cancers_name_idx": {
1974 + "name": "cancers_name_idx",
1975 + "columns": [
1976 + {
1977 + "expression": "canonical_name",
1978 + "isExpression": false,
1979 + "asc": true,
1980 + "nulls": "last"
1981 + }
1982 + ],
1983 + "isUnique": false,
1984 + "concurrently": false,
1985 + "method": "btree",
1986 + "with": {}
1987 + },
1988 + "cancers_type_idx": {
1989 + "name": "cancers_type_idx",
1990 + "columns": [
1991 + {
1992 + "expression": "entity_type",
1993 + "isExpression": false,
1994 + "asc": true,
1995 + "nulls": "last"
1996 + },
1997 + {
1998 + "expression": "malignant",
1999 + "isExpression": false,
2000 + "asc": true,
2001 + "nulls": "last"
2002 + },
2003 + {
2004 + "expression": "top_level",
2005 + "isExpression": false,
2006 + "asc": true,
2007 + "nulls": "last"
2008 + }
2009 + ],
2010 + "isUnique": false,
2011 + "concurrently": false,
2012 + "method": "btree",
2013 + "with": {}
2014 + }
2015 + },
2016 + "foreignKeys": {},
2017 + "compositePrimaryKeys": {},
2018 + "uniqueConstraints": {},
2019 + "policies": {},
2020 + "checkConstraints": {},
2021 + "isRLSEnabled": false
2022 + },
2023 + "public.cohort_definitions": {
2024 + "name": "cohort_definitions",
2025 + "schema": "",
2026 + "columns": {
2027 + "id": {
2028 + "name": "id",
2029 + "type": "bigserial",
2030 + "primaryKey": true,
2031 + "notNull": true
2032 + },
2033 + "name": {
2034 + "name": "name",
2035 + "type": "text",
2036 + "primaryKey": false,
2037 + "notNull": true
2038 + },
2039 + "cancer_id": {
2040 + "name": "cancer_id",
2041 + "type": "varchar(32)",
2042 + "primaryKey": false,
2043 + "notNull": true
2044 + },
2045 + "biomarker_ids": {
2046 + "name": "biomarker_ids",
2047 + "type": "text[]",
2048 + "primaryKey": false,
2049 + "notNull": true,
2050 + "default": "'{}'"
2051 + },
2052 + "variant_ids": {
2053 + "name": "variant_ids",
2054 + "type": "text[]",
2055 + "primaryKey": false,
2056 + "notNull": true,
2057 + "default": "'{}'"
2058 + },
2059 + "stage": {
2060 + "name": "stage",
2061 + "type": "text",
2062 + "primaryKey": false,
2063 + "notNull": false
2064 + },
2065 + "attributes": {
2066 + "name": "attributes",
2067 + "type": "jsonb",
2068 + "primaryKey": false,
2069 + "notNull": true,
2070 + "default": "'{}'::jsonb"
2071 + },
2072 + "confidence": {
2073 + "name": "confidence",
2074 + "type": "real",
2075 + "primaryKey": false,
2076 + "notNull": false
2077 + },
2078 + "created_at": {
2079 + "name": "created_at",
2080 + "type": "timestamp with time zone",
2081 + "primaryKey": false,
2082 + "notNull": true,
2083 + "default": "now()"
2084 + }
2085 + },
2086 + "indexes": {},
2087 + "foreignKeys": {},
2088 + "compositePrimaryKeys": {},
2089 + "uniqueConstraints": {},
2090 + "policies": {},
2091 + "checkConstraints": {},
2092 + "isRLSEnabled": false
2093 + },
2094 + "public.geographies": {
2095 + "name": "geographies",
2096 + "schema": "",
2097 + "columns": {
2098 + "id": {
2099 + "name": "id",
2100 + "type": "varchar(32)",
2101 + "primaryKey": true,
2102 + "notNull": true
2103 + },
2104 + "slug": {
2105 + "name": "slug",
2106 + "type": "text",
2107 + "primaryKey": false,
2108 + "notNull": true
2109 + },
2110 + "name": {
2111 + "name": "name",
2112 + "type": "text",
2113 + "primaryKey": false,
2114 + "notNull": true
2115 + },
2116 + "kind": {
2117 + "name": "kind",
2118 + "type": "text",
2119 + "primaryKey": false,
2120 + "notNull": true
2121 + },
2122 + "iso2": {
2123 + "name": "iso2",
2124 + "type": "text",
2125 + "primaryKey": false,
2126 + "notNull": false
2127 + },
2128 + "iso3": {
2129 + "name": "iso3",
2130 + "type": "text",
2131 + "primaryKey": false,
2132 + "notNull": false
2133 + },
2134 + "parent_id": {
2135 + "name": "parent_id",
2136 + "type": "varchar(32)",
2137 + "primaryKey": false,
2138 + "notNull": false
2139 + },
2140 + "who_region": {
2141 + "name": "who_region",
2142 + "type": "text",
2143 + "primaryKey": false,
2144 + "notNull": false
2145 + },
2146 + "population": {
2147 + "name": "population",
2148 + "type": "integer",
2149 + "primaryKey": false,
2150 + "notNull": false
2151 + },
2152 + "population_year": {
2153 + "name": "population_year",
2154 + "type": "integer",
2155 + "primaryKey": false,
2156 + "notNull": false
2157 + }
2158 + },
2159 + "indexes": {
2160 + "geographies_slug_uq": {
2161 + "name": "geographies_slug_uq",
2162 + "columns": [
2163 + {
2164 + "expression": "slug",
2165 + "isExpression": false,
2166 + "asc": true,
2167 + "nulls": "last"
2168 + }
2169 + ],
2170 + "isUnique": true,
2171 + "concurrently": false,
2172 + "method": "btree",
2173 + "with": {}
2174 + },
2175 + "geographies_iso3_idx": {
2176 + "name": "geographies_iso3_idx",
2177 + "columns": [
2178 + {
2179 + "expression": "iso3",
2180 + "isExpression": false,
2181 + "asc": true,
2182 + "nulls": "last"
2183 + }
2184 + ],
2185 + "isUnique": false,
2186 + "concurrently": false,
2187 + "method": "btree",
2188 + "with": {}
2189 + }
2190 + },
2191 + "foreignKeys": {},
2192 + "compositePrimaryKeys": {},
2193 + "uniqueConstraints": {},
2194 + "policies": {},
2195 + "checkConstraints": {},
2196 + "isRLSEnabled": false
2197 + },
2198 + "public.biomarkers": {
2199 + "name": "biomarkers",
2200 + "schema": "",
2201 + "columns": {
2202 + "id": {
2203 + "name": "id",
2204 + "type": "varchar(32)",
2205 + "primaryKey": true,
2206 + "notNull": true
2207 + },
2208 + "slug": {
2209 + "name": "slug",
2210 + "type": "text",
2211 + "primaryKey": false,
2212 + "notNull": true
2213 + },
2214 + "name": {
2215 + "name": "name",
2216 + "type": "text",
2217 + "primaryKey": false,
2218 + "notNull": true
2219 + },
2220 + "kind": {
2221 + "name": "kind",
2222 + "type": "text",
2223 + "primaryKey": false,
2224 + "notNull": true
2225 + },
2226 + "gene_id": {
2227 + "name": "gene_id",
2228 + "type": "varchar(32)",
2229 + "primaryKey": false,
2230 + "notNull": false
2231 + },
2232 + "ncit_code": {
2233 + "name": "ncit_code",
2234 + "type": "text",
2235 + "primaryKey": false,
2236 + "notNull": false
2237 + },
2238 + "description": {
2239 + "name": "description",
2240 + "type": "text",
2241 + "primaryKey": false,
2242 + "notNull": false
2243 + },
2244 + "measurement": {
2245 + "name": "measurement",
2246 + "type": "jsonb",
2247 + "primaryKey": false,
2248 + "notNull": true,
2249 + "default": "'{}'::jsonb"
2250 + },
2251 + "created_at": {
2252 + "name": "created_at",
2253 + "type": "timestamp with time zone",
2254 + "primaryKey": false,
2255 + "notNull": true,
2256 + "default": "now()"
2257 + },
2258 + "updated_at": {
2259 + "name": "updated_at",
2260 + "type": "timestamp with time zone",
2261 + "primaryKey": false,
2262 + "notNull": true,
2263 + "default": "now()"
2264 + }
2265 + },
2266 + "indexes": {
2267 + "biomarkers_slug_uq": {
2268 + "name": "biomarkers_slug_uq",
2269 + "columns": [
2270 + {
2271 + "expression": "slug",
2272 + "isExpression": false,
2273 + "asc": true,
2274 + "nulls": "last"
2275 + }
2276 + ],
2277 + "isUnique": true,
2278 + "concurrently": false,
2279 + "method": "btree",
2280 + "with": {}
2281 + }
2282 + },
2283 + "foreignKeys": {},
2284 + "compositePrimaryKeys": {},
2285 + "uniqueConstraints": {},
2286 + "policies": {},
2287 + "checkConstraints": {},
2288 + "isRLSEnabled": false
2289 + },
2290 + "public.cancer_gene_frequencies": {
2291 + "name": "cancer_gene_frequencies",
2292 + "schema": "",
2293 + "columns": {
2294 + "id": {
2295 + "name": "id",
2296 + "type": "bigserial",
2297 + "primaryKey": true,
2298 + "notNull": true
2299 + },
2300 + "cohort_id": {
2301 + "name": "cohort_id",
2302 + "type": "varchar(32)",
2303 + "primaryKey": false,
2304 + "notNull": true
2305 + },
2306 + "cancer_id": {
2307 + "name": "cancer_id",
2308 + "type": "varchar(32)",
2309 + "primaryKey": false,
2310 + "notNull": false
2311 + },
2312 + "gene_id": {
2313 + "name": "gene_id",
2314 + "type": "varchar(32)",
2315 + "primaryKey": false,
2316 + "notNull": false
2317 + },
2318 + "gene_symbol": {
2319 + "name": "gene_symbol",
2320 + "type": "text",
2321 + "primaryKey": false,
2322 + "notNull": true
2323 + },
2324 + "alteration_type": {
2325 + "name": "alteration_type",
2326 + "type": "text",
2327 + "primaryKey": false,
2328 + "notNull": true,
2329 + "default": "'ssm'"
2330 + },
2331 + "cases_affected": {
2332 + "name": "cases_affected",
2333 + "type": "integer",
2334 + "primaryKey": false,
2335 + "notNull": true
2336 + },
2337 + "cases_profiled": {
2338 + "name": "cases_profiled",
2339 + "type": "integer",
2340 + "primaryKey": false,
2341 + "notNull": true
2342 + },
2343 + "frequency": {
2344 + "name": "frequency",
2345 + "type": "real",
2346 + "primaryKey": false,
2347 + "notNull": true
2348 + },
2349 + "rank": {
2350 + "name": "rank",
2351 + "type": "integer",
2352 + "primaryKey": false,
2353 + "notNull": false
2354 + },
2355 + "data_release": {
2356 + "name": "data_release",
2357 + "type": "text",
2358 + "primaryKey": false,
2359 + "notNull": false
2360 + },
2361 + "provenance_id": {
2362 + "name": "provenance_id",
2363 + "type": "integer",
2364 + "primaryKey": false,
2365 + "notNull": true
2366 + },
2367 + "updated_at": {
2368 + "name": "updated_at",
2369 + "type": "timestamp with time zone",
2370 + "primaryKey": false,
2371 + "notNull": true,
2372 + "default": "now()"
2373 + }
2374 + },
2375 + "indexes": {
2376 + "cancer_gene_freq_uq": {
2377 + "name": "cancer_gene_freq_uq",
2378 + "columns": [
2379 + {
2380 + "expression": "cohort_id",
2381 + "isExpression": false,
2382 + "asc": true,
2383 + "nulls": "last"
2384 + },
2385 + {
2386 + "expression": "gene_symbol",
2387 + "isExpression": false,
2388 + "asc": true,
2389 + "nulls": "last"
2390 + },
2391 + {
2392 + "expression": "alteration_type",
2393 + "isExpression": false,
2394 + "asc": true,
2395 + "nulls": "last"
2396 + }
2397 + ],
2398 + "isUnique": true,
2399 + "concurrently": false,
2400 + "method": "btree",
2401 + "with": {}
2402 + },
2403 + "cancer_gene_freq_cancer_idx": {
2404 + "name": "cancer_gene_freq_cancer_idx",
2405 + "columns": [
2406 + {
2407 + "expression": "cancer_id",
2408 + "isExpression": false,
2409 + "asc": true,
2410 + "nulls": "last"
2411 + },
2412 + {
2413 + "expression": "frequency",
2414 + "isExpression": false,
2415 + "asc": true,
2416 + "nulls": "last"
2417 + }
2418 + ],
2419 + "isUnique": false,
2420 + "concurrently": false,
2421 + "method": "btree",
2422 + "with": {}
2423 + },
2424 + "cancer_gene_freq_gene_idx": {
2425 + "name": "cancer_gene_freq_gene_idx",
2426 + "columns": [
2427 + {
2428 + "expression": "gene_id",
2429 + "isExpression": false,
2430 + "asc": true,
2431 + "nulls": "last"
2432 + }
2433 + ],
2434 + "isUnique": false,
2435 + "concurrently": false,
2436 + "method": "btree",
2437 + "with": {}
2438 + }
2439 + },
2440 + "foreignKeys": {},
2441 + "compositePrimaryKeys": {},
2442 + "uniqueConstraints": {},
2443 + "policies": {},
2444 + "checkConstraints": {},
2445 + "isRLSEnabled": false
2446 + },
2447 + "public.entity_embeddings": {
2448 + "name": "entity_embeddings",
2449 + "schema": "",
2450 + "columns": {
2451 + "id": {
2452 + "name": "id",
2453 + "type": "bigserial",
2454 + "primaryKey": true,
2455 + "notNull": true
2456 + },
2457 + "entity_type": {
2458 + "name": "entity_type",
2459 + "type": "text",
2460 + "primaryKey": false,
2461 + "notNull": true
2462 + },
2463 + "entity_id": {
2464 + "name": "entity_id",
2465 + "type": "text",
2466 + "primaryKey": false,
2467 + "notNull": true
2468 + },
2469 + "model": {
2470 + "name": "model",
2471 + "type": "text",
2472 + "primaryKey": false,
2473 + "notNull": true
2474 + },
2475 + "dimensions": {
2476 + "name": "dimensions",
2477 + "type": "integer",
2478 + "primaryKey": false,
2479 + "notNull": true
2480 + },
2481 + "text_hash": {
2482 + "name": "text_hash",
2483 + "type": "text",
2484 + "primaryKey": false,
2485 + "notNull": true
2486 + },
2487 + "embedding": {
2488 + "name": "embedding",
2489 + "type": "text",
2490 + "primaryKey": false,
2491 + "notNull": false
2492 + },
2493 + "created_at": {
2494 + "name": "created_at",
2495 + "type": "timestamp with time zone",
2496 + "primaryKey": false,
2497 + "notNull": true,
2498 + "default": "now()"
2499 + }
2500 + },
2501 + "indexes": {
2502 + "entity_embeddings_uq": {
2503 + "name": "entity_embeddings_uq",
2504 + "columns": [
2505 + {
2506 + "expression": "entity_type",
2507 + "isExpression": false,
2508 + "asc": true,
2509 + "nulls": "last"
2510 + },
2511 + {
2512 + "expression": "entity_id",
2513 + "isExpression": false,
2514 + "asc": true,
2515 + "nulls": "last"
2516 + },
2517 + {
2518 + "expression": "model",
2519 + "isExpression": false,
2520 + "asc": true,
2521 + "nulls": "last"
2522 + }
2523 + ],
2524 + "isUnique": true,
2525 + "concurrently": false,
2526 + "method": "btree",
2527 + "with": {}
2528 + }
2529 + },
2530 + "foreignKeys": {},
2531 + "compositePrimaryKeys": {},
2532 + "uniqueConstraints": {},
2533 + "policies": {},
2534 + "checkConstraints": {},
2535 + "isRLSEnabled": false
2536 + },
2537 + "public.gene_aliases": {
2538 + "name": "gene_aliases",
2539 + "schema": "",
2540 + "columns": {
2541 + "id": {
2542 + "name": "id",
2543 + "type": "bigserial",
2544 + "primaryKey": true,
2545 + "notNull": true
2546 + },
2547 + "gene_id": {
2548 + "name": "gene_id",
2549 + "type": "varchar(32)",
2550 + "primaryKey": false,
2551 + "notNull": true
2552 + },
2553 + "alias": {
2554 + "name": "alias",
2555 + "type": "text",
2556 + "primaryKey": false,
2557 + "notNull": true
2558 + },
2559 + "alias_type": {
2560 + "name": "alias_type",
2561 + "type": "text",
2562 + "primaryKey": false,
2563 + "notNull": true
2564 + },
2565 + "source_id": {
2566 + "name": "source_id",
2567 + "type": "varchar(32)",
2568 + "primaryKey": false,
2569 + "notNull": false
2570 + }
2571 + },
2572 + "indexes": {
2573 + "gene_aliases_uq": {
2574 + "name": "gene_aliases_uq",
2575 + "columns": [
2576 + {
2577 + "expression": "gene_id",
2578 + "isExpression": false,
2579 + "asc": true,
2580 + "nulls": "last"
2581 + },
2582 + {
2583 + "expression": "alias",
2584 + "isExpression": false,
2585 + "asc": true,
2586 + "nulls": "last"
2587 + },
2588 + {
2589 + "expression": "alias_type",
2590 + "isExpression": false,
2591 + "asc": true,
2592 + "nulls": "last"
2593 + }
2594 + ],
2595 + "isUnique": true,
2596 + "concurrently": false,
2597 + "method": "btree",
2598 + "with": {}
2599 + },
2600 + "gene_aliases_alias_idx": {
2601 + "name": "gene_aliases_alias_idx",
2602 + "columns": [
2603 + {
2604 + "expression": "alias",
2605 + "isExpression": false,
2606 + "asc": true,
2607 + "nulls": "last"
2608 + }
2609 + ],
2610 + "isUnique": false,
2611 + "concurrently": false,
2612 + "method": "btree",
2613 + "with": {}
2614 + }
2615 + },
2616 + "foreignKeys": {},
2617 + "compositePrimaryKeys": {},
2618 + "uniqueConstraints": {},
2619 + "policies": {},
2620 + "checkConstraints": {},
2621 + "isRLSEnabled": false
2622 + },
2623 + "public.genes": {
2624 + "name": "genes",
2625 + "schema": "",
2626 + "columns": {
2627 + "id": {
2628 + "name": "id",
2629 + "type": "varchar(32)",
2630 + "primaryKey": true,
2631 + "notNull": true
2632 + },
2633 + "hgnc_id": {
2634 + "name": "hgnc_id",
2635 + "type": "text",
2636 + "primaryKey": false,
2637 + "notNull": false
2638 + },
2639 + "symbol": {
2640 + "name": "symbol",
2641 + "type": "text",
2642 + "primaryKey": false,
2643 + "notNull": true
2644 + },
2645 + "name": {
2646 + "name": "name",
2647 + "type": "text",
2648 + "primaryKey": false,
2649 + "notNull": false
2650 + },
2651 + "locus_type": {
2652 + "name": "locus_type",
2653 + "type": "text",
2654 + "primaryKey": false,
2655 + "notNull": false
2656 + },
2657 + "locus_group": {
2658 + "name": "locus_group",
2659 + "type": "text",
2660 + "primaryKey": false,
2661 + "notNull": false
2662 + },
2663 + "location": {
2664 + "name": "location",
2665 + "type": "text",
2666 + "primaryKey": false,
2667 + "notNull": false
2668 + },
2669 + "chromosome": {
2670 + "name": "chromosome",
2671 + "type": "text",
2672 + "primaryKey": false,
2673 + "notNull": false
2674 + },
2675 + "ensembl_gene_id": {
2676 + "name": "ensembl_gene_id",
2677 + "type": "text",
2678 + "primaryKey": false,
2679 + "notNull": false
2680 + },
2681 + "ncbi_gene_id": {
2682 + "name": "ncbi_gene_id",
2683 + "type": "text",
2684 + "primaryKey": false,
2685 + "notNull": false
2686 + },
2687 + "omim_ids": {
2688 + "name": "omim_ids",
2689 + "type": "text[]",
2690 + "primaryKey": false,
2691 + "notNull": true,
2692 + "default": "'{}'"
2693 + },
2694 + "uniprot_ids": {
2695 + "name": "uniprot_ids",
2696 + "type": "text[]",
2697 + "primaryKey": false,
2698 + "notNull": true,
2699 + "default": "'{}'"
2700 + },
2701 + "refseq_accession": {
2702 + "name": "refseq_accession",
2703 + "type": "text",
2704 + "primaryKey": false,
2705 + "notNull": false
2706 + },
2707 + "prev_symbols": {
2708 + "name": "prev_symbols",
2709 + "type": "text[]",
2710 + "primaryKey": false,
2711 + "notNull": true,
2712 + "default": "'{}'"
2713 + },
2714 + "alias_symbols": {
2715 + "name": "alias_symbols",
2716 + "type": "text[]",
2717 + "primaryKey": false,
2718 + "notNull": true,
2719 + "default": "'{}'"
2720 + },
2721 + "gene_families": {
2722 + "name": "gene_families",
2723 + "type": "text[]",
2724 + "primaryKey": false,
2725 + "notNull": true,
2726 + "default": "'{}'"
2727 + },
2728 + "status": {
2729 + "name": "status",
2730 + "type": "text",
2731 + "primaryKey": false,
2732 + "notNull": true,
2733 + "default": "'Approved'"
2734 + },
2735 + "is_cancer_gene": {
2736 + "name": "is_cancer_gene",
2737 + "type": "boolean",
2738 + "primaryKey": false,
2739 + "notNull": true,
2740 + "default": false
2741 + },
2742 + "civic_gene_id": {
2743 + "name": "civic_gene_id",
2744 + "type": "integer",
2745 + "primaryKey": false,
2746 + "notNull": false
2747 + },
2748 + "description": {
2749 + "name": "description",
2750 + "type": "text",
2751 + "primaryKey": false,
2752 + "notNull": false
2753 + },
2754 + "created_at": {
2755 + "name": "created_at",
2756 + "type": "timestamp with time zone",
2757 + "primaryKey": false,
2758 + "notNull": true,
2759 + "default": "now()"
2760 + },
2761 + "updated_at": {
2762 + "name": "updated_at",
2763 + "type": "timestamp with time zone",
2764 + "primaryKey": false,
2765 + "notNull": true,
2766 + "default": "now()"
2767 + }
2768 + },
2769 + "indexes": {
2770 + "genes_symbol_uq": {
2771 + "name": "genes_symbol_uq",
2772 + "columns": [
2773 + {
2774 + "expression": "symbol",
2775 + "isExpression": false,
2776 + "asc": true,
2777 + "nulls": "last"
2778 + }
2779 + ],
2780 + "isUnique": true,
2781 + "concurrently": false,
2782 + "method": "btree",
2783 + "with": {}
2784 + },
2785 + "genes_hgnc_uq": {
2786 + "name": "genes_hgnc_uq",
2787 + "columns": [
2788 + {
2789 + "expression": "hgnc_id",
2790 + "isExpression": false,
2791 + "asc": true,
2792 + "nulls": "last"
2793 + }
2794 + ],
2795 + "isUnique": true,
2796 + "concurrently": false,
2797 + "method": "btree",
2798 + "with": {}
2799 + },
2800 + "genes_ensembl_idx": {
2801 + "name": "genes_ensembl_idx",
2802 + "columns": [
2803 + {
2804 + "expression": "ensembl_gene_id",
2805 + "isExpression": false,
2806 + "asc": true,
2807 + "nulls": "last"
2808 + }
2809 + ],
2810 + "isUnique": false,
2811 + "concurrently": false,
2812 + "method": "btree",
2813 + "with": {}
2814 + },
2815 + "genes_ncbi_idx": {
2816 + "name": "genes_ncbi_idx",
2817 + "columns": [
2818 + {
2819 + "expression": "ncbi_gene_id",
2820 + "isExpression": false,
2821 + "asc": true,
2822 + "nulls": "last"
2823 + }
2824 + ],
2825 + "isUnique": false,
2826 + "concurrently": false,
2827 + "method": "btree",
2828 + "with": {}
2829 + }
2830 + },
2831 + "foreignKeys": {},
2832 + "compositePrimaryKeys": {},
2833 + "uniqueConstraints": {},
2834 + "policies": {},
2835 + "checkConstraints": {},
2836 + "isRLSEnabled": false
2837 + },
2838 + "public.genomic_cohorts": {
2839 + "name": "genomic_cohorts",
2840 + "schema": "",
2841 + "columns": {
2842 + "id": {
2843 + "name": "id",
2844 + "type": "varchar(32)",
2845 + "primaryKey": true,
2846 + "notNull": true
2847 + },
2848 + "source_id": {
2849 + "name": "source_id",
2850 + "type": "varchar(32)",
2851 + "primaryKey": false,
2852 + "notNull": true
2853 + },
2854 + "study_id": {
2855 + "name": "study_id",
2856 + "type": "text",
2857 + "primaryKey": false,
2858 + "notNull": true
2859 + },
2860 + "name": {
2861 + "name": "name",
2862 + "type": "text",
2863 + "primaryKey": false,
2864 + "notNull": true
2865 + },
2866 + "program": {
2867 + "name": "program",
2868 + "type": "text",
2869 + "primaryKey": false,
2870 + "notNull": false
2871 + },
2872 + "primary_sites": {
2873 + "name": "primary_sites",
2874 + "type": "text[]",
2875 + "primaryKey": false,
2876 + "notNull": true,
2877 + "default": "'{}'"
2878 + },
2879 + "disease_types": {
2880 + "name": "disease_types",
2881 + "type": "text[]",
2882 + "primaryKey": false,
2883 + "notNull": true,
2884 + "default": "'{}'"
2885 + },
2886 + "cancer_id": {
2887 + "name": "cancer_id",
2888 + "type": "varchar(32)",
2889 + "primaryKey": false,
2890 + "notNull": false
2891 + },
2892 + "cancer_match_type": {
2893 + "name": "cancer_match_type",
2894 + "type": "text",
2895 + "primaryKey": false,
2896 + "notNull": false
2897 + },
2898 + "case_count": {
2899 + "name": "case_count",
2900 + "type": "integer",
2901 + "primaryKey": false,
2902 + "notNull": false
2903 + },
2904 + "cases_with_ssm": {
2905 + "name": "cases_with_ssm",
2906 + "type": "integer",
2907 + "primaryKey": false,
2908 + "notNull": false
2909 + },
2910 + "data_release": {
2911 + "name": "data_release",
2912 + "type": "text",
2913 + "primaryKey": false,
2914 + "notNull": false
2915 + },
2916 + "access_level": {
2917 + "name": "access_level",
2918 + "type": "text",
2919 + "primaryKey": false,
2920 + "notNull": true,
2921 + "default": "'open'"
2922 + },
2923 + "url": {
2924 + "name": "url",
2925 + "type": "text",
2926 + "primaryKey": false,
2927 + "notNull": false
2928 + },
2929 + "provenance_id": {
2930 + "name": "provenance_id",
2931 + "type": "integer",
2932 + "primaryKey": false,
2933 + "notNull": false
2934 + },
2935 + "updated_at": {
2936 + "name": "updated_at",
2937 + "type": "timestamp with time zone",
2938 + "primaryKey": false,
2939 + "notNull": true,
2940 + "default": "now()"
2941 + }
2942 + },
2943 + "indexes": {
2944 + "genomic_cohorts_uq": {
2945 + "name": "genomic_cohorts_uq",
2946 + "columns": [
2947 + {
2948 + "expression": "source_id",
2949 + "isExpression": false,
2950 + "asc": true,
2951 + "nulls": "last"
2952 + },
2953 + {
2954 + "expression": "study_id",
2955 + "isExpression": false,
2956 + "asc": true,
2957 + "nulls": "last"
2958 + }
2959 + ],
2960 + "isUnique": true,
2961 + "concurrently": false,
2962 + "method": "btree",
2963 + "with": {}
2964 + },
2965 + "genomic_cohorts_cancer_idx": {
2966 + "name": "genomic_cohorts_cancer_idx",
2967 + "columns": [
2968 + {
2969 + "expression": "cancer_id",
2970 + "isExpression": false,
2971 + "asc": true,
2972 + "nulls": "last"
2973 + }
2974 + ],
2975 + "isUnique": false,
2976 + "concurrently": false,
2977 + "method": "btree",
2978 + "with": {}
2979 + }
2980 + },
2981 + "foreignKeys": {},
2982 + "compositePrimaryKeys": {},
2983 + "uniqueConstraints": {},
2984 + "policies": {},
2985 + "checkConstraints": {},
2986 + "isRLSEnabled": false
2987 + },
2988 + "public.variant_aliases": {
2989 + "name": "variant_aliases",
2990 + "schema": "",
2991 + "columns": {
2992 + "id": {
2993 + "name": "id",
2994 + "type": "bigserial",
2995 + "primaryKey": true,
2996 + "notNull": true
2997 + },
2998 + "variant_id": {
2999 + "name": "variant_id",
3000 + "type": "varchar(32)",
3001 + "primaryKey": false,
3002 + "notNull": true
3003 + },
3004 + "alias": {
3005 + "name": "alias",
3006 + "type": "text",
3007 + "primaryKey": false,
3008 + "notNull": true
3009 + },
3010 + "source_id": {
3011 + "name": "source_id",
3012 + "type": "varchar(32)",
3013 + "primaryKey": false,
3014 + "notNull": false
3015 + }
3016 + },
3017 + "indexes": {
3018 + "variant_aliases_uq": {
3019 + "name": "variant_aliases_uq",
3020 + "columns": [
3021 + {
3022 + "expression": "variant_id",
3023 + "isExpression": false,
3024 + "asc": true,
3025 + "nulls": "last"
3026 + },
3027 + {
3028 + "expression": "alias",
3029 + "isExpression": false,
3030 + "asc": true,
3031 + "nulls": "last"
3032 + }
3033 + ],
3034 + "isUnique": true,
3035 + "concurrently": false,
3036 + "method": "btree",
3037 + "with": {}
3038 + }
3039 + },
3040 + "foreignKeys": {},
3041 + "compositePrimaryKeys": {},
3042 + "uniqueConstraints": {},
3043 + "policies": {},
3044 + "checkConstraints": {},
3045 + "isRLSEnabled": false
3046 + },
3047 + "public.variant_clinical_significance": {
3048 + "name": "variant_clinical_significance",
3049 + "schema": "",
3050 + "columns": {
3051 + "id": {
3052 + "name": "id",
3053 + "type": "bigserial",
3054 + "primaryKey": true,
3055 + "notNull": true
3056 + },
3057 + "variant_id": {
3058 + "name": "variant_id",
3059 + "type": "varchar(32)",
3060 + "primaryKey": false,
3061 + "notNull": true
3062 + },
3063 + "clinvar_variation_id": {
3064 + "name": "clinvar_variation_id",
3065 + "type": "text",
3066 + "primaryKey": false,
3067 + "notNull": true
3068 + },
3069 + "clinical_significance": {
3070 + "name": "clinical_significance",
3071 + "type": "text",
3072 + "primaryKey": false,
3073 + "notNull": true
3074 + },
3075 + "review_status": {
3076 + "name": "review_status",
3077 + "type": "text",
3078 + "primaryKey": false,
3079 + "notNull": false
3080 + },
3081 + "star_rating": {
3082 + "name": "star_rating",
3083 + "type": "integer",
3084 + "primaryKey": false,
3085 + "notNull": false
3086 + },
3087 + "last_evaluated": {
3088 + "name": "last_evaluated",
3089 + "type": "text",
3090 + "primaryKey": false,
3091 + "notNull": false
3092 + },
3093 + "conditions": {
3094 + "name": "conditions",
3095 + "type": "text[]",
3096 + "primaryKey": false,
3097 + "notNull": true,
3098 + "default": "'{}'"
3099 + },
3100 + "condition_cancer_ids": {
3101 + "name": "condition_cancer_ids",
3102 + "type": "text[]",
3103 + "primaryKey": false,
3104 + "notNull": true,
3105 + "default": "'{}'"
3106 + },
3107 + "origin_simple": {
3108 + "name": "origin_simple",
3109 + "type": "text",
3110 + "primaryKey": false,
3111 + "notNull": false
3112 + },
3113 + "number_submitters": {
3114 + "name": "number_submitters",
3115 + "type": "integer",
3116 + "primaryKey": false,
3117 + "notNull": false
3118 + },
3119 + "provenance_id": {
3120 + "name": "provenance_id",
3121 + "type": "integer",
3122 + "primaryKey": false,
3123 + "notNull": true
3124 + },
3125 + "ingest_run_id": {
3126 + "name": "ingest_run_id",
3127 + "type": "text",
3128 + "primaryKey": false,
3129 + "notNull": false
3130 + },
3131 + "updated_at": {
3132 + "name": "updated_at",
3133 + "type": "timestamp with time zone",
3134 + "primaryKey": false,
3135 + "notNull": true,
3136 + "default": "now()"
3137 + }
3138 + },
3139 + "indexes": {
3140 + "variant_clinsig_uq": {
3141 + "name": "variant_clinsig_uq",
3142 + "columns": [
3143 + {
3144 + "expression": "clinvar_variation_id",
3145 + "isExpression": false,
3146 + "asc": true,
3147 + "nulls": "last"
3148 + }
3149 + ],
3150 + "isUnique": true,
3151 + "concurrently": false,
3152 + "method": "btree",
3153 + "with": {}
3154 + }
3155 + },
3156 + "foreignKeys": {},
3157 + "compositePrimaryKeys": {},
3158 + "uniqueConstraints": {},
3159 + "policies": {},
3160 + "checkConstraints": {},
3161 + "isRLSEnabled": false
3162 + },
3163 + "public.variants": {
3164 + "name": "variants",
3165 + "schema": "",
3166 + "columns": {
3167 + "id": {
3168 + "name": "id",
3169 + "type": "varchar(32)",
3170 + "primaryKey": true,
3171 + "notNull": true
3172 + },
3173 + "slug": {
3174 + "name": "slug",
3175 + "type": "text",
3176 + "primaryKey": false,
3177 + "notNull": true
3178 + },
3179 + "gene_id": {
3180 + "name": "gene_id",
3181 + "type": "varchar(32)",
3182 + "primaryKey": false,
3183 + "notNull": false
3184 + },
3185 + "gene_symbol": {
3186 + "name": "gene_symbol",
3187 + "type": "text",
3188 + "primaryKey": false,
3189 + "notNull": false
3190 + },
3191 + "name": {
3192 + "name": "name",
3193 + "type": "text",
3194 + "primaryKey": false,
3195 + "notNull": true
3196 + },
3197 + "variant_type": {
3198 + "name": "variant_type",
3199 + "type": "text",
3200 + "primaryKey": false,
3201 + "notNull": false
3202 + },
3203 + "hgvs_g": {
3204 + "name": "hgvs_g",
3205 + "type": "text",
3206 + "primaryKey": false,
3207 + "notNull": false
3208 + },
3209 + "hgvs_c": {
3210 + "name": "hgvs_c",
3211 + "type": "text",
3212 + "primaryKey": false,
3213 + "notNull": false
3214 + },
3215 + "hgvs_p": {
3216 + "name": "hgvs_p",
3217 + "type": "text",
3218 + "primaryKey": false,
3219 + "notNull": false
3220 + },
3221 + "assembly": {
3222 + "name": "assembly",
3223 + "type": "text",
3224 + "primaryKey": false,
3225 + "notNull": false
3226 + },
3227 + "chromosome": {
3228 + "name": "chromosome",
3229 + "type": "text",
3230 + "primaryKey": false,
3231 + "notNull": false
3232 + },
3233 + "start": {
3234 + "name": "start",
3235 + "type": "integer",
3236 + "primaryKey": false,
3237 + "notNull": false
3238 + },
3239 + "end": {
3240 + "name": "end",
3241 + "type": "integer",
3242 + "primaryKey": false,
3243 + "notNull": false
3244 + },
3245 + "reference_bases": {
3246 + "name": "reference_bases",
3247 + "type": "text",
3248 + "primaryKey": false,
3249 + "notNull": false
3250 + },
3251 + "alternate_bases": {
3252 + "name": "alternate_bases",
3253 + "type": "text",
3254 + "primaryKey": false,
3255 + "notNull": false
3256 + },
3257 + "coordinates": {
3258 + "name": "coordinates",
3259 + "type": "jsonb",
3260 + "primaryKey": false,
3261 + "notNull": true,
3262 + "default": "'[]'::jsonb"
3263 + },
3264 + "clinvar_variation_id": {
3265 + "name": "clinvar_variation_id",
3266 + "type": "text",
3267 + "primaryKey": false,
3268 + "notNull": false
3269 + },
3270 + "civic_variant_id": {
3271 + "name": "civic_variant_id",
3272 + "type": "integer",
3273 + "primaryKey": false,
3274 + "notNull": false
3275 + },
3276 + "dbsnp_ids": {
3277 + "name": "dbsnp_ids",
3278 + "type": "text[]",
3279 + "primaryKey": false,
3280 + "notNull": true,
3281 + "default": "'{}'"
3282 + },
3283 + "fusion_partners": {
3284 + "name": "fusion_partners",
3285 + "type": "text[]",
3286 + "primaryKey": false,
3287 + "notNull": true,
3288 + "default": "'{}'"
3289 + },
3290 + "created_at": {
3291 + "name": "created_at",
3292 + "type": "timestamp with time zone",
3293 + "primaryKey": false,
3294 + "notNull": true,
3295 + "default": "now()"
3296 + },
3297 + "updated_at": {
3298 + "name": "updated_at",
3299 + "type": "timestamp with time zone",
3300 + "primaryKey": false,
3301 + "notNull": true,
3302 + "default": "now()"
3303 + }
3304 + },
3305 + "indexes": {
3306 + "variants_slug_uq": {
3307 + "name": "variants_slug_uq",
3308 + "columns": [
3309 + {
3310 + "expression": "slug",
3311 + "isExpression": false,
3312 + "asc": true,
3313 + "nulls": "last"
3314 + }
3315 + ],
3316 + "isUnique": true,
3317 + "concurrently": false,
3318 + "method": "btree",
3319 + "with": {}
3320 + },
3321 + "variants_gene_idx": {
3322 + "name": "variants_gene_idx",
3323 + "columns": [
3324 + {
3325 + "expression": "gene_id",
3326 + "isExpression": false,
3327 + "asc": true,
3328 + "nulls": "last"
3329 + }
3330 + ],
3331 + "isUnique": false,
3332 + "concurrently": false,
3333 + "method": "btree",
3334 + "with": {}
3335 + },
3336 + "variants_clinvar_idx": {
3337 + "name": "variants_clinvar_idx",
3338 + "columns": [
3339 + {
3340 + "expression": "clinvar_variation_id",
3341 + "isExpression": false,
3342 + "asc": true,
3343 + "nulls": "last"
3344 + }
3345 + ],
3346 + "isUnique": false,
3347 + "concurrently": false,
3348 + "method": "btree",
3349 + "with": {}
3350 + },
3351 + "variants_civic_idx": {
3352 + "name": "variants_civic_idx",
3353 + "columns": [
3354 + {
3355 + "expression": "civic_variant_id",
3356 + "isExpression": false,
3357 + "asc": true,
3358 + "nulls": "last"
3359 + }
3360 + ],
3361 + "isUnique": false,
3362 + "concurrently": false,
3363 + "method": "btree",
3364 + "with": {}
3365 + }
3366 + },
3367 + "foreignKeys": {},
3368 + "compositePrimaryKeys": {},
3369 + "uniqueConstraints": {},
3370 + "policies": {},
3371 + "checkConstraints": {},
3372 + "isRLSEnabled": false
3373 + },
3374 + "public.drug_aliases": {
3375 + "name": "drug_aliases",
3376 + "schema": "",
3377 + "columns": {
3378 + "id": {
3379 + "name": "id",
3380 + "type": "bigserial",
3381 + "primaryKey": true,
3382 + "notNull": true
3383 + },
3384 + "drug_id": {
3385 + "name": "drug_id",
3386 + "type": "varchar(32)",
3387 + "primaryKey": false,
3388 + "notNull": true
3389 + },
3390 + "alias": {
3391 + "name": "alias",
3392 + "type": "text",
3393 + "primaryKey": false,
3394 + "notNull": true
3395 + },
3396 + "normalized": {
3397 + "name": "normalized",
3398 + "type": "text",
3399 + "primaryKey": false,
3400 + "notNull": true
3401 + },
3402 + "alias_type": {
3403 + "name": "alias_type",
3404 + "type": "text",
3405 + "primaryKey": false,
3406 + "notNull": true,
3407 + "default": "'synonym'"
3408 + },
3409 + "source_id": {
3410 + "name": "source_id",
3411 + "type": "varchar(32)",
3412 + "primaryKey": false,
3413 + "notNull": false
3414 + }
3415 + },
3416 + "indexes": {
3417 + "drug_aliases_uq": {
3418 + "name": "drug_aliases_uq",
3419 + "columns": [
3420 + {
3421 + "expression": "drug_id",
3422 + "isExpression": false,
3423 + "asc": true,
3424 + "nulls": "last"
3425 + },
3426 + {
3427 + "expression": "normalized",
3428 + "isExpression": false,
3429 + "asc": true,
3430 + "nulls": "last"
3431 + },
3432 + {
3433 + "expression": "alias_type",
3434 + "isExpression": false,
3435 + "asc": true,
3436 + "nulls": "last"
3437 + }
3438 + ],
3439 + "isUnique": true,
3440 + "concurrently": false,
3441 + "method": "btree",
3442 + "with": {}
3443 + },
3444 + "drug_aliases_norm_idx": {
3445 + "name": "drug_aliases_norm_idx",
3446 + "columns": [
3447 + {
3448 + "expression": "normalized",
3449 + "isExpression": false,
3450 + "asc": true,
3451 + "nulls": "last"
3452 + }
3453 + ],
3454 + "isUnique": false,
3455 + "concurrently": false,
3456 + "method": "btree",
3457 + "with": {}
3458 + }
3459 + },
3460 + "foreignKeys": {},
3461 + "compositePrimaryKeys": {},
3462 + "uniqueConstraints": {},
3463 + "policies": {},
3464 + "checkConstraints": {},
3465 + "isRLSEnabled": false
3466 + },
3467 + "public.drug_approvals": {
3468 + "name": "drug_approvals",
3469 + "schema": "",
3470 + "columns": {
3471 + "id": {
3472 + "name": "id",
3473 + "type": "bigserial",
3474 + "primaryKey": true,
3475 + "notNull": true
3476 + },
3477 + "drug_id": {
3478 + "name": "drug_id",
3479 + "type": "varchar(32)",
3480 + "primaryKey": false,
3481 + "notNull": true
3482 + },
3483 + "cancer_id": {
3484 + "name": "cancer_id",
3485 + "type": "varchar(32)",
3486 + "primaryKey": false,
3487 + "notNull": false
3488 + },
3489 + "biomarker_ids": {
3490 + "name": "biomarker_ids",
3491 + "type": "text[]",
3492 + "primaryKey": false,
3493 + "notNull": true,
3494 + "default": "'{}'"
3495 + },
3496 + "tumor_agnostic": {
3497 + "name": "tumor_agnostic",
3498 + "type": "boolean",
3499 + "primaryKey": false,
3500 + "notNull": true,
3501 + "default": false
3502 + },
3503 + "jurisdiction": {
3504 + "name": "jurisdiction",
3505 + "type": "text",
3506 + "primaryKey": false,
3507 + "notNull": true
3508 + },
3509 + "authority": {
3510 + "name": "authority",
3511 + "type": "text",
3512 + "primaryKey": false,
3513 + "notNull": true
3514 + },
3515 + "indication": {
3516 + "name": "indication",
3517 + "type": "text",
3518 + "primaryKey": false,
3519 + "notNull": true
3520 + },
3521 + "line_of_therapy": {
3522 + "name": "line_of_therapy",
3523 + "type": "text",
3524 + "primaryKey": false,
3525 + "notNull": false
3526 + },
3527 + "disease_stage": {
3528 + "name": "disease_stage",
3529 + "type": "text",
3530 + "primaryKey": false,
3531 + "notNull": false
3532 + },
3533 + "approval_type": {
3534 + "name": "approval_type",
3535 + "type": "text",
3536 + "primaryKey": false,
3537 + "notNull": false
3538 + },
3539 + "accelerated": {
3540 + "name": "accelerated",
3541 + "type": "boolean",
3542 + "primaryKey": false,
3543 + "notNull": false
3544 + },
3545 + "conditional": {
3546 + "name": "conditional",
3547 + "type": "boolean",
3548 + "primaryKey": false,
3549 + "notNull": false
3550 + },
3551 + "approval_date": {
3552 + "name": "approval_date",
3553 + "type": "text",
3554 + "primaryKey": false,
3555 + "notNull": false
3556 + },
3557 + "withdrawal_date": {
3558 + "name": "withdrawal_date",
3559 + "type": "text",
3560 + "primaryKey": false,
3561 + "notNull": false
3562 + },
3563 + "status": {
3564 + "name": "status",
3565 + "type": "text",
3566 + "primaryKey": false,
3567 + "notNull": true
3568 + },
3569 + "application_number": {
3570 + "name": "application_number",
3571 + "type": "text",
3572 + "primaryKey": false,
3573 + "notNull": false
3574 + },
3575 + "source_id": {
3576 + "name": "source_id",
3577 + "type": "varchar(32)",
3578 + "primaryKey": false,
3579 + "notNull": true
3580 + },
3581 + "provenance_id": {
3582 + "name": "provenance_id",
3583 + "type": "integer",
3584 + "primaryKey": false,
3585 + "notNull": true
3586 + },
3587 + "raw": {
3588 + "name": "raw",
3589 + "type": "jsonb",
3590 + "primaryKey": false,
3591 + "notNull": false
3592 + },
3593 + "created_at": {
3594 + "name": "created_at",
3595 + "type": "timestamp with time zone",
3596 + "primaryKey": false,
3597 + "notNull": true,
3598 + "default": "now()"
3599 + },
3600 + "updated_at": {
3601 + "name": "updated_at",
3602 + "type": "timestamp with time zone",
3603 + "primaryKey": false,
3604 + "notNull": true,
3605 + "default": "now()"
3606 + }
3607 + },
3608 + "indexes": {
3609 + "drug_approvals_drug_idx": {
3610 + "name": "drug_approvals_drug_idx",
3611 + "columns": [
3612 + {
3613 + "expression": "drug_id",
3614 + "isExpression": false,
3615 + "asc": true,
3616 + "nulls": "last"
3617 + }
3618 + ],
3619 + "isUnique": false,
3620 + "concurrently": false,
3621 + "method": "btree",
3622 + "with": {}
3623 + },
3624 + "drug_approvals_cancer_idx": {
3625 + "name": "drug_approvals_cancer_idx",
3626 + "columns": [
3627 + {
3628 + "expression": "cancer_id",
3629 + "isExpression": false,
3630 + "asc": true,
3631 + "nulls": "last"
3632 + }
3633 + ],
3634 + "isUnique": false,
3635 + "concurrently": false,
3636 + "method": "btree",
3637 + "with": {}
3638 + }
3639 + },
3640 + "foreignKeys": {},
3641 + "compositePrimaryKeys": {},
3642 + "uniqueConstraints": {},
3643 + "policies": {},
3644 + "checkConstraints": {},
3645 + "isRLSEnabled": false
3646 + },
3647 + "public.drugs": {
3648 + "name": "drugs",
3649 + "schema": "",
3650 + "columns": {
3651 + "id": {
3652 + "name": "id",
3653 + "type": "varchar(32)",
3654 + "primaryKey": true,
3655 + "notNull": true
3656 + },
3657 + "slug": {
3658 + "name": "slug",
3659 + "type": "text",
3660 + "primaryKey": false,
3661 + "notNull": true
3662 + },
3663 + "name": {
3664 + "name": "name",
3665 + "type": "text",
3666 + "primaryKey": false,
3667 + "notNull": true
3668 + },
3669 + "kind": {
3670 + "name": "kind",
3671 + "type": "text",
3672 + "primaryKey": false,
3673 + "notNull": false
3674 + },
3675 + "ncit_code": {
3676 + "name": "ncit_code",
3677 + "type": "text",
3678 + "primaryKey": false,
3679 + "notNull": false
3680 + },
3681 + "chembl_id": {
3682 + "name": "chembl_id",
3683 + "type": "text",
3684 + "primaryKey": false,
3685 + "notNull": false
3686 + },
3687 + "civic_therapy_id": {
3688 + "name": "civic_therapy_id",
3689 + "type": "integer",
3690 + "primaryKey": false,
3691 + "notNull": false
3692 + },
3693 + "drugbank_id": {
3694 + "name": "drugbank_id",
3695 + "type": "text",
3696 + "primaryKey": false,
3697 + "notNull": false
3698 + },
3699 + "pubchem_cid": {
3700 + "name": "pubchem_cid",
3701 + "type": "text",
3702 + "primaryKey": false,
3703 + "notNull": false
3704 + },
3705 + "unii": {
3706 + "name": "unii",
3707 + "type": "text",
3708 + "primaryKey": false,
3709 + "notNull": false
3710 + },
3711 + "mechanism": {
3712 + "name": "mechanism",
3713 + "type": "text",
3714 + "primaryKey": false,
3715 + "notNull": false
3716 + },
3717 + "target_gene_ids": {
3718 + "name": "target_gene_ids",
3719 + "type": "text[]",
3720 + "primaryKey": false,
3721 + "notNull": true,
3722 + "default": "'{}'"
3723 + },
3724 + "development_status": {
3725 + "name": "development_status",
3726 + "type": "text",
3727 + "primaryKey": false,
3728 + "notNull": false
3729 + },
3730 + "description": {
3731 + "name": "description",
3732 + "type": "text",
3733 + "primaryKey": false,
3734 + "notNull": false
3735 + },
3736 + "created_at": {
3737 + "name": "created_at",
3738 + "type": "timestamp with time zone",
3739 + "primaryKey": false,
3740 + "notNull": true,
3741 + "default": "now()"
3742 + },
3743 + "updated_at": {
3744 + "name": "updated_at",
3745 + "type": "timestamp with time zone",
3746 + "primaryKey": false,
3747 + "notNull": true,
3748 + "default": "now()"
3749 + }
3750 + },
3751 + "indexes": {
3752 + "drugs_slug_uq": {
3753 + "name": "drugs_slug_uq",
3754 + "columns": [
3755 + {
3756 + "expression": "slug",
3757 + "isExpression": false,
3758 + "asc": true,
3759 + "nulls": "last"
3760 + }
3761 + ],
3762 + "isUnique": true,
3763 + "concurrently": false,
3764 + "method": "btree",
3765 + "with": {}
3766 + },
3767 + "drugs_ncit_idx": {
3768 + "name": "drugs_ncit_idx",
3769 + "columns": [
3770 + {
3771 + "expression": "ncit_code",
3772 + "isExpression": false,
3773 + "asc": true,
3774 + "nulls": "last"
3775 + }
3776 + ],
3777 + "isUnique": false,
3778 + "concurrently": false,
3779 + "method": "btree",
3780 + "with": {}
3781 + },
3782 + "drugs_civic_idx": {
3783 + "name": "drugs_civic_idx",
3784 + "columns": [
3785 + {
3786 + "expression": "civic_therapy_id",
3787 + "isExpression": false,
3788 + "asc": true,
3789 + "nulls": "last"
3790 + }
3791 + ],
3792 + "isUnique": false,
3793 + "concurrently": false,
3794 + "method": "btree",
3795 + "with": {}
3796 + },
3797 + "drugs_chembl_idx": {
3798 + "name": "drugs_chembl_idx",
3799 + "columns": [
3800 + {
3801 + "expression": "chembl_id",
3802 + "isExpression": false,
3803 + "asc": true,
3804 + "nulls": "last"
3805 + }
3806 + ],
3807 + "isUnique": false,
3808 + "concurrently": false,
3809 + "method": "btree",
3810 + "with": {}
3811 + }
3812 + },
3813 + "foreignKeys": {},
3814 + "compositePrimaryKeys": {},
3815 + "uniqueConstraints": {},
3816 + "policies": {},
3817 + "checkConstraints": {},
3818 + "isRLSEnabled": false
3819 + },
3820 + "public.treatment_regimens": {
3821 + "name": "treatment_regimens",
3822 + "schema": "",
3823 + "columns": {
3824 + "id": {
3825 + "name": "id",
3826 + "type": "varchar(32)",
3827 + "primaryKey": true,
3828 + "notNull": true
3829 + },
3830 + "slug": {
3831 + "name": "slug",
3832 + "type": "text",
3833 + "primaryKey": false,
3834 + "notNull": true
3835 + },
3836 + "name": {
3837 + "name": "name",
3838 + "type": "text",
3839 + "primaryKey": false,
3840 + "notNull": true
3841 + },
3842 + "component_drug_ids": {
3843 + "name": "component_drug_ids",
3844 + "type": "text[]",
3845 + "primaryKey": false,
3846 + "notNull": true,
3847 + "default": "'{}'"
3848 + },
3849 + "modality": {
3850 + "name": "modality",
3851 + "type": "text",
3852 + "primaryKey": false,
3853 + "notNull": true,
3854 + "default": "'drug_combination'"
3855 + },
3856 + "description": {
3857 + "name": "description",
3858 + "type": "text",
3859 + "primaryKey": false,
3860 + "notNull": false
3861 + },
3862 + "created_at": {
3863 + "name": "created_at",
3864 + "type": "timestamp with time zone",
3865 + "primaryKey": false,
3866 + "notNull": true,
3867 + "default": "now()"
3868 + }
3869 + },
3870 + "indexes": {
3871 + "treatment_regimens_slug_uq": {
3872 + "name": "treatment_regimens_slug_uq",
3873 + "columns": [
3874 + {
3875 + "expression": "slug",
3876 + "isExpression": false,
3877 + "asc": true,
3878 + "nulls": "last"
3879 + }
3880 + ],
3881 + "isUnique": true,
3882 + "concurrently": false,
3883 + "method": "btree",
3884 + "with": {}
3885 + }
3886 + },
3887 + "foreignKeys": {},
3888 + "compositePrimaryKeys": {},
3889 + "uniqueConstraints": {},
3890 + "policies": {},
3891 + "checkConstraints": {},
3892 + "isRLSEnabled": false
3893 + },
3894 + "public.clinical_trials": {
3895 + "name": "clinical_trials",
3896 + "schema": "",
3897 + "columns": {
3898 + "id": {
3899 + "name": "id",
3900 + "type": "varchar(32)",
3901 + "primaryKey": true,
3902 + "notNull": true
3903 + },
3904 + "nct_id": {
3905 + "name": "nct_id",
3906 + "type": "text",
3907 + "primaryKey": false,
3908 + "notNull": true
3909 + },
3910 + "brief_title": {
3911 + "name": "brief_title",
3912 + "type": "text",
3913 + "primaryKey": false,
3914 + "notNull": true
3915 + },
3916 + "official_title": {
3917 + "name": "official_title",
3918 + "type": "text",
3919 + "primaryKey": false,
3920 + "notNull": false
3921 + },
3922 + "acronym": {
3923 + "name": "acronym",
3924 + "type": "text",
3925 + "primaryKey": false,
3926 + "notNull": false
3927 + },
3928 + "study_type": {
3929 + "name": "study_type",
3930 + "type": "text",
3931 + "primaryKey": false,
3932 + "notNull": false
3933 + },
3934 + "phases": {
3935 + "name": "phases",
3936 + "type": "text[]",
3937 + "primaryKey": false,
3938 + "notNull": true,
3939 + "default": "'{}'"
3940 + },
3941 + "overall_status": {
3942 + "name": "overall_status",
3943 + "type": "text",
3944 + "primaryKey": false,
3945 + "notNull": false
3946 + },
3947 + "why_stopped": {
3948 + "name": "why_stopped",
3949 + "type": "text",
3950 + "primaryKey": false,
3951 + "notNull": false
3952 + },
3953 + "start_date": {
3954 + "name": "start_date",
3955 + "type": "text",
3956 + "primaryKey": false,
3957 + "notNull": false
3958 + },
3959 + "primary_completion_date": {
3960 + "name": "primary_completion_date",
3961 + "type": "text",
3962 + "primaryKey": false,
3963 + "notNull": false
3964 + },
3965 + "completion_date": {
3966 + "name": "completion_date",
3967 + "type": "text",
3968 + "primaryKey": false,
3969 + "notNull": false
3970 + },
3971 + "first_posted_date": {
3972 + "name": "first_posted_date",
3973 + "type": "text",
3974 + "primaryKey": false,
3975 + "notNull": false
3976 + },
3977 + "last_update_posted_date": {
3978 + "name": "last_update_posted_date",
3979 + "type": "text",
3980 + "primaryKey": false,
3981 + "notNull": false
3982 + },
3983 + "results_first_posted_date": {
3984 + "name": "results_first_posted_date",
3985 + "type": "text",
3986 + "primaryKey": false,
3987 + "notNull": false
3988 + },
3989 + "has_results": {
3990 + "name": "has_results",
3991 + "type": "boolean",
3992 + "primaryKey": false,
3993 + "notNull": true,
3994 + "default": false
3995 + },
3996 + "enrollment_count": {
3997 + "name": "enrollment_count",
3998 + "type": "integer",
3999 + "primaryKey": false,
4000 + "notNull": false
4001 + },
4002 + "enrollment_type": {
4003 + "name": "enrollment_type",
4004 + "type": "text",
4005 + "primaryKey": false,
4006 + "notNull": false
4007 + },
4008 + "lead_sponsor": {
4009 + "name": "lead_sponsor",
4010 + "type": "text",
4011 + "primaryKey": false,
4012 + "notNull": false
4013 + },
4014 + "lead_sponsor_class": {
4015 + "name": "lead_sponsor_class",
4016 + "type": "text",
4017 + "primaryKey": false,
4018 + "notNull": false
4019 + },
4020 + "collaborators": {
4021 + "name": "collaborators",
4022 + "type": "text[]",
4023 + "primaryKey": false,
4024 + "notNull": true,
4025 + "default": "'{}'"
4026 + },
4027 + "conditions": {
4028 + "name": "conditions",
4029 + "type": "text[]",
4030 + "primaryKey": false,
4031 + "notNull": true,
4032 + "default": "'{}'"
4033 + },
4034 + "keywords": {
4035 + "name": "keywords",
4036 + "type": "text[]",
4037 + "primaryKey": false,
4038 + "notNull": true,
4039 + "default": "'{}'"
4040 + },
4041 + "interventions": {
4042 + "name": "interventions",
4043 + "type": "jsonb",
4044 + "primaryKey": false,
4045 + "notNull": true,
4046 + "default": "'[]'::jsonb"
4047 + },
4048 + "arms": {
4049 + "name": "arms",
4050 + "type": "jsonb",
4051 + "primaryKey": false,
4052 + "notNull": true,
4053 + "default": "'[]'::jsonb"
4054 + },
4055 + "primary_outcomes": {
4056 + "name": "primary_outcomes",
4057 + "type": "jsonb",
4058 + "primaryKey": false,
4059 + "notNull": true,
4060 + "default": "'[]'::jsonb"
4061 + },
4062 + "secondary_outcomes": {
4063 + "name": "secondary_outcomes",
4064 + "type": "jsonb",
4065 + "primaryKey": false,
4066 + "notNull": true,
4067 + "default": "'[]'::jsonb"
4068 + },
4069 + "eligibility": {
4070 + "name": "eligibility",
4071 + "type": "jsonb",
4072 + "primaryKey": false,
4073 + "notNull": true,
4074 + "default": "'{}'::jsonb"
4075 + },
4076 + "sex": {
4077 + "name": "sex",
4078 + "type": "text",
4079 + "primaryKey": false,
4080 + "notNull": false
4081 + },
4082 + "minimum_age": {
4083 + "name": "minimum_age",
4084 + "type": "text",
4085 + "primaryKey": false,
4086 + "notNull": false
4087 + },
4088 + "maximum_age": {
4089 + "name": "maximum_age",
4090 + "type": "text",
4091 + "primaryKey": false,
4092 + "notNull": false
4093 + },
4094 + "countries": {
4095 + "name": "countries",
4096 + "type": "text[]",
4097 + "primaryKey": false,
4098 + "notNull": true,
4099 + "default": "'{}'"
4100 + },
4101 + "locations_count": {
4102 + "name": "locations_count",
4103 + "type": "integer",
4104 + "primaryKey": false,
4105 + "notNull": true,
4106 + "default": 0
4107 + },
4108 + "references": {
4109 + "name": "references",
4110 + "type": "jsonb",
4111 + "primaryKey": false,
4112 + "notNull": true,
4113 + "default": "'[]'::jsonb"
4114 + },
4115 + "brief_summary": {
4116 + "name": "brief_summary",
4117 + "type": "text",
4118 + "primaryKey": false,
4119 + "notNull": false
4120 + },
4121 + "is_oncology": {
4122 + "name": "is_oncology",
4123 + "type": "boolean",
4124 + "primaryKey": false,
4125 + "notNull": true,
4126 + "default": true
4127 + },
4128 + "source_record_id": {
4129 + "name": "source_record_id",
4130 + "type": "integer",
4131 + "primaryKey": false,
4132 + "notNull": false
4133 + },
4134 + "ingest_run_id": {
4135 + "name": "ingest_run_id",
4136 + "type": "text",
4137 + "primaryKey": false,
4138 + "notNull": false
4139 + },
4140 + "created_at": {
4141 + "name": "created_at",
4142 + "type": "timestamp with time zone",
4143 + "primaryKey": false,
4144 + "notNull": true,
4145 + "default": "now()"
4146 + },
4147 + "updated_at": {
4148 + "name": "updated_at",
4149 + "type": "timestamp with time zone",
4150 + "primaryKey": false,
4151 + "notNull": true,
4152 + "default": "now()"
4153 + }
4154 + },
4155 + "indexes": {
4156 + "clinical_trials_nct_uq": {
4157 + "name": "clinical_trials_nct_uq",
4158 + "columns": [
4159 + {
4160 + "expression": "nct_id",
4161 + "isExpression": false,
4162 + "asc": true,
4163 + "nulls": "last"
4164 + }
4165 + ],
4166 + "isUnique": true,
4167 + "concurrently": false,
4168 + "method": "btree",
4169 + "with": {}
4170 + },
4171 + "clinical_trials_status_idx": {
4172 + "name": "clinical_trials_status_idx",
4173 + "columns": [
4174 + {
4175 + "expression": "overall_status",
4176 + "isExpression": false,
4177 + "asc": true,
4178 + "nulls": "last"
4179 + }
4180 + ],
4181 + "isUnique": false,
4182 + "concurrently": false,
4183 + "method": "btree",
4184 + "with": {}
4185 + },
4186 + "clinical_trials_updated_idx": {
4187 + "name": "clinical_trials_updated_idx",
4188 + "columns": [
4189 + {
4190 + "expression": "last_update_posted_date",
4191 + "isExpression": false,
4192 + "asc": true,
4193 + "nulls": "last"
4194 + }
4195 + ],
4196 + "isUnique": false,
4197 + "concurrently": false,
4198 + "method": "btree",
4199 + "with": {}
4200 + },
4201 + "clinical_trials_sponsor_idx": {
4202 + "name": "clinical_trials_sponsor_idx",
4203 + "columns": [
4204 + {
4205 + "expression": "lead_sponsor",
4206 + "isExpression": false,
4207 + "asc": true,
4208 + "nulls": "last"
4209 + }
4210 + ],
4211 + "isUnique": false,
4212 + "concurrently": false,
4213 + "method": "btree",
4214 + "with": {}
4215 + }
4216 + },
4217 + "foreignKeys": {},
4218 + "compositePrimaryKeys": {},
4219 + "uniqueConstraints": {},
4220 + "policies": {},
4221 + "checkConstraints": {},
4222 + "isRLSEnabled": false
4223 + },
4224 + "public.trial_conditions": {
4225 + "name": "trial_conditions",
4226 + "schema": "",
4227 + "columns": {
4228 + "id": {
4229 + "name": "id",
4230 + "type": "bigserial",
4231 + "primaryKey": true,
4232 + "notNull": true
4233 + },
4234 + "trial_id": {
4235 + "name": "trial_id",
4236 + "type": "varchar(32)",
4237 + "primaryKey": false,
4238 + "notNull": true
4239 + },
4240 + "condition_text": {
4241 + "name": "condition_text",
4242 + "type": "text",
4243 + "primaryKey": false,
4244 + "notNull": true
4245 + },
4246 + "normalized": {
4247 + "name": "normalized",
4248 + "type": "text",
4249 + "primaryKey": false,
4250 + "notNull": true
4251 + },
4252 + "cancer_id": {
4253 + "name": "cancer_id",
4254 + "type": "varchar(32)",
4255 + "primaryKey": false,
4256 + "notNull": false
4257 + },
4258 + "match_type": {
4259 + "name": "match_type",
4260 + "type": "text",
4261 + "primaryKey": false,
4262 + "notNull": true,
4263 + "default": "'UNRESOLVED'"
4264 + },
4265 + "confidence": {
4266 + "name": "confidence",
4267 + "type": "real",
4268 + "primaryKey": false,
4269 + "notNull": false
4270 + }
4271 + },
4272 + "indexes": {
4273 + "trial_conditions_uq": {
4274 + "name": "trial_conditions_uq",
4275 + "columns": [
4276 + {
4277 + "expression": "trial_id",
4278 + "isExpression": false,
4279 + "asc": true,
4280 + "nulls": "last"
4281 + },
4282 + {
4283 + "expression": "normalized",
4284 + "isExpression": false,
4285 + "asc": true,
4286 + "nulls": "last"
4287 + }
4288 + ],
4289 + "isUnique": true,
4290 + "concurrently": false,
4291 + "method": "btree",
4292 + "with": {}
4293 + },
4294 + "trial_conditions_cancer_idx": {
4295 + "name": "trial_conditions_cancer_idx",
4296 + "columns": [
4297 + {
4298 + "expression": "cancer_id",
4299 + "isExpression": false,
4300 + "asc": true,
4301 + "nulls": "last"
4302 + }
4303 + ],
4304 + "isUnique": false,
4305 + "concurrently": false,
4306 + "method": "btree",
4307 + "with": {}
4308 + },
4309 + "trial_conditions_norm_idx": {
4310 + "name": "trial_conditions_norm_idx",
4311 + "columns": [
4312 + {
4313 + "expression": "normalized",
4314 + "isExpression": false,
4315 + "asc": true,
4316 + "nulls": "last"
4317 + }
4318 + ],
4319 + "isUnique": false,
4320 + "concurrently": false,
4321 + "method": "btree",
4322 + "with": {}
4323 + }
4324 + },
4325 + "foreignKeys": {},
4326 + "compositePrimaryKeys": {},
4327 + "uniqueConstraints": {},
4328 + "policies": {},
4329 + "checkConstraints": {},
4330 + "isRLSEnabled": false
4331 + },
4332 + "public.trial_interventions": {
4333 + "name": "trial_interventions",
4334 + "schema": "",
4335 + "columns": {
4336 + "id": {
4337 + "name": "id",
4338 + "type": "bigserial",
4339 + "primaryKey": true,
4340 + "notNull": true
4341 + },
4342 + "trial_id": {
4343 + "name": "trial_id",
4344 + "type": "varchar(32)",
4345 + "primaryKey": false,
4346 + "notNull": true
4347 + },
4348 + "name": {
4349 + "name": "name",
4350 + "type": "text",
4351 + "primaryKey": false,
4352 + "notNull": true
4353 + },
4354 + "normalized": {
4355 + "name": "normalized",
4356 + "type": "text",
4357 + "primaryKey": false,
4358 + "notNull": true
4359 + },
4360 + "intervention_type": {
4361 + "name": "intervention_type",
4362 + "type": "text",
4363 + "primaryKey": false,
4364 + "notNull": false
4365 + },
4366 + "drug_id": {
4367 + "name": "drug_id",
4368 + "type": "varchar(32)",
4369 + "primaryKey": false,
4370 + "notNull": false
4371 + },
4372 + "match_type": {
4373 + "name": "match_type",
4374 + "type": "text",
4375 + "primaryKey": false,
4376 + "notNull": true,
4377 + "default": "'UNRESOLVED'"
4378 + }
4379 + },
4380 + "indexes": {
4381 + "trial_interventions_uq": {
4382 + "name": "trial_interventions_uq",
4383 + "columns": [
4384 + {
4385 + "expression": "trial_id",
4386 + "isExpression": false,
4387 + "asc": true,
4388 + "nulls": "last"
4389 + },
4390 + {
4391 + "expression": "normalized",
4392 + "isExpression": false,
4393 + "asc": true,
4394 + "nulls": "last"
4395 + }
4396 + ],
4397 + "isUnique": true,
4398 + "concurrently": false,
4399 + "method": "btree",
4400 + "with": {}
4401 + },
4402 + "trial_interventions_drug_idx": {
4403 + "name": "trial_interventions_drug_idx",
4404 + "columns": [
4405 + {
4406 + "expression": "drug_id",
4407 + "isExpression": false,
4408 + "asc": true,
4409 + "nulls": "last"
4410 + }
4411 + ],
4412 + "isUnique": false,
4413 + "concurrently": false,
4414 + "method": "btree",
4415 + "with": {}
4416 + }
4417 + },
4418 + "foreignKeys": {},
4419 + "compositePrimaryKeys": {},
4420 + "uniqueConstraints": {},
4421 + "policies": {},
4422 + "checkConstraints": {},
4423 + "isRLSEnabled": false
4424 + },
4425 + "public.trial_locations": {
4426 + "name": "trial_locations",
4427 + "schema": "",
4428 + "columns": {
4429 + "id": {
4430 + "name": "id",
4431 + "type": "bigserial",
4432 + "primaryKey": true,
4433 + "notNull": true
4434 + },
4435 + "trial_id": {
4436 + "name": "trial_id",
4437 + "type": "varchar(32)",
4438 + "primaryKey": false,
4439 + "notNull": true
4440 + },
4441 + "facility": {
4442 + "name": "facility",
4443 + "type": "text",
4444 + "primaryKey": false,
4445 + "notNull": false
4446 + },
4447 + "city": {
4448 + "name": "city",
4449 + "type": "text",
4450 + "primaryKey": false,
4451 + "notNull": false
4452 + },
4453 + "state": {
4454 + "name": "state",
4455 + "type": "text",
4456 + "primaryKey": false,
4457 + "notNull": false
4458 + },
4459 + "zip": {
4460 + "name": "zip",
4461 + "type": "text",
4462 + "primaryKey": false,
4463 + "notNull": false
4464 + },
4465 + "country": {
4466 + "name": "country",
4467 + "type": "text",
4468 + "primaryKey": false,
4469 + "notNull": false
4470 + },
4471 + "status": {
4472 + "name": "status",
4473 + "type": "text",
4474 + "primaryKey": false,
4475 + "notNull": false
4476 + },
4477 + "lat": {
4478 + "name": "lat",
4479 + "type": "real",
4480 + "primaryKey": false,
4481 + "notNull": false
4482 + },
4483 + "lng": {
4484 + "name": "lng",
4485 + "type": "real",
4486 + "primaryKey": false,
4487 + "notNull": false
4488 + }
4489 + },
4490 + "indexes": {
4491 + "trial_locations_trial_idx": {
4492 + "name": "trial_locations_trial_idx",
4493 + "columns": [
4494 + {
4495 + "expression": "trial_id",
4496 + "isExpression": false,
4497 + "asc": true,
4498 + "nulls": "last"
4499 + }
4500 + ],
4501 + "isUnique": false,
4502 + "concurrently": false,
4503 + "method": "btree",
4504 + "with": {}
4505 + },
4506 + "trial_locations_country_idx": {
4507 + "name": "trial_locations_country_idx",
4508 + "columns": [
4509 + {
4510 + "expression": "country",
4511 + "isExpression": false,
4512 + "asc": true,
4513 + "nulls": "last"
4514 + }
4515 + ],
4516 + "isUnique": false,
4517 + "concurrently": false,
4518 + "method": "btree",
4519 + "with": {}
4520 + }
4521 + },
4522 + "foreignKeys": {},
4523 + "compositePrimaryKeys": {},
4524 + "uniqueConstraints": {},
4525 + "policies": {},
4526 + "checkConstraints": {},
4527 + "isRLSEnabled": false
4528 + },
4529 + "public.trial_pulse": {
4530 + "name": "trial_pulse",
4531 + "schema": "",
4532 + "columns": {
4533 + "id": {
4534 + "name": "id",
4535 + "type": "bigserial",
4536 + "primaryKey": true,
4537 + "notNull": true
4538 + },
4539 + "day": {
4540 + "name": "day",
4541 + "type": "date",
4542 + "primaryKey": false,
4543 + "notNull": true
4544 + },
4545 + "cancer_id": {
4546 + "name": "cancer_id",
4547 + "type": "varchar(32)",
4548 + "primaryKey": false,
4549 + "notNull": false
4550 + },
4551 + "phase": {
4552 + "name": "phase",
4553 + "type": "text",
4554 + "primaryKey": false,
4555 + "notNull": false
4556 + },
4557 + "new_trials": {
4558 + "name": "new_trials",
4559 + "type": "integer",
4560 + "primaryKey": false,
4561 + "notNull": true
4562 + },
4563 + "updated_at": {
4564 + "name": "updated_at",
4565 + "type": "timestamp with time zone",
4566 + "primaryKey": false,
4567 + "notNull": true,
4568 + "default": "now()"
4569 + }
4570 + },
4571 + "indexes": {
4572 + "trial_pulse_uq": {
4573 + "name": "trial_pulse_uq",
4574 + "columns": [
4575 + {
4576 + "expression": "day",
4577 + "isExpression": false,
4578 + "asc": true,
4579 + "nulls": "last"
4580 + },
4581 + {
4582 + "expression": "cancer_id",
4583 + "isExpression": false,
4584 + "asc": true,
4585 + "nulls": "last"
4586 + },
4587 + {
4588 + "expression": "phase",
4589 + "isExpression": false,
4590 + "asc": true,
4591 + "nulls": "last"
4592 + }
4593 + ],
4594 + "isUnique": true,
4595 + "concurrently": false,
4596 + "method": "btree",
4597 + "with": {}
4598 + }
4599 + },
4600 + "foreignKeys": {},
4601 + "compositePrimaryKeys": {},
4602 + "uniqueConstraints": {},
4603 + "policies": {},
4604 + "checkConstraints": {},
4605 + "isRLSEnabled": false
4606 + },
4607 + "public.literature_counts": {
4608 + "name": "literature_counts",
4609 + "schema": "",
4610 + "columns": {
4611 + "id": {
4612 + "name": "id",
4613 + "type": "bigserial",
4614 + "primaryKey": true,
4615 + "notNull": true
4616 + },
4617 + "cancer_id": {
4618 + "name": "cancer_id",
4619 + "type": "varchar(32)",
4620 + "primaryKey": false,
4621 + "notNull": true
4622 + },
4623 + "window_key": {
4624 + "name": "window_key",
4625 + "type": "text",
4626 + "primaryKey": false,
4627 + "notNull": true
4628 + },
4629 + "window_start": {
4630 + "name": "window_start",
4631 + "type": "text",
4632 + "primaryKey": false,
4633 + "notNull": false
4634 + },
4635 + "window_end": {
4636 + "name": "window_end",
4637 + "type": "text",
4638 + "primaryKey": false,
4639 + "notNull": false
4640 + },
4641 + "query": {
4642 + "name": "query",
4643 + "type": "text",
4644 + "primaryKey": false,
4645 + "notNull": true
4646 + },
4647 + "count": {
4648 + "name": "count",
4649 + "type": "integer",
4650 + "primaryKey": false,
4651 + "notNull": true
4652 + },
4653 + "provenance_id": {
4654 + "name": "provenance_id",
4655 + "type": "integer",
4656 + "primaryKey": false,
4657 + "notNull": true
4658 + },
4659 + "updated_at": {
4660 + "name": "updated_at",
4661 + "type": "timestamp with time zone",
4662 + "primaryKey": false,
4663 + "notNull": true,
4664 + "default": "now()"
4665 + }
4666 + },
4667 + "indexes": {
4668 + "literature_counts_uq": {
4669 + "name": "literature_counts_uq",
4670 + "columns": [
4671 + {
4672 + "expression": "cancer_id",
4673 + "isExpression": false,
4674 + "asc": true,
4675 + "nulls": "last"
4676 + },
4677 + {
4678 + "expression": "window_key",
4679 + "isExpression": false,
4680 + "asc": true,
4681 + "nulls": "last"
4682 + }
4683 + ],
4684 + "isUnique": true,
4685 + "concurrently": false,
4686 + "method": "btree",
4687 + "with": {}
4688 + },
4689 + "literature_counts_window_idx": {
4690 + "name": "literature_counts_window_idx",
4691 + "columns": [
4692 + {
4693 + "expression": "window_key",
4694 + "isExpression": false,
4695 + "asc": true,
4696 + "nulls": "last"
4697 + },
4698 + {
4699 + "expression": "count",
4700 + "isExpression": false,
4701 + "asc": true,
4702 + "nulls": "last"
4703 + }
4704 + ],
4705 + "isUnique": false,
4706 + "concurrently": false,
4707 + "method": "btree",
4708 + "with": {}
4709 + }
4710 + },
4711 + "foreignKeys": {},
4712 + "compositePrimaryKeys": {},
4713 + "uniqueConstraints": {},
4714 + "policies": {},
4715 + "checkConstraints": {},
4716 + "isRLSEnabled": false
4717 + },
4718 + "public.publication_entity_edges": {
4719 + "name": "publication_entity_edges",
4720 + "schema": "",
4721 + "columns": {
4722 + "id": {
4723 + "name": "id",
4724 + "type": "bigserial",
4725 + "primaryKey": true,
4726 + "notNull": true
4727 + },
4728 + "publication_id": {
4729 + "name": "publication_id",
4730 + "type": "varchar(32)",
4731 + "primaryKey": false,
4732 + "notNull": true
4733 + },
4734 + "entity_type": {
4735 + "name": "entity_type",
4736 + "type": "text",
4737 + "primaryKey": false,
4738 + "notNull": true
4739 + },
4740 + "entity_id": {
4741 + "name": "entity_id",
4742 + "type": "text",
4743 + "primaryKey": false,
4744 + "notNull": true
4745 + },
4746 + "method": {
4747 + "name": "method",
4748 + "type": "text",
4749 + "primaryKey": false,
4750 + "notNull": true
4751 + },
4752 + "confidence": {
4753 + "name": "confidence",
4754 + "type": "real",
4755 + "primaryKey": false,
4756 + "notNull": false
4757 + },
4758 + "status": {
4759 + "name": "status",
4760 + "type": "text",
4761 + "primaryKey": false,
4762 + "notNull": true,
4763 + "default": "'candidate'"
4764 + },
4765 + "source_id": {
4766 + "name": "source_id",
4767 + "type": "varchar(32)",
4768 + "primaryKey": false,
4769 + "notNull": false
4770 + },
4771 + "ingest_run_id": {
4772 + "name": "ingest_run_id",
4773 + "type": "text",
4774 + "primaryKey": false,
4775 + "notNull": false
4776 + },
4777 + "created_at": {
4778 + "name": "created_at",
4779 + "type": "timestamp with time zone",
4780 + "primaryKey": false,
4781 + "notNull": true,
4782 + "default": "now()"
4783 + }
4784 + },
4785 + "indexes": {
4786 + "pub_entity_edges_uq": {
4787 + "name": "pub_entity_edges_uq",
4788 + "columns": [
4789 + {
4790 + "expression": "publication_id",
4791 + "isExpression": false,
4792 + "asc": true,
4793 + "nulls": "last"
4794 + },
4795 + {
4796 + "expression": "entity_type",
4797 + "isExpression": false,
4798 + "asc": true,
4799 + "nulls": "last"
4800 + },
4801 + {
4802 + "expression": "entity_id",
4803 + "isExpression": false,
4804 + "asc": true,
4805 + "nulls": "last"
4806 + },
4807 + {
4808 + "expression": "method",
4809 + "isExpression": false,
4810 + "asc": true,
4811 + "nulls": "last"
4812 + }
4813 + ],
4814 + "isUnique": true,
4815 + "concurrently": false,
4816 + "method": "btree",
4817 + "with": {}
4818 + },
4819 + "pub_entity_edges_entity_idx": {
4820 + "name": "pub_entity_edges_entity_idx",
4821 + "columns": [
4822 + {
4823 + "expression": "entity_type",
4824 + "isExpression": false,
4825 + "asc": true,
4826 + "nulls": "last"
4827 + },
4828 + {
4829 + "expression": "entity_id",
4830 + "isExpression": false,
4831 + "asc": true,
4832 + "nulls": "last"
4833 + }
4834 + ],
4835 + "isUnique": false,
4836 + "concurrently": false,
4837 + "method": "btree",
4838 + "with": {}
4839 + }
4840 + },
4841 + "foreignKeys": {},
4842 + "compositePrimaryKeys": {},
4843 + "uniqueConstraints": {},
4844 + "policies": {},
4845 + "checkConstraints": {},
4846 + "isRLSEnabled": false
4847 + },
4848 + "public.publications": {
4849 + "name": "publications",
4850 + "schema": "",
4851 + "columns": {
4852 + "id": {
4853 + "name": "id",
4854 + "type": "varchar(32)",
4855 + "primaryKey": true,
4856 + "notNull": true
4857 + },
4858 + "pmid": {
4859 + "name": "pmid",
4860 + "type": "text",
4861 + "primaryKey": false,
4862 + "notNull": false
4863 + },
4864 + "doi": {
4865 + "name": "doi",
4866 + "type": "text",
4867 + "primaryKey": false,
4868 + "notNull": false
4869 + },
4870 + "pmcid": {
4871 + "name": "pmcid",
4872 + "type": "text",
4873 + "primaryKey": false,
4874 + "notNull": false
4875 + },
4876 + "title": {
4877 + "name": "title",
4878 + "type": "text",
4879 + "primaryKey": false,
4880 + "notNull": true
4881 + },
4882 + "abstract": {
4883 + "name": "abstract",
4884 + "type": "text",
4885 + "primaryKey": false,
4886 + "notNull": false
4887 + },
4888 + "journal": {
4889 + "name": "journal",
4890 + "type": "text",
4891 + "primaryKey": false,
4892 + "notNull": false
4893 + },
4894 + "journal_iso": {
4895 + "name": "journal_iso",
4896 + "type": "text",
4897 + "primaryKey": false,
4898 + "notNull": false
4899 + },
4900 + "pub_date": {
4901 + "name": "pub_date",
4902 + "type": "text",
4903 + "primaryKey": false,
4904 + "notNull": false
4905 + },
4906 + "pub_year": {
4907 + "name": "pub_year",
4908 + "type": "integer",
4909 + "primaryKey": false,
4910 + "notNull": false
4911 + },
4912 + "publication_types": {
4913 + "name": "publication_types",
4914 + "type": "text[]",
4915 + "primaryKey": false,
4916 + "notNull": true,
4917 + "default": "'{}'"
4918 + },
4919 + "mesh_terms": {
4920 + "name": "mesh_terms",
4921 + "type": "jsonb",
4922 + "primaryKey": false,
4923 + "notNull": true,
4924 + "default": "'[]'::jsonb"
4925 + },
4926 + "authors": {
4927 + "name": "authors",
4928 + "type": "jsonb",
4929 + "primaryKey": false,
4930 + "notNull": true,
4931 + "default": "'[]'::jsonb"
4932 + },
4933 + "language": {
4934 + "name": "language",
4935 + "type": "text",
4936 + "primaryKey": false,
4937 + "notNull": false
4938 + },
4939 + "is_preprint": {
4940 + "name": "is_preprint",
4941 + "type": "boolean",
4942 + "primaryKey": false,
4943 + "notNull": true,
4944 + "default": false
4945 + },
4946 + "retracted": {
4947 + "name": "retracted",
4948 + "type": "boolean",
4949 + "primaryKey": false,
4950 + "notNull": true,
4951 + "default": false
4952 + },
4953 + "retraction_notice": {
4954 + "name": "retraction_notice",
4955 + "type": "text",
4956 + "primaryKey": false,
4957 + "notNull": false
4958 + },
4959 + "nct_ids": {
4960 + "name": "nct_ids",
4961 + "type": "text[]",
4962 + "primaryKey": false,
4963 + "notNull": true,
4964 + "default": "'{}'"
4965 + },
4966 + "cited_by_count": {
4967 + "name": "cited_by_count",
4968 + "type": "integer",
4969 + "primaryKey": false,
4970 + "notNull": false
4971 + },
4972 + "source_record_id": {
4973 + "name": "source_record_id",
4974 + "type": "integer",
4975 + "primaryKey": false,
4976 + "notNull": false
4977 + },
4978 + "ingest_run_id": {
4979 + "name": "ingest_run_id",
4980 + "type": "text",
4981 + "primaryKey": false,
4982 + "notNull": false
4983 + },
4984 + "created_at": {
4985 + "name": "created_at",
4986 + "type": "timestamp with time zone",
4987 + "primaryKey": false,
4988 + "notNull": true,
4989 + "default": "now()"
4990 + },
4991 + "updated_at": {
4992 + "name": "updated_at",
4993 + "type": "timestamp with time zone",
4994 + "primaryKey": false,
4995 + "notNull": true,
4996 + "default": "now()"
4997 + }
4998 + },
4999 + "indexes": {
5000 + "publications_pmid_uq": {
5001 + "name": "publications_pmid_uq",
5002 + "columns": [
5003 + {
5004 + "expression": "pmid",
5005 + "isExpression": false,
5006 + "asc": true,
5007 + "nulls": "last"
5008 + }
5009 + ],
5010 + "isUnique": true,
5011 + "concurrently": false,
5012 + "method": "btree",
5013 + "with": {}
5014 + },
5015 + "publications_doi_idx": {
5016 + "name": "publications_doi_idx",
5017 + "columns": [
5018 + {
5019 + "expression": "doi",
5020 + "isExpression": false,
5021 + "asc": true,
5022 + "nulls": "last"
5023 + }
5024 + ],
5025 + "isUnique": false,
5026 + "concurrently": false,
5027 + "method": "btree",
5028 + "with": {}
5029 + },
5030 + "publications_year_idx": {
5031 + "name": "publications_year_idx",
5032 + "columns": [
5033 + {
5034 + "expression": "pub_year",
5035 + "isExpression": false,
5036 + "asc": true,
5037 + "nulls": "last"
5038 + }
5039 + ],
5040 + "isUnique": false,
5041 + "concurrently": false,
5042 + "method": "btree",
5043 + "with": {}
5044 + },
5045 + "publications_retracted_idx": {
5046 + "name": "publications_retracted_idx",
5047 + "columns": [
5048 + {
5049 + "expression": "retracted",
5050 + "isExpression": false,
5051 + "asc": true,
5052 + "nulls": "last"
5053 + }
5054 + ],
5055 + "isUnique": false,
5056 + "concurrently": false,
5057 + "method": "btree",
5058 + "with": {}
5059 + }
5060 + },
5061 + "foreignKeys": {},
5062 + "compositePrimaryKeys": {},
5063 + "uniqueConstraints": {},
5064 + "policies": {},
5065 + "checkConstraints": {},
5066 + "isRLSEnabled": false
5067 + },
5068 + "public.civic_evidence_items": {
5069 + "name": "civic_evidence_items",
5070 + "schema": "",
5071 + "columns": {
5072 + "id": {
5073 + "name": "id",
5074 + "type": "bigserial",
5075 + "primaryKey": true,
5076 + "notNull": true
5077 + },
5078 + "civic_id": {
5079 + "name": "civic_id",
5080 + "type": "integer",
5081 + "primaryKey": false,
5082 + "notNull": true
5083 + },
5084 + "name": {
5085 + "name": "name",
5086 + "type": "text",
5087 + "primaryKey": false,
5088 + "notNull": false
5089 + },
5090 + "molecular_profile_id": {
5091 + "name": "molecular_profile_id",
5092 + "type": "integer",
5093 + "primaryKey": false,
5094 + "notNull": false
5095 + },
5096 + "molecular_profile_name": {
5097 + "name": "molecular_profile_name",
5098 + "type": "text",
5099 + "primaryKey": false,
5100 + "notNull": false
5101 + },
5102 + "gene_symbols": {
5103 + "name": "gene_symbols",
5104 + "type": "text[]",
5105 + "primaryKey": false,
5106 + "notNull": true,
5107 + "default": "'{}'"
5108 + },
5109 + "gene_ids": {
5110 + "name": "gene_ids",
5111 + "type": "text[]",
5112 + "primaryKey": false,
5113 + "notNull": true,
5114 + "default": "'{}'"
5115 + },
5116 + "variant_ids": {
5117 + "name": "variant_ids",
5118 + "type": "text[]",
5119 + "primaryKey": false,
5120 + "notNull": true,
5121 + "default": "'{}'"
5122 + },
5123 + "civic_variant_ids": {
5124 + "name": "civic_variant_ids",
5125 + "type": "integer[]",
5126 + "primaryKey": false,
5127 + "notNull": true,
5128 + "default": "'{}'"
5129 + },
5130 + "disease_name": {
5131 + "name": "disease_name",
5132 + "type": "text",
5133 + "primaryKey": false,
5134 + "notNull": false
5135 + },
5136 + "doid": {
5137 + "name": "doid",
5138 + "type": "text",
5139 + "primaryKey": false,
5140 + "notNull": false
5141 + },
5142 + "cancer_id": {
5143 + "name": "cancer_id",
5144 + "type": "varchar(32)",
5145 + "primaryKey": false,
5146 + "notNull": false
5147 + },
5148 + "cancer_match_type": {
5149 + "name": "cancer_match_type",
5150 + "type": "text",
5151 + "primaryKey": false,
5152 + "notNull": false
5153 + },
5154 + "therapy_names": {
5155 + "name": "therapy_names",
5156 + "type": "text[]",
5157 + "primaryKey": false,
5158 + "notNull": true,
5159 + "default": "'{}'"
5160 + },
5161 + "therapy_ids": {
5162 + "name": "therapy_ids",
5163 + "type": "text[]",
5164 + "primaryKey": false,
5165 + "notNull": true,
5166 + "default": "'{}'"
5167 + },
5168 + "therapy_interaction_type": {
5169 + "name": "therapy_interaction_type",
5170 + "type": "text",
5171 + "primaryKey": false,
5172 + "notNull": false
5173 + },
5174 + "evidence_type": {
5175 + "name": "evidence_type",
5176 + "type": "text",
5177 + "primaryKey": false,
5178 + "notNull": false
5179 + },
5180 + "evidence_level": {
5181 + "name": "evidence_level",
5182 + "type": "text",
5183 + "primaryKey": false,
5184 + "notNull": false
5185 + },
5186 + "evidence_direction": {
5187 + "name": "evidence_direction",
5188 + "type": "text",
5189 + "primaryKey": false,
5190 + "notNull": false
5191 + },
5192 + "significance": {
5193 + "name": "significance",
5194 + "type": "text",
5195 + "primaryKey": false,
5196 + "notNull": false
5197 + },
5198 + "evidence_rating": {
5199 + "name": "evidence_rating",
5200 + "type": "integer",
5201 + "primaryKey": false,
5202 + "notNull": false
5203 + },
5204 + "status": {
5205 + "name": "status",
5206 + "type": "text",
5207 + "primaryKey": false,
5208 + "notNull": false
5209 + },
5210 + "description": {
5211 + "name": "description",
5212 + "type": "text",
5213 + "primaryKey": false,
5214 + "notNull": false
5215 + },
5216 + "pmid": {
5217 + "name": "pmid",
5218 + "type": "text",
5219 + "primaryKey": false,
5220 + "notNull": false
5221 + },
5222 + "source_citation": {
5223 + "name": "source_citation",
5224 + "type": "text",
5225 + "primaryKey": false,
5226 + "notNull": false
5227 + },
5228 + "phenotypes": {
5229 + "name": "phenotypes",
5230 + "type": "text[]",
5231 + "primaryKey": false,
5232 + "notNull": true,
5233 + "default": "'{}'"
5234 + },
5235 + "provenance_id": {
5236 + "name": "provenance_id",
5237 + "type": "integer",
5238 + "primaryKey": false,
5239 + "notNull": true
5240 + },
5241 + "ingest_run_id": {
5242 + "name": "ingest_run_id",
5243 + "type": "text",
5244 + "primaryKey": false,
5245 + "notNull": false
5246 + },
5247 + "updated_at": {
5248 + "name": "updated_at",
5249 + "type": "timestamp with time zone",
5250 + "primaryKey": false,
5251 + "notNull": true,
5252 + "default": "now()"
5253 + }
5254 + },
5255 + "indexes": {
5256 + "civic_evidence_uq": {
5257 + "name": "civic_evidence_uq",
5258 + "columns": [
5259 + {
5260 + "expression": "civic_id",
5261 + "isExpression": false,
5262 + "asc": true,
5263 + "nulls": "last"
5264 + }
5265 + ],
5266 + "isUnique": true,
5267 + "concurrently": false,
5268 + "method": "btree",
5269 + "with": {}
5270 + },
5271 + "civic_evidence_cancer_idx": {
5272 + "name": "civic_evidence_cancer_idx",
5273 + "columns": [
5274 + {
5275 + "expression": "cancer_id",
5276 + "isExpression": false,
5277 + "asc": true,
5278 + "nulls": "last"
5279 + }
5280 + ],
5281 + "isUnique": false,
5282 + "concurrently": false,
5283 + "method": "btree",
5284 + "with": {}
5285 + },
5286 + "civic_evidence_gene_idx": {
5287 + "name": "civic_evidence_gene_idx",
5288 + "columns": [
5289 + {
5290 + "expression": "gene_symbols",
5291 + "isExpression": false,
5292 + "asc": true,
5293 + "nulls": "last"
5294 + }
5295 + ],
5296 + "isUnique": false,
5297 + "concurrently": false,
5298 + "method": "btree",
5299 + "with": {}
5300 + }
5301 + },
5302 + "foreignKeys": {},
5303 + "compositePrimaryKeys": {},
5304 + "uniqueConstraints": {},
5305 + "policies": {},
5306 + "checkConstraints": {},
5307 + "isRLSEnabled": false
5308 + },
5309 + "public.knowledge_edges": {
5310 + "name": "knowledge_edges",
5311 + "schema": "",
5312 + "columns": {
5313 + "id": {
5314 + "name": "id",
5315 + "type": "bigserial",
5316 + "primaryKey": true,
5317 + "notNull": true
5318 + },
5319 + "source_entity_type": {
5320 + "name": "source_entity_type",
5321 + "type": "text",
5322 + "primaryKey": false,
5323 + "notNull": true
5324 + },
5325 + "source_entity_id": {
5326 + "name": "source_entity_id",
5327 + "type": "text",
5328 + "primaryKey": false,
5329 + "notNull": true
5330 + },
5331 + "target_entity_type": {
5332 + "name": "target_entity_type",
5333 + "type": "text",
5334 + "primaryKey": false,
5335 + "notNull": true
5336 + },
5337 + "target_entity_id": {
5338 + "name": "target_entity_id",
5339 + "type": "text",
5340 + "primaryKey": false,
5341 + "notNull": true
5342 + },
5343 + "relationship_type": {
5344 + "name": "relationship_type",
5345 + "type": "text",
5346 + "primaryKey": false,
5347 + "notNull": true
5348 + },
5349 + "cancer_context_ids": {
5350 + "name": "cancer_context_ids",
5351 + "type": "text[]",
5352 + "primaryKey": false,
5353 + "notNull": true,
5354 + "default": "'{}'"
5355 + },
5356 + "predictive": {
5357 + "name": "predictive",
5358 + "type": "boolean",
5359 + "primaryKey": false,
5360 + "notNull": false
5361 + },
5362 + "prognostic": {
5363 + "name": "prognostic",
5364 + "type": "boolean",
5365 + "primaryKey": false,
5366 + "notNull": false
5367 + },
5368 + "diagnostic": {
5369 + "name": "diagnostic",
5370 + "type": "boolean",
5371 + "primaryKey": false,
5372 + "notNull": false
5373 + },
5374 + "predisposing": {
5375 + "name": "predisposing",
5376 + "type": "boolean",
5377 + "primaryKey": false,
5378 + "notNull": false
5379 + },
5380 + "direction": {
5381 + "name": "direction",
5382 + "type": "text",
5383 + "primaryKey": false,
5384 + "notNull": false
5385 + },
5386 + "evidence_level": {
5387 + "name": "evidence_level",
5388 + "type": "text",
5389 + "primaryKey": false,
5390 + "notNull": false
5391 + },
5392 + "evidence_score": {
5393 + "name": "evidence_score",
5394 + "type": "real",
5395 + "primaryKey": false,
5396 + "notNull": false
5397 + },
5398 + "evidence_category": {
5399 + "name": "evidence_category",
5400 + "type": "text",
5401 + "primaryKey": false,
5402 + "notNull": true,
5403 + "default": "'curated_evidence'"
5404 + },
5405 + "status": {
5406 + "name": "status",
5407 + "type": "text",
5408 + "primaryKey": false,
5409 + "notNull": true,
5410 + "default": "'active'"
5411 + },
5412 + "source_id": {
5413 + "name": "source_id",
5414 + "type": "varchar(32)",
5415 + "primaryKey": false,
5416 + "notNull": true
5417 + },
5418 + "source_record_id": {
5419 + "name": "source_record_id",
5420 + "type": "text",
5421 + "primaryKey": false,
5422 + "notNull": false
5423 + },
5424 + "provenance_ids": {
5425 + "name": "provenance_ids",
5426 + "type": "integer[]",
5427 + "primaryKey": false,
5428 + "notNull": true,
5429 + "default": "'{}'"
5430 + },
5431 + "support_count": {
5432 + "name": "support_count",
5433 + "type": "integer",
5434 + "primaryKey": false,
5435 + "notNull": true,
5436 + "default": 1
5437 + },
5438 + "first_seen_at": {
5439 + "name": "first_seen_at",
5440 + "type": "timestamp with time zone",
5441 + "primaryKey": false,
5442 + "notNull": true,
5443 + "default": "now()"
5444 + },
5445 + "last_seen_at": {
5446 + "name": "last_seen_at",
5447 + "type": "timestamp with time zone",
5448 + "primaryKey": false,
5449 + "notNull": true,
5450 + "default": "now()"
5451 + }
5452 + },
5453 + "indexes": {
5454 + "knowledge_edges_uq": {
5455 + "name": "knowledge_edges_uq",
5456 + "columns": [
5457 + {
5458 + "expression": "source_entity_type",
5459 + "isExpression": false,
5460 + "asc": true,
5461 + "nulls": "last"
5462 + },
5463 + {
5464 + "expression": "source_entity_id",
5465 + "isExpression": false,
5466 + "asc": true,
5467 + "nulls": "last"
5468 + },
5469 + {
5470 + "expression": "target_entity_type",
5471 + "isExpression": false,
5472 + "asc": true,
5473 + "nulls": "last"
5474 + },
5475 + {
5476 + "expression": "target_entity_id",
5477 + "isExpression": false,
5478 + "asc": true,
5479 + "nulls": "last"
5480 + },
5481 + {
5482 + "expression": "relationship_type",
5483 + "isExpression": false,
5484 + "asc": true,
5485 + "nulls": "last"
5486 + },
5487 + {
5488 + "expression": "source_id",
5489 + "isExpression": false,
5490 + "asc": true,
5491 + "nulls": "last"
5492 + },
5493 + {
5494 + "expression": "source_record_id",
5495 + "isExpression": false,
5496 + "asc": true,
5497 + "nulls": "last"
5498 + }
5499 + ],
5500 + "isUnique": true,
5501 + "concurrently": false,
5502 + "method": "btree",
5503 + "with": {}
5504 + },
5505 + "knowledge_edges_source_idx": {
5506 + "name": "knowledge_edges_source_idx",
5507 + "columns": [
5508 + {
5509 + "expression": "source_entity_type",
5510 + "isExpression": false,
5511 + "asc": true,
5512 + "nulls": "last"
5513 + },
5514 + {
5515 + "expression": "source_entity_id",
5516 + "isExpression": false,
5517 + "asc": true,
5518 + "nulls": "last"
5519 + },
5520 + {
5521 + "expression": "relationship_type",
5522 + "isExpression": false,
5523 + "asc": true,
5524 + "nulls": "last"
5525 + }
5526 + ],
5527 + "isUnique": false,
5528 + "concurrently": false,
5529 + "method": "btree",
5530 + "with": {}
5531 + },
5532 + "knowledge_edges_target_idx": {
5533 + "name": "knowledge_edges_target_idx",
5534 + "columns": [
5535 + {
5536 + "expression": "target_entity_type",
5537 + "isExpression": false,
5538 + "asc": true,
5539 + "nulls": "last"
5540 + },
5541 + {
5542 + "expression": "target_entity_id",
5543 + "isExpression": false,
5544 + "asc": true,
5545 + "nulls": "last"
5546 + },
5547 + {
5548 + "expression": "relationship_type",
5549 + "isExpression": false,
5550 + "asc": true,
5551 + "nulls": "last"
5552 + }
5553 + ],
5554 + "isUnique": false,
5555 + "concurrently": false,
5556 + "method": "btree",
5557 + "with": {}
5558 + }
5559 + },
5560 + "foreignKeys": {},
5561 + "compositePrimaryKeys": {},
5562 + "uniqueConstraints": {},
5563 + "policies": {},
5564 + "checkConstraints": {},
5565 + "isRLSEnabled": false
5566 + },
5567 + "public.risk_factors": {
5568 + "name": "risk_factors",
5569 + "schema": "",
5570 + "columns": {
5571 + "id": {
5572 + "name": "id",
5573 + "type": "bigserial",
5574 + "primaryKey": true,
5575 + "notNull": true
5576 + },
5577 + "slug": {
5578 + "name": "slug",
5579 + "type": "text",
5580 + "primaryKey": false,
5581 + "notNull": true
5582 + },
5583 + "name": {
5584 + "name": "name",
5585 + "type": "text",
5586 + "primaryKey": false,
5587 + "notNull": true
5588 + },
5589 + "kind": {
5590 + "name": "kind",
5591 + "type": "text",
5592 + "primaryKey": false,
5593 + "notNull": true
5594 + },
5595 + "classification_authority": {
5596 + "name": "classification_authority",
5597 + "type": "text",
5598 + "primaryKey": false,
5599 + "notNull": false
5600 + },
5601 + "classification": {
5602 + "name": "classification",
5603 + "type": "text",
5604 + "primaryKey": false,
5605 + "notNull": false
5606 + },
5607 + "description": {
5608 + "name": "description",
5609 + "type": "text",
5610 + "primaryKey": false,
5611 + "notNull": false
5612 + },
5613 + "created_at": {
5614 + "name": "created_at",
5615 + "type": "timestamp with time zone",
5616 + "primaryKey": false,
5617 + "notNull": true,
5618 + "default": "now()"
5619 + }
5620 + },
5621 + "indexes": {
5622 + "risk_factors_slug_uq": {
5623 + "name": "risk_factors_slug_uq",
5624 + "columns": [
5625 + {
5626 + "expression": "slug",
5627 + "isExpression": false,
5628 + "asc": true,
5629 + "nulls": "last"
5630 + }
5631 + ],
5632 + "isUnique": true,
5633 + "concurrently": false,
5634 + "method": "btree",
5635 + "with": {}
5636 + }
5637 + },
5638 + "foreignKeys": {},
5639 + "compositePrimaryKeys": {},
5640 + "uniqueConstraints": {},
5641 + "policies": {},
5642 + "checkConstraints": {},
5643 + "isRLSEnabled": false
5644 + },
5645 + "public.epidemiology_observations": {
5646 + "name": "epidemiology_observations",
5647 + "schema": "",
5648 + "columns": {
5649 + "id": {
5650 + "name": "id",
5651 + "type": "bigserial",
5652 + "primaryKey": true,
5653 + "notNull": true
5654 + },
5655 + "cancer_id": {
5656 + "name": "cancer_id",
5657 + "type": "varchar(32)",
5658 + "primaryKey": false,
5659 + "notNull": true
5660 + },
5661 + "geography_id": {
5662 + "name": "geography_id",
5663 + "type": "varchar(32)",
5664 + "primaryKey": false,
5665 + "notNull": true
5666 + },
5667 + "year": {
5668 + "name": "year",
5669 + "type": "integer",
5670 + "primaryKey": false,
5671 + "notNull": true
5672 + },
5673 + "year_end": {
5674 + "name": "year_end",
5675 + "type": "integer",
5676 + "primaryKey": false,
5677 + "notNull": false
5678 + },
5679 + "sex": {
5680 + "name": "sex",
5681 + "type": "text",
5682 + "primaryKey": false,
5683 + "notNull": true,
5684 + "default": "'all'"
5685 + },
5686 + "age_group": {
5687 + "name": "age_group",
5688 + "type": "text",
5689 + "primaryKey": false,
5690 + "notNull": true,
5691 + "default": "'all'"
5692 + },
5693 + "metric": {
5694 + "name": "metric",
5695 + "type": "text",
5696 + "primaryKey": false,
5697 + "notNull": true
5698 + },
5699 + "value": {
5700 + "name": "value",
5701 + "type": "double precision",
5702 + "primaryKey": false,
5703 + "notNull": true
5704 + },
5705 + "unit": {
5706 + "name": "unit",
5707 + "type": "text",
5708 + "primaryKey": false,
5709 + "notNull": true
5710 + },
5711 + "lower_ci": {
5712 + "name": "lower_ci",
5713 + "type": "double precision",
5714 + "primaryKey": false,
5715 + "notNull": false
5716 + },
5717 + "upper_ci": {
5718 + "name": "upper_ci",
5719 + "type": "double precision",
5720 + "primaryKey": false,
5721 + "notNull": false
5722 + },
5723 + "standard_population": {
5724 + "name": "standard_population",
5725 + "type": "text",
5726 + "primaryKey": false,
5727 + "notNull": false
5728 + },
5729 + "estimate_type": {
5730 + "name": "estimate_type",
5731 + "type": "text",
5732 + "primaryKey": false,
5733 + "notNull": true,
5734 + "default": "'observed'"
5735 + },
5736 + "site_definition": {
5737 + "name": "site_definition",
5738 + "type": "text",
5739 + "primaryKey": false,
5740 + "notNull": false
5741 + },
5742 + "source_id": {
5743 + "name": "source_id",
5744 + "type": "varchar(32)",
5745 + "primaryKey": false,
5746 + "notNull": true
5747 + },
5748 + "provenance_id": {
5749 + "name": "provenance_id",
5750 + "type": "integer",
5751 + "primaryKey": false,
5752 + "notNull": true
5753 + },
5754 + "ingest_run_id": {
5755 + "name": "ingest_run_id",
5756 + "type": "text",
5757 + "primaryKey": false,
5758 + "notNull": false
5759 + },
5760 + "updated_at": {
5761 + "name": "updated_at",
5762 + "type": "timestamp with time zone",
5763 + "primaryKey": false,
5764 + "notNull": true,
5765 + "default": "now()"
5766 + }
5767 + },
5768 + "indexes": {
5769 + "epi_obs_uq": {
5770 + "name": "epi_obs_uq",
5771 + "columns": [
5772 + {
5773 + "expression": "cancer_id",
5774 + "isExpression": false,
5775 + "asc": true,
5776 + "nulls": "last"
5777 + },
5778 + {
5779 + "expression": "geography_id",
5780 + "isExpression": false,
5781 + "asc": true,
5782 + "nulls": "last"
5783 + },
5784 + {
5785 + "expression": "year",
5786 + "isExpression": false,
5787 + "asc": true,
5788 + "nulls": "last"
5789 + },
5790 + {
5791 + "expression": "sex",
5792 + "isExpression": false,
5793 + "asc": true,
5794 + "nulls": "last"
5795 + },
5796 + {
5797 + "expression": "age_group",
5798 + "isExpression": false,
5799 + "asc": true,
5800 + "nulls": "last"
5801 + },
5802 + {
5803 + "expression": "metric",
5804 + "isExpression": false,
5805 + "asc": true,
5806 + "nulls": "last"
5807 + },
5808 + {
5809 + "expression": "source_id",
5810 + "isExpression": false,
5811 + "asc": true,
5812 + "nulls": "last"
5813 + },
5814 + {
5815 + "expression": "site_definition",
5816 + "isExpression": false,
5817 + "asc": true,
5818 + "nulls": "last"
5819 + }
5820 + ],
5821 + "isUnique": true,
5822 + "concurrently": false,
5823 + "method": "btree",
5824 + "with": {}
5825 + },
5826 + "epi_obs_lookup_idx": {
5827 + "name": "epi_obs_lookup_idx",
5828 + "columns": [
5829 + {
5830 + "expression": "metric",
5831 + "isExpression": false,
5832 + "asc": true,
5833 + "nulls": "last"
5834 + },
5835 + {
5836 + "expression": "geography_id",
5837 + "isExpression": false,
5838 + "asc": true,
5839 + "nulls": "last"
5840 + },
5841 + {
5842 + "expression": "year",
5843 + "isExpression": false,
5844 + "asc": true,
5845 + "nulls": "last"
5846 + },
5847 + {
5848 + "expression": "sex",
5849 + "isExpression": false,
5850 + "asc": true,
5851 + "nulls": "last"
5852 + }
5853 + ],
5854 + "isUnique": false,
5855 + "concurrently": false,
5856 + "method": "btree",
5857 + "with": {}
5858 + },
5859 + "epi_obs_cancer_idx": {
5860 + "name": "epi_obs_cancer_idx",
5861 + "columns": [
5862 + {
5863 + "expression": "cancer_id",
5864 + "isExpression": false,
5865 + "asc": true,
5866 + "nulls": "last"
5867 + },
5868 + {
5869 + "expression": "metric",
5870 + "isExpression": false,
5871 + "asc": true,
5872 + "nulls": "last"
5873 + }
5874 + ],
5875 + "isUnique": false,
5876 + "concurrently": false,
5877 + "method": "btree",
5878 + "with": {}
5879 + }
5880 + },
5881 + "foreignKeys": {},
5882 + "compositePrimaryKeys": {},
5883 + "uniqueConstraints": {},
5884 + "policies": {},
5885 + "checkConstraints": {},
5886 + "isRLSEnabled": false
5887 + },
5888 + "public.survival_observations": {
5889 + "name": "survival_observations",
5890 + "schema": "",
5891 + "columns": {
5892 + "id": {
5893 + "name": "id",
5894 + "type": "bigserial",
5895 + "primaryKey": true,
5896 + "notNull": true
5897 + },
5898 + "cancer_id": {
5899 + "name": "cancer_id",
5900 + "type": "varchar(32)",
5901 + "primaryKey": false,
5902 + "notNull": true
5903 + },
5904 + "geography_id": {
5905 + "name": "geography_id",
5906 + "type": "varchar(32)",
5907 + "primaryKey": false,
5908 + "notNull": false
5909 + },
5910 + "stage": {
5911 + "name": "stage",
5912 + "type": "text",
5913 + "primaryKey": false,
5914 + "notNull": false
5915 + },
5916 + "staging_system": {
5917 + "name": "staging_system",
5918 + "type": "text",
5919 + "primaryKey": false,
5920 + "notNull": false
5921 + },
5922 + "sex": {
5923 + "name": "sex",
5924 + "type": "text",
5925 + "primaryKey": false,
5926 + "notNull": true,
5927 + "default": "'all'"
5928 + },
5929 + "age_group": {
5930 + "name": "age_group",
5931 + "type": "text",
5932 + "primaryKey": false,
5933 + "notNull": true,
5934 + "default": "'all'"
5935 + },
5936 + "diagnosis_period": {
5937 + "name": "diagnosis_period",
5938 + "type": "text",
5939 + "primaryKey": false,
5940 + "notNull": false
5941 + },
5942 + "survival_type": {
5943 + "name": "survival_type",
5944 + "type": "text",
5945 + "primaryKey": false,
5946 + "notNull": true
5947 + },
5948 + "duration_months": {
5949 + "name": "duration_months",
5950 + "type": "integer",
5951 + "primaryKey": false,
5952 + "notNull": true
5953 + },
5954 + "probability": {
5955 + "name": "probability",
5956 + "type": "real",
5957 + "primaryKey": false,
5958 + "notNull": false
5959 + },
5960 + "median_months": {
5961 + "name": "median_months",
5962 + "type": "real",
5963 + "primaryKey": false,
5964 + "notNull": false
5965 + },
5966 + "cohort_size": {
5967 + "name": "cohort_size",
5968 + "type": "integer",
5969 + "primaryKey": false,
5970 + "notNull": false
5971 + },
5972 + "lower_ci": {
5973 + "name": "lower_ci",
5974 + "type": "real",
5975 + "primaryKey": false,
5976 + "notNull": false
5977 + },
5978 + "upper_ci": {
5979 + "name": "upper_ci",
5980 + "type": "real",
5981 + "primaryKey": false,
5982 + "notNull": false
5983 + },
5984 + "method": {
5985 + "name": "method",
5986 + "type": "text",
5987 + "primaryKey": false,
5988 + "notNull": false
5989 + },
5990 + "source_id": {
5991 + "name": "source_id",
5992 + "type": "varchar(32)",
5993 + "primaryKey": false,
5994 + "notNull": true
5995 + },
5996 + "provenance_id": {
5997 + "name": "provenance_id",
5998 + "type": "integer",
5999 + "primaryKey": false,
6000 + "notNull": true
6001 + },
6002 + "ingest_run_id": {
6003 + "name": "ingest_run_id",
6004 + "type": "text",
6005 + "primaryKey": false,
6006 + "notNull": false
6007 + },
6008 + "updated_at": {
6009 + "name": "updated_at",
6010 + "type": "timestamp with time zone",
6011 + "primaryKey": false,
6012 + "notNull": true,
6013 + "default": "now()"
6014 + }
6015 + },
6016 + "indexes": {
6017 + "survival_obs_cancer_idx": {
6018 + "name": "survival_obs_cancer_idx",
6019 + "columns": [
6020 + {
6021 + "expression": "cancer_id",
6022 + "isExpression": false,
6023 + "asc": true,
6024 + "nulls": "last"
6025 + },
6026 + {
6027 + "expression": "survival_type",
6028 + "isExpression": false,
6029 + "asc": true,
6030 + "nulls": "last"
6031 + },
6032 + {
6033 + "expression": "duration_months",
6034 + "isExpression": false,
6035 + "asc": true,
6036 + "nulls": "last"
6037 + }
6038 + ],
6039 + "isUnique": false,
6040 + "concurrently": false,
6041 + "method": "btree",
6042 + "with": {}
6043 + }
6044 + },
6045 + "foreignKeys": {},
6046 + "compositePrimaryKeys": {},
6047 + "uniqueConstraints": {},
6048 + "policies": {},
6049 + "checkConstraints": {},
6050 + "isRLSEnabled": false
6051 + },
6052 + "public.ai_answers": {
6053 + "name": "ai_answers",
6054 + "schema": "",
6055 + "columns": {
6056 + "id": {
6057 + "name": "id",
6058 + "type": "bigserial",
6059 + "primaryKey": true,
6060 + "notNull": true
6061 + },
6062 + "kind": {
6063 + "name": "kind",
6064 + "type": "text",
6065 + "primaryKey": false,
6066 + "notNull": true
6067 + },
6068 + "subject_id": {
6069 + "name": "subject_id",
6070 + "type": "text",
6071 + "primaryKey": false,
6072 + "notNull": false
6073 + },
6074 + "question_hash": {
6075 + "name": "question_hash",
6076 + "type": "text",
6077 + "primaryKey": false,
6078 + "notNull": true
6079 + },
6080 + "question": {
6081 + "name": "question",
6082 + "type": "text",
6083 + "primaryKey": false,
6084 + "notNull": false
6085 + },
6086 + "answer": {
6087 + "name": "answer",
6088 + "type": "jsonb",
6089 + "primaryKey": false,
6090 + "notNull": true
6091 + },
6092 + "model": {
6093 + "name": "model",
6094 + "type": "text",
6095 + "primaryKey": false,
6096 + "notNull": true
6097 + },
6098 + "prompt_version": {
6099 + "name": "prompt_version",
6100 + "type": "text",
6101 + "primaryKey": false,
6102 + "notNull": true
6103 + },
6104 + "source_snapshot": {
6105 + "name": "source_snapshot",
6106 + "type": "jsonb",
6107 + "primaryKey": false,
6108 + "notNull": true,
6109 + "default": "'{}'::jsonb"
6110 + },
6111 + "data_as_of": {
6112 + "name": "data_as_of",
6113 + "type": "timestamp with time zone",
6114 + "primaryKey": false,
6115 + "notNull": true
6116 + },
6117 + "created_at": {
6118 + "name": "created_at",
6119 + "type": "timestamp with time zone",
6120 + "primaryKey": false,
6121 + "notNull": true,
6122 + "default": "now()"
6123 + }
6124 + },
6125 + "indexes": {
6126 + "ai_answers_uq": {
6127 + "name": "ai_answers_uq",
6128 + "columns": [
6129 + {
6130 + "expression": "kind",
6131 + "isExpression": false,
6132 + "asc": true,
6133 + "nulls": "last"
6134 + },
6135 + {
6136 + "expression": "question_hash",
6137 + "isExpression": false,
6138 + "asc": true,
6139 + "nulls": "last"
6140 + },
6141 + {
6142 + "expression": "prompt_version",
6143 + "isExpression": false,
6144 + "asc": true,
6145 + "nulls": "last"
6146 + }
6147 + ],
6148 + "isUnique": true,
6149 + "concurrently": false,
6150 + "method": "btree",
6151 + "with": {}
6152 + }
6153 + },
6154 + "foreignKeys": {},
6155 + "compositePrimaryKeys": {},
6156 + "uniqueConstraints": {},
6157 + "policies": {},
6158 + "checkConstraints": {},
6159 + "isRLSEnabled": false
6160 + },
6161 + "public.api_keys": {
6162 + "name": "api_keys",
6163 + "schema": "",
6164 + "columns": {
6165 + "id": {
6166 + "name": "id",
6167 + "type": "bigserial",
6168 + "primaryKey": true,
6169 + "notNull": true
6170 + },
6171 + "key_hash": {
6172 + "name": "key_hash",
6173 + "type": "text",
6174 + "primaryKey": false,
6175 + "notNull": true
6176 + },
6177 + "prefix": {
6178 + "name": "prefix",
6179 + "type": "text",
6180 + "primaryKey": false,
6181 + "notNull": true
6182 + },
6183 + "label": {
6184 + "name": "label",
6185 + "type": "text",
6186 + "primaryKey": false,
6187 + "notNull": false
6188 + },
6189 + "owner_email": {
6190 + "name": "owner_email",
6191 + "type": "text",
6192 + "primaryKey": false,
6193 + "notNull": false
6194 + },
6195 + "tier": {
6196 + "name": "tier",
6197 + "type": "text",
6198 + "primaryKey": false,
6199 + "notNull": true,
6200 + "default": "'free'"
6201 + },
6202 + "rate_limit_per_minute": {
6203 + "name": "rate_limit_per_minute",
6204 + "type": "integer",
6205 + "primaryKey": false,
6206 + "notNull": true,
6207 + "default": 60
6208 + },
6209 + "active": {
6210 + "name": "active",
6211 + "type": "boolean",
6212 + "primaryKey": false,
6213 + "notNull": true,
6214 + "default": true
6215 + },
6216 + "last_used_at": {
6217 + "name": "last_used_at",
6218 + "type": "timestamp with time zone",
6219 + "primaryKey": false,
6220 + "notNull": false
6221 + },
6222 + "created_at": {
6223 + "name": "created_at",
6224 + "type": "timestamp with time zone",
6225 + "primaryKey": false,
6226 + "notNull": true,
6227 + "default": "now()"
6228 + }
6229 + },
6230 + "indexes": {
6231 + "api_keys_hash_uq": {
6232 + "name": "api_keys_hash_uq",
6233 + "columns": [
6234 + {
6235 + "expression": "key_hash",
6236 + "isExpression": false,
6237 + "asc": true,
6238 + "nulls": "last"
6239 + }
6240 + ],
6241 + "isUnique": true,
6242 + "concurrently": false,
6243 + "method": "btree",
6244 + "with": {}
6245 + }
6246 + },
6247 + "foreignKeys": {},
6248 + "compositePrimaryKeys": {},
6249 + "uniqueConstraints": {},
6250 + "policies": {},
6251 + "checkConstraints": {},
6252 + "isRLSEnabled": false
6253 + },
6254 + "public.entity_counters": {
6255 + "name": "entity_counters",
6256 + "schema": "",
6257 + "columns": {
6258 + "id": {
6259 + "name": "id",
6260 + "type": "bigserial",
6261 + "primaryKey": true,
6262 + "notNull": true
6263 + },
6264 + "entity_type": {
6265 + "name": "entity_type",
6266 + "type": "text",
6267 + "primaryKey": false,
6268 + "notNull": true
6269 + },
6270 + "entity_id": {
6271 + "name": "entity_id",
6272 + "type": "text",
6273 + "primaryKey": false,
6274 + "notNull": true
6275 + },
6276 + "trial_count": {
6277 + "name": "trial_count",
6278 + "type": "integer",
6279 + "primaryKey": false,
6280 + "notNull": true,
6281 + "default": 0
6282 + },
6283 + "active_trial_count": {
6284 + "name": "active_trial_count",
6285 + "type": "integer",
6286 + "primaryKey": false,
6287 + "notNull": true,
6288 + "default": 0
6289 + },
6290 + "recruiting_trial_count": {
6291 + "name": "recruiting_trial_count",
6292 + "type": "integer",
6293 + "primaryKey": false,
6294 + "notNull": true,
6295 + "default": 0
6296 + },
6297 + "phase3_trial_count": {
6298 + "name": "phase3_trial_count",
6299 + "type": "integer",
6300 + "primaryKey": false,
6301 + "notNull": true,
6302 + "default": 0
6303 + },
6304 + "publication_count": {
6305 + "name": "publication_count",
6306 + "type": "integer",
6307 + "primaryKey": false,
6308 + "notNull": true,
6309 + "default": 0
6310 + },
6311 + "publication_count_5y": {
6312 + "name": "publication_count_5y",
6313 + "type": "integer",
6314 + "primaryKey": false,
6315 + "notNull": true,
6316 + "default": 0
6317 + },
6318 + "publication_count_12m": {
6319 + "name": "publication_count_12m",
6320 + "type": "integer",
6321 + "primaryKey": false,
6322 + "notNull": true,
6323 + "default": 0
6324 + },
6325 + "gene_count": {
6326 + "name": "gene_count",
6327 + "type": "integer",
6328 + "primaryKey": false,
6329 + "notNull": true,
6330 + "default": 0
6331 + },
6332 + "variant_count": {
6333 + "name": "variant_count",
6334 + "type": "integer",
6335 + "primaryKey": false,
6336 + "notNull": true,
6337 + "default": 0
6338 + },
6339 + "drug_count": {
6340 + "name": "drug_count",
6341 + "type": "integer",
6342 + "primaryKey": false,
6343 + "notNull": true,
6344 + "default": 0
6345 + },
6346 + "approved_drug_count": {
6347 + "name": "approved_drug_count",
6348 + "type": "integer",
6349 + "primaryKey": false,
6350 + "notNull": true,
6351 + "default": 0
6352 + },
6353 + "evidence_count": {
6354 + "name": "evidence_count",
6355 + "type": "integer",
6356 + "primaryKey": false,
6357 + "notNull": true,
6358 + "default": 0
6359 + },
6360 + "cohort_count": {
6361 + "name": "cohort_count",
6362 + "type": "integer",
6363 + "primaryKey": false,
6364 + "notNull": true,
6365 + "default": 0
6366 + },
6367 + "subtype_count": {
6368 + "name": "subtype_count",
6369 + "type": "integer",
6370 + "primaryKey": false,
6371 + "notNull": true,
6372 + "default": 0
6373 + },
6374 + "descendant_count": {
6375 + "name": "descendant_count",
6376 + "type": "integer",
6377 + "primaryKey": false,
6378 + "notNull": true,
6379 + "default": 0
6380 + },
6381 + "epidemiology_obs_count": {
6382 + "name": "epidemiology_obs_count",
6383 + "type": "integer",
6384 + "primaryKey": false,
6385 + "notNull": true,
6386 + "default": 0
6387 + },
6388 + "survival_obs_count": {
6389 + "name": "survival_obs_count",
6390 + "type": "integer",
6391 + "primaryKey": false,
6392 + "notNull": true,
6393 + "default": 0
6394 + },
6395 + "completeness": {
6396 + "name": "completeness",
6397 + "type": "jsonb",
6398 + "primaryKey": false,
6399 + "notNull": true,
6400 + "default": "'{}'::jsonb"
6401 + },
6402 + "updated_at": {
6403 + "name": "updated_at",
6404 + "type": "timestamp with time zone",
6405 + "primaryKey": false,
6406 + "notNull": true,
6407 + "default": "now()"
6408 + }
6409 + },
6410 + "indexes": {
6411 + "entity_counters_uq": {
6412 + "name": "entity_counters_uq",
6413 + "columns": [
6414 + {
6415 + "expression": "entity_type",
6416 + "isExpression": false,
6417 + "asc": true,
6418 + "nulls": "last"
6419 + },
6420 + {
6421 + "expression": "entity_id",
6422 + "isExpression": false,
6423 + "asc": true,
6424 + "nulls": "last"
6425 + }
6426 + ],
6427 + "isUnique": true,
6428 + "concurrently": false,
6429 + "method": "btree",
6430 + "with": {}
6431 + },
6432 + "entity_counters_trials_idx": {
6433 + "name": "entity_counters_trials_idx",
6434 + "columns": [
6435 + {
6436 + "expression": "entity_type",
6437 + "isExpression": false,
6438 + "asc": true,
6439 + "nulls": "last"
6440 + },
6441 + {
6442 + "expression": "active_trial_count",
6443 + "isExpression": false,
6444 + "asc": true,
6445 + "nulls": "last"
6446 + }
6447 + ],
6448 + "isUnique": false,
6449 + "concurrently": false,
6450 + "method": "btree",
6451 + "with": {}
6452 + }
6453 + },
6454 + "foreignKeys": {},
6455 + "compositePrimaryKeys": {},
6456 + "uniqueConstraints": {},
6457 + "policies": {},
6458 + "checkConstraints": {},
6459 + "isRLSEnabled": false
6460 + },
6461 + "public.metric_definitions": {
6462 + "name": "metric_definitions",
6463 + "schema": "",
6464 + "columns": {
6465 + "id": {
6466 + "name": "id",
6467 + "type": "varchar(32)",
6468 + "primaryKey": true,
6469 + "notNull": true
6470 + },
6471 + "slug": {
6472 + "name": "slug",
6473 + "type": "text",
6474 + "primaryKey": false,
6475 + "notNull": true
6476 + },
6477 + "name": {
6478 + "name": "name",
6479 + "type": "text",
6480 + "primaryKey": false,
6481 + "notNull": true
6482 + },
6483 + "description": {
6484 + "name": "description",
6485 + "type": "text",
6486 + "primaryKey": false,
6487 + "notNull": true
6488 + },
6489 + "formula": {
6490 + "name": "formula",
6491 + "type": "text",
6492 + "primaryKey": false,
6493 + "notNull": true
6494 + },
6495 + "formula_version": {
6496 + "name": "formula_version",
6497 + "type": "text",
6498 + "primaryKey": false,
6499 + "notNull": true
6500 + },
6501 + "unit": {
6502 + "name": "unit",
6503 + "type": "text",
6504 + "primaryKey": false,
6505 + "notNull": true
6506 + },
6507 + "higher_is_worse": {
6508 + "name": "higher_is_worse",
6509 + "type": "boolean",
6510 + "primaryKey": false,
6511 + "notNull": false
6512 + },
6513 + "aggregation": {
6514 + "name": "aggregation",
6515 + "type": "text",
6516 + "primaryKey": false,
6517 + "notNull": false
6518 + },
6519 + "valid_dimensions": {
6520 + "name": "valid_dimensions",
6521 + "type": "text[]",
6522 + "primaryKey": false,
6523 + "notNull": true,
6524 + "default": "'{}'"
6525 + },
6526 + "source_slugs": {
6527 + "name": "source_slugs",
6528 + "type": "text[]",
6529 + "primaryKey": false,
6530 + "notNull": true,
6531 + "default": "'{}'"
6532 + },
6533 + "category": {
6534 + "name": "category",
6535 + "type": "text",
6536 + "primaryKey": false,
6537 + "notNull": true
6538 + },
6539 + "eligibility": {
6540 + "name": "eligibility",
6541 + "type": "jsonb",
6542 + "primaryKey": false,
6543 + "notNull": true,
6544 + "default": "'{}'::jsonb"
6545 + },
6546 + "experimental": {
6547 + "name": "experimental",
6548 + "type": "boolean",
6549 + "primaryKey": false,
6550 + "notNull": true,
6551 + "default": false
6552 + },
6553 + "created_at": {
6554 + "name": "created_at",
6555 + "type": "timestamp with time zone",
6556 + "primaryKey": false,
6557 + "notNull": true,
6558 + "default": "now()"
6559 + },
6560 + "updated_at": {
6561 + "name": "updated_at",
6562 + "type": "timestamp with time zone",
6563 + "primaryKey": false,
6564 + "notNull": true,
6565 + "default": "now()"
6566 + }
6567 + },
6568 + "indexes": {
6569 + "metric_definitions_slug_uq": {
6570 + "name": "metric_definitions_slug_uq",
6571 + "columns": [
6572 + {
6573 + "expression": "slug",
6574 + "isExpression": false,
6575 + "asc": true,
6576 + "nulls": "last"
6577 + }
6578 + ],
6579 + "isUnique": true,
6580 + "concurrently": false,
6581 + "method": "btree",
6582 + "with": {}
6583 + }
6584 + },
6585 + "foreignKeys": {},
6586 + "compositePrimaryKeys": {},
6587 + "uniqueConstraints": {},
6588 + "policies": {},
6589 + "checkConstraints": {},
6590 + "isRLSEnabled": false
6591 + },
6592 + "public.ranking_snapshots": {
6593 + "name": "ranking_snapshots",
6594 + "schema": "",
6595 + "columns": {
6596 + "id": {
6597 + "name": "id",
6598 + "type": "bigserial",
6599 + "primaryKey": true,
6600 + "notNull": true
6601 + },
6602 + "metric_id": {
6603 + "name": "metric_id",
6604 + "type": "varchar(32)",
6605 + "primaryKey": false,
6606 + "notNull": true
6607 + },
6608 + "metric_slug": {
6609 + "name": "metric_slug",
6610 + "type": "text",
6611 + "primaryKey": false,
6612 + "notNull": true
6613 + },
6614 + "scope_key": {
6615 + "name": "scope_key",
6616 + "type": "text",
6617 + "primaryKey": false,
6618 + "notNull": true
6619 + },
6620 + "geography": {
6621 + "name": "geography",
6622 + "type": "text",
6623 + "primaryKey": false,
6624 + "notNull": true,
6625 + "default": "'WORLD'"
6626 + },
6627 + "sex": {
6628 + "name": "sex",
6629 + "type": "text",
6630 + "primaryKey": false,
6631 + "notNull": true,
6632 + "default": "'all'"
6633 + },
6634 + "age_group": {
6635 + "name": "age_group",
6636 + "type": "text",
6637 + "primaryKey": false,
6638 + "notNull": true,
6639 + "default": "'all'"
6640 + },
6641 + "year": {
6642 + "name": "year",
6643 + "type": "integer",
6644 + "primaryKey": false,
6645 + "notNull": false
6646 + },
6647 + "entity_level": {
6648 + "name": "entity_level",
6649 + "type": "text",
6650 + "primaryKey": false,
6651 + "notNull": true,
6652 + "default": "'top'"
6653 + },
6654 + "formula_version": {
6655 + "name": "formula_version",
6656 + "type": "text",
6657 + "primaryKey": false,
6658 + "notNull": true
6659 + },
6660 + "eligible_entities": {
6661 + "name": "eligible_entities",
6662 + "type": "integer",
6663 + "primaryKey": false,
6664 + "notNull": true
6665 + },
6666 + "inputs_hash": {
6667 + "name": "inputs_hash",
6668 + "type": "text",
6669 + "primaryKey": false,
6670 + "notNull": true
6671 + },
6672 + "source_ids": {
6673 + "name": "source_ids",
6674 + "type": "text[]",
6675 + "primaryKey": false,
6676 + "notNull": true,
6677 + "default": "'{}'"
6678 + },
6679 + "is_current": {
6680 + "name": "is_current",
6681 + "type": "boolean",
6682 + "primaryKey": false,
6683 + "notNull": true,
6684 + "default": true
6685 + },
6686 + "generated_at": {
6687 + "name": "generated_at",
6688 + "type": "timestamp with time zone",
6689 + "primaryKey": false,
6690 + "notNull": true,
6691 + "default": "now()"
6692 + }
6693 + },
6694 + "indexes": {
6695 + "ranking_snapshots_lookup_idx": {
6696 + "name": "ranking_snapshots_lookup_idx",
6697 + "columns": [
6698 + {
6699 + "expression": "metric_slug",
6700 + "isExpression": false,
6701 + "asc": true,
6702 + "nulls": "last"
6703 + },
6704 + {
6705 + "expression": "scope_key",
6706 + "isExpression": false,
6707 + "asc": true,
6708 + "nulls": "last"
6709 + },
6710 + {
6711 + "expression": "is_current",
6712 + "isExpression": false,
6713 + "asc": true,
6714 + "nulls": "last"
6715 + }
6716 + ],
6717 + "isUnique": false,
6718 + "concurrently": false,
6719 + "method": "btree",
6720 + "with": {}
6721 + }
6722 + },
6723 + "foreignKeys": {},
6724 + "compositePrimaryKeys": {},
6725 + "uniqueConstraints": {},
6726 + "policies": {},
6727 + "checkConstraints": {},
6728 + "isRLSEnabled": false
6729 + },
6730 + "public.rankings": {
6731 + "name": "rankings",
6732 + "schema": "",
6733 + "columns": {
6734 + "id": {
6735 + "name": "id",
6736 + "type": "bigserial",
6737 + "primaryKey": true,
6738 + "notNull": true
6739 + },
6740 + "snapshot_id": {
6741 + "name": "snapshot_id",
6742 + "type": "integer",
6743 + "primaryKey": false,
6744 + "notNull": true
6745 + },
6746 + "metric_slug": {
6747 + "name": "metric_slug",
6748 + "type": "text",
6749 + "primaryKey": false,
6750 + "notNull": true
6751 + },
6752 + "scope_key": {
6753 + "name": "scope_key",
6754 + "type": "text",
6755 + "primaryKey": false,
6756 + "notNull": true
6757 + },
6758 + "cancer_id": {
6759 + "name": "cancer_id",
6760 + "type": "varchar(32)",
6761 + "primaryKey": false,
6762 + "notNull": true
6763 + },
6764 + "rank": {
6765 + "name": "rank",
6766 + "type": "integer",
6767 + "primaryKey": false,
6768 + "notNull": true
6769 + },
6770 + "eligible_entities": {
6771 + "name": "eligible_entities",
6772 + "type": "integer",
6773 + "primaryKey": false,
6774 + "notNull": true
6775 + },
6776 + "percentile": {
6777 + "name": "percentile",
6778 + "type": "real",
6779 + "primaryKey": false,
6780 + "notNull": true
6781 + },
6782 + "value": {
6783 + "name": "value",
6784 + "type": "double precision",
6785 + "primaryKey": false,
6786 + "notNull": true
6787 + },
6788 + "unit": {
6789 + "name": "unit",
6790 + "type": "text",
6791 + "primaryKey": false,
6792 + "notNull": true
6793 + },
6794 + "confidence": {
6795 + "name": "confidence",
6796 + "type": "text",
6797 + "primaryKey": false,
6798 + "notNull": true,
6799 + "default": "'MEDIUM'"
6800 + },
6801 + "inputs": {
6802 + "name": "inputs",
6803 + "type": "jsonb",
6804 + "primaryKey": false,
6805 + "notNull": true,
6806 + "default": "'{}'::jsonb"
6807 + },
6808 + "breakdown": {
6809 + "name": "breakdown",
6810 + "type": "jsonb",
6811 + "primaryKey": false,
6812 + "notNull": false
6813 + },
6814 + "previous_rank": {
6815 + "name": "previous_rank",
6816 + "type": "integer",
6817 + "primaryKey": false,
6818 + "notNull": false
6819 + },
6820 + "generated_at": {
6821 + "name": "generated_at",
6822 + "type": "timestamp with time zone",
6823 + "primaryKey": false,
6824 + "notNull": true,
6825 + "default": "now()"
6826 + }
6827 + },
6828 + "indexes": {
6829 + "rankings_uq": {
6830 + "name": "rankings_uq",
6831 + "columns": [
6832 + {
6833 + "expression": "snapshot_id",
6834 + "isExpression": false,
6835 + "asc": true,
6836 + "nulls": "last"
6837 + },
6838 + {
6839 + "expression": "cancer_id",
6840 + "isExpression": false,
6841 + "asc": true,
6842 + "nulls": "last"
6843 + }
6844 + ],
6845 + "isUnique": true,
6846 + "concurrently": false,
6847 + "method": "btree",
6848 + "with": {}
6849 + },
6850 + "rankings_cancer_idx": {
6851 + "name": "rankings_cancer_idx",
6852 + "columns": [
6853 + {
6854 + "expression": "cancer_id",
6855 + "isExpression": false,
6856 + "asc": true,
6857 + "nulls": "last"
6858 + },
6859 + {
6860 + "expression": "metric_slug",
6861 + "isExpression": false,
6862 + "asc": true,
6863 + "nulls": "last"
6864 + }
6865 + ],
6866 + "isUnique": false,
6867 + "concurrently": false,
6868 + "method": "btree",
6869 + "with": {}
6870 + },
6871 + "rankings_lookup_idx": {
6872 + "name": "rankings_lookup_idx",
6873 + "columns": [
6874 + {
6875 + "expression": "metric_slug",
6876 + "isExpression": false,
6877 + "asc": true,
6878 + "nulls": "last"
6879 + },
6880 + {
6881 + "expression": "scope_key",
6882 + "isExpression": false,
6883 + "asc": true,
6884 + "nulls": "last"
6885 + },
6886 + {
6887 + "expression": "rank",
6888 + "isExpression": false,
6889 + "asc": true,
6890 + "nulls": "last"
6891 + }
6892 + ],
6893 + "isUnique": false,
6894 + "concurrently": false,
6895 + "method": "btree",
6896 + "with": {}
6897 + }
6898 + },
6899 + "foreignKeys": {},
6900 + "compositePrimaryKeys": {},
6901 + "uniqueConstraints": {},
6902 + "policies": {},
6903 + "checkConstraints": {},
6904 + "isRLSEnabled": false
6905 + },
6906 + "public.system_alerts": {
6907 + "name": "system_alerts",
6908 + "schema": "",
6909 + "columns": {
6910 + "id": {
6911 + "name": "id",
6912 + "type": "bigserial",
6913 + "primaryKey": true,
6914 + "notNull": true
6915 + },
6916 + "kind": {
6917 + "name": "kind",
6918 + "type": "text",
6919 + "primaryKey": false,
6920 + "notNull": true
6921 + },
6922 + "severity": {
6923 + "name": "severity",
6924 + "type": "text",
6925 + "primaryKey": false,
6926 + "notNull": true,
6927 + "default": "'warn'"
6928 + },
6929 + "connector_id": {
6930 + "name": "connector_id",
6931 + "type": "text",
6932 + "primaryKey": false,
6933 + "notNull": false
6934 + },
6935 + "message": {
6936 + "name": "message",
6937 + "type": "text",
6938 + "primaryKey": false,
6939 + "notNull": true
6940 + },
6941 + "detail": {
6942 + "name": "detail",
6943 + "type": "jsonb",
6944 + "primaryKey": false,
6945 + "notNull": true,
6946 + "default": "'{}'::jsonb"
6947 + },
6948 + "first_seen_at": {
6949 + "name": "first_seen_at",
6950 + "type": "timestamp with time zone",
6951 + "primaryKey": false,
6952 + "notNull": true,
6953 + "default": "now()"
6954 + },
6955 + "last_seen_at": {
6956 + "name": "last_seen_at",
6957 + "type": "timestamp with time zone",
6958 + "primaryKey": false,
6959 + "notNull": true,
6960 + "default": "now()"
6961 + },
6962 + "count": {
6963 + "name": "count",
6964 + "type": "integer",
6965 + "primaryKey": false,
6966 + "notNull": true,
6967 + "default": 1
6968 + },
6969 + "status": {
6970 + "name": "status",
6971 + "type": "text",
6972 + "primaryKey": false,
6973 + "notNull": true,
6974 + "default": "'open'"
6975 + },
6976 + "resolved_at": {
6977 + "name": "resolved_at",
6978 + "type": "timestamp with time zone",
6979 + "primaryKey": false,
6980 + "notNull": false
6981 + }
6982 + },
6983 + "indexes": {
6984 + "system_alerts_status_idx": {
6985 + "name": "system_alerts_status_idx",
6986 + "columns": [
6987 + {
6988 + "expression": "status",
6989 + "isExpression": false,
6990 + "asc": true,
6991 + "nulls": "last"
6992 + },
6993 + {
6994 + "expression": "kind",
6995 + "isExpression": false,
6996 + "asc": true,
6997 + "nulls": "last"
6998 + },
6999 + {
7000 + "expression": "connector_id",
7001 + "isExpression": false,
7002 + "asc": true,
7003 + "nulls": "last"
7004 + }
7005 + ],
7006 + "isUnique": false,
7007 + "concurrently": false,
7008 + "method": "btree",
7009 + "with": {}
7010 + },
7011 + "system_alerts_seen_idx": {
7012 + "name": "system_alerts_seen_idx",
7013 + "columns": [
7014 + {
7015 + "expression": "last_seen_at",
7016 + "isExpression": false,
7017 + "asc": true,
7018 + "nulls": "last"
7019 + }
7020 + ],
7021 + "isUnique": false,
7022 + "concurrently": false,
7023 + "method": "btree",
7024 + "with": {}
7025 + }
7026 + },
7027 + "foreignKeys": {},
7028 + "compositePrimaryKeys": {},
7029 + "uniqueConstraints": {},
7030 + "policies": {},
7031 + "checkConstraints": {},
7032 + "isRLSEnabled": false
7033 + },
7034 + "public.drug_codes": {
7035 + "name": "drug_codes",
7036 + "schema": "",
7037 + "columns": {
7038 + "id": {
7039 + "name": "id",
7040 + "type": "bigserial",
7041 + "primaryKey": true,
7042 + "notNull": true
7043 + },
7044 + "drug_id": {
7045 + "name": "drug_id",
7046 + "type": "varchar(32)",
7047 + "primaryKey": false,
7048 + "notNull": true
7049 + },
7050 + "system": {
7051 + "name": "system",
7052 + "type": "text",
7053 + "primaryKey": false,
7054 + "notNull": true
7055 + },
7056 + "code": {
7057 + "name": "code",
7058 + "type": "text",
7059 + "primaryKey": false,
7060 + "notNull": true
7061 + },
7062 + "label": {
7063 + "name": "label",
7064 + "type": "text",
7065 + "primaryKey": false,
7066 + "notNull": false
7067 + },
7068 + "match_type": {
7069 + "name": "match_type",
7070 + "type": "text",
7071 + "primaryKey": false,
7072 + "notNull": true,
7073 + "default": "'EXACT_IDENTIFIER'"
7074 + },
7075 + "source_id": {
7076 + "name": "source_id",
7077 + "type": "varchar(32)",
7078 + "primaryKey": false,
7079 + "notNull": false
7080 + }
7081 + },
7082 + "indexes": {
7083 + "drug_codes_uq": {
7084 + "name": "drug_codes_uq",
7085 + "columns": [
7086 + {
7087 + "expression": "drug_id",
7088 + "isExpression": false,
7089 + "asc": true,
7090 + "nulls": "last"
7091 + },
7092 + {
7093 + "expression": "system",
7094 + "isExpression": false,
7095 + "asc": true,
7096 + "nulls": "last"
7097 + },
7098 + {
7099 + "expression": "code",
7100 + "isExpression": false,
7101 + "asc": true,
7102 + "nulls": "last"
7103 + }
7104 + ],
7105 + "isUnique": true,
7106 + "concurrently": false,
7107 + "method": "btree",
7108 + "with": {}
7109 + },
7110 + "drug_codes_lookup_idx": {
7111 + "name": "drug_codes_lookup_idx",
7112 + "columns": [
7113 + {
7114 + "expression": "system",
7115 + "isExpression": false,
7116 + "asc": true,
7117 + "nulls": "last"
7118 + },
7119 + {
7120 + "expression": "code",
7121 + "isExpression": false,
7122 + "asc": true,
7123 + "nulls": "last"
7124 + }
7125 + ],
7126 + "isUnique": false,
7127 + "concurrently": false,
7128 + "method": "btree",
7129 + "with": {}
7130 + }
7131 + },
7132 + "foreignKeys": {},
7133 + "compositePrimaryKeys": {},
7134 + "uniqueConstraints": {},
7135 + "policies": {},
7136 + "checkConstraints": {},
7137 + "isRLSEnabled": false
7138 + },
7139 + "public.drug_pipeline": {
7140 + "name": "drug_pipeline",
7141 + "schema": "",
7142 + "columns": {
7143 + "id": {
7144 + "name": "id",
7145 + "type": "bigserial",
7146 + "primaryKey": true,
7147 + "notNull": true
7148 + },
7149 + "drug_id": {
7150 + "name": "drug_id",
7151 + "type": "varchar(32)",
7152 + "primaryKey": false,
7153 + "notNull": true
7154 + },
7155 + "cancer_id": {
7156 + "name": "cancer_id",
7157 + "type": "varchar(32)",
7158 + "primaryKey": false,
7159 + "notNull": false
7160 + },
7161 + "stage": {
7162 + "name": "stage",
7163 + "type": "text",
7164 + "primaryKey": false,
7165 + "notNull": true
7166 + },
7167 + "max_phase": {
7168 + "name": "max_phase",
7169 + "type": "text",
7170 + "primaryKey": false,
7171 + "notNull": false
7172 + },
7173 + "active_trials": {
7174 + "name": "active_trials",
7175 + "type": "integer",
7176 + "primaryKey": false,
7177 + "notNull": true,
7178 + "default": 0
7179 + },
7180 + "recruiting_trials": {
7181 + "name": "recruiting_trials",
7182 + "type": "integer",
7183 + "primaryKey": false,
7184 + "notNull": true,
7185 + "default": 0
7186 + },
7187 + "phase3_trials": {
7188 + "name": "phase3_trials",
7189 + "type": "integer",
7190 + "primaryKey": false,
7191 + "notNull": true,
7192 + "default": 0
7193 + },
7194 + "total_trials": {
7195 + "name": "total_trials",
7196 + "type": "integer",
7197 + "primaryKey": false,
7198 + "notNull": true,
7199 + "default": 0
7200 + },
7201 + "approvals": {
7202 + "name": "approvals",
7203 + "type": "integer",
7204 + "primaryKey": false,
7205 + "notNull": true,
7206 + "default": 0
7207 + },
7208 + "jurisdictions": {
7209 + "name": "jurisdictions",
7210 + "type": "text[]",
7211 + "primaryKey": false,
7212 + "notNull": true,
7213 + "default": "'{}'"
7214 + },
7215 + "first_approval_date": {
7216 + "name": "first_approval_date",
7217 + "type": "text",
7218 + "primaryKey": false,
7219 + "notNull": false
7220 + },
7221 + "latest_approval_date": {
7222 + "name": "latest_approval_date",
7223 + "type": "text",
7224 + "primaryKey": false,
7225 + "notNull": false
7226 + },
7227 + "first_trial_date": {
7228 + "name": "first_trial_date",
7229 + "type": "text",
7230 + "primaryKey": false,
7231 + "notNull": false
7232 + },
7233 + "formula_version": {
7234 + "name": "formula_version",
7235 + "type": "text",
7236 + "primaryKey": false,
7237 + "notNull": true
7238 + },
7239 + "inputs": {
7240 + "name": "inputs",
7241 + "type": "jsonb",
7242 + "primaryKey": false,
7243 + "notNull": true,
7244 + "default": "'{}'::jsonb"
7245 + },
7246 + "updated_at": {
7247 + "name": "updated_at",
7248 + "type": "timestamp with time zone",
7249 + "primaryKey": false,
7250 + "notNull": true,
7251 + "default": "now()"
7252 + }
7253 + },
7254 + "indexes": {
7255 + "drug_pipeline_uq": {
7256 + "name": "drug_pipeline_uq",
7257 + "columns": [
7258 + {
7259 + "expression": "drug_id",
7260 + "isExpression": false,
7261 + "asc": true,
7262 + "nulls": "last"
7263 + },
7264 + {
7265 + "expression": "cancer_id",
7266 + "isExpression": false,
7267 + "asc": true,
7268 + "nulls": "last"
7269 + }
7270 + ],
7271 + "isUnique": true,
7272 + "concurrently": false,
7273 + "method": "btree",
7274 + "with": {}
7275 + },
7276 + "drug_pipeline_stage_idx": {
7277 + "name": "drug_pipeline_stage_idx",
7278 + "columns": [
7279 + {
7280 + "expression": "stage",
7281 + "isExpression": false,
7282 + "asc": true,
7283 + "nulls": "last"
7284 + }
7285 + ],
7286 + "isUnique": false,
7287 + "concurrently": false,
7288 + "method": "btree",
7289 + "with": {}
7290 + },
7291 + "drug_pipeline_cancer_idx": {
7292 + "name": "drug_pipeline_cancer_idx",
7293 + "columns": [
7294 + {
7295 + "expression": "cancer_id",
7296 + "isExpression": false,
7297 + "asc": true,
7298 + "nulls": "last"
7299 + },
7300 + {
7301 + "expression": "stage",
7302 + "isExpression": false,
7303 + "asc": true,
7304 + "nulls": "last"
7305 + }
7306 + ],
7307 + "isUnique": false,
7308 + "concurrently": false,
7309 + "method": "btree",
7310 + "with": {}
7311 + }
7312 + },
7313 + "foreignKeys": {},
7314 + "compositePrimaryKeys": {},
7315 + "uniqueConstraints": {},
7316 + "policies": {},
7317 + "checkConstraints": {},
7318 + "isRLSEnabled": false
7319 + },
7320 + "public.research_gap_components": {
7321 + "name": "research_gap_components",
7322 + "schema": "",
7323 + "columns": {
7324 + "id": {
7325 + "name": "id",
7326 + "type": "bigserial",
7327 + "primaryKey": true,
7328 + "notNull": true
7329 + },
7330 + "cancer_id": {
7331 + "name": "cancer_id",
7332 + "type": "varchar(32)",
7333 + "primaryKey": false,
7334 + "notNull": true
7335 + },
7336 + "geography": {
7337 + "name": "geography",
7338 + "type": "text",
7339 + "primaryKey": false,
7340 + "notNull": true
7341 + },
7342 + "year": {
7343 + "name": "year",
7344 + "type": "integer",
7345 + "primaryKey": false,
7346 + "notNull": true
7347 + },
7348 + "sex": {
7349 + "name": "sex",
7350 + "type": "text",
7351 + "primaryKey": false,
7352 + "notNull": true,
7353 + "default": "'all'"
7354 + },
7355 + "burden_source_id": {
7356 + "name": "burden_source_id",
7357 + "type": "varchar(32)",
7358 + "primaryKey": false,
7359 + "notNull": true
7360 + },
7361 + "deaths": {
7362 + "name": "deaths",
7363 + "type": "double precision",
7364 + "primaryKey": false,
7365 + "notNull": false
7366 + },
7367 + "incidence": {
7368 + "name": "incidence",
7369 + "type": "double precision",
7370 + "primaryKey": false,
7371 + "notNull": false
7372 + },
7373 + "active_trials": {
7374 + "name": "active_trials",
7375 + "type": "integer",
7376 + "primaryKey": false,
7377 + "notNull": true,
7378 + "default": 0
7379 + },
7380 + "phase3_trials": {
7381 + "name": "phase3_trials",
7382 + "type": "integer",
7383 + "primaryKey": false,
7384 + "notNull": true,
7385 + "default": 0
7386 + },
7387 + "publications_5y": {
7388 + "name": "publications_5y",
7389 + "type": "integer",
7390 + "primaryKey": false,
7391 + "notNull": true,
7392 + "default": 0
7393 + },
7394 + "approved_drugs": {
7395 + "name": "approved_drugs",
7396 + "type": "integer",
7397 + "primaryKey": false,
7398 + "notNull": true,
7399 + "default": 0
7400 + },
7401 + "death_share": {
7402 + "name": "death_share",
7403 + "type": "real",
7404 + "primaryKey": false,
7405 + "notNull": false
7406 + },
7407 + "trial_share": {
7408 + "name": "trial_share",
7409 + "type": "real",
7410 + "primaryKey": false,
7411 + "notNull": false
7412 + },
7413 + "publication_share": {
7414 + "name": "publication_share",
7415 + "type": "real",
7416 + "primaryKey": false,
7417 + "notNull": false
7418 + },
7419 + "trial_gap_ratio": {
7420 + "name": "trial_gap_ratio",
7421 + "type": "real",
7422 + "primaryKey": false,
7423 + "notNull": false
7424 + },
7425 + "research_gap_ratio": {
7426 + "name": "research_gap_ratio",
7427 + "type": "real",
7428 + "primaryKey": false,
7429 + "notNull": false
7430 + },
7431 + "trials_per_1000_deaths": {
7432 + "name": "trials_per_1000_deaths",
7433 + "type": "real",
7434 + "primaryKey": false,
7435 + "notNull": false
7436 + },
7437 + "publications_per_1000_deaths": {
7438 + "name": "publications_per_1000_deaths",
7439 + "type": "real",
7440 + "primaryKey": false,
7441 + "notNull": false
7442 + },
7443 + "eligible": {
7444 + "name": "eligible",
7445 + "type": "boolean",
7446 + "primaryKey": false,
7447 + "notNull": true,
7448 + "default": true
7449 + },
7450 + "ineligible_reason": {
7451 + "name": "ineligible_reason",
7452 + "type": "text",
7453 + "primaryKey": false,
7454 + "notNull": false
7455 + },
7456 + "formula_version": {
7457 + "name": "formula_version",
7458 + "type": "text",
7459 + "primaryKey": false,
7460 + "notNull": true
7461 + },
7462 + "inputs": {
7463 + "name": "inputs",
7464 + "type": "jsonb",
7465 + "primaryKey": false,
7466 + "notNull": true,
7467 + "default": "'{}'::jsonb"
7468 + },
7469 + "updated_at": {
7470 + "name": "updated_at",
7471 + "type": "timestamp with time zone",
7472 + "primaryKey": false,
7473 + "notNull": true,
7474 + "default": "now()"
7475 + }
7476 + },
7477 + "indexes": {
7478 + "research_gap_components_uq": {
7479 + "name": "research_gap_components_uq",
7480 + "columns": [
7481 + {
7482 + "expression": "cancer_id",
7483 + "isExpression": false,
7484 + "asc": true,
7485 + "nulls": "last"
7486 + },
7487 + {
7488 + "expression": "geography",
7489 + "isExpression": false,
7490 + "asc": true,
7491 + "nulls": "last"
7492 + },
7493 + {
7494 + "expression": "year",
7495 + "isExpression": false,
7496 + "asc": true,
7497 + "nulls": "last"
7498 + },
7499 + {
7500 + "expression": "sex",
7501 + "isExpression": false,
7502 + "asc": true,
7503 + "nulls": "last"
7504 + },
7505 + {
7506 + "expression": "burden_source_id",
7507 + "isExpression": false,
7508 + "asc": true,
7509 + "nulls": "last"
7510 + }
7511 + ],
7512 + "isUnique": true,
7513 + "concurrently": false,
7514 + "method": "btree",
7515 + "with": {}
7516 + },
7517 + "research_gap_scope_idx": {
7518 + "name": "research_gap_scope_idx",
7519 + "columns": [
7520 + {
7521 + "expression": "geography",
7522 + "isExpression": false,
7523 + "asc": true,
7524 + "nulls": "last"
7525 + },
7526 + {
7527 + "expression": "year",
7528 + "isExpression": false,
7529 + "asc": true,
7530 + "nulls": "last"
7531 + },
7532 + {
7533 + "expression": "sex",
7534 + "isExpression": false,
7535 + "asc": true,
7536 + "nulls": "last"
7537 + }
7538 + ],
7539 + "isUnique": false,
7540 + "concurrently": false,
7541 + "method": "btree",
7542 + "with": {}
7543 + }
7544 + },
7545 + "foreignKeys": {},
7546 + "compositePrimaryKeys": {},
7547 + "uniqueConstraints": {},
7548 + "policies": {},
7549 + "checkConstraints": {},
7550 + "isRLSEnabled": false
7551 + },
7552 + "public.trial_intelligence": {
7553 + "name": "trial_intelligence",
7554 + "schema": "",
7555 + "columns": {
7556 + "id": {
7557 + "name": "id",
7558 + "type": "bigserial",
7559 + "primaryKey": true,
7560 + "notNull": true
7561 + },
7562 + "cancer_id": {
7563 + "name": "cancer_id",
7564 + "type": "varchar(32)",
7565 + "primaryKey": false,
7566 + "notNull": true
7567 + },
7568 + "entity_level": {
7569 + "name": "entity_level",
7570 + "type": "text",
7571 + "primaryKey": false,
7572 + "notNull": true,
7573 + "default": "'all'"
7574 + },
7575 + "total_trials": {
7576 + "name": "total_trials",
7577 + "type": "integer",
7578 + "primaryKey": false,
7579 + "notNull": true,
7580 + "default": 0
7581 + },
7582 + "active_trials": {
7583 + "name": "active_trials",
7584 + "type": "integer",
7585 + "primaryKey": false,
7586 + "notNull": true,
7587 + "default": 0
7588 + },
7589 + "recruiting_trials": {
7590 + "name": "recruiting_trials",
7591 + "type": "integer",
7592 + "primaryKey": false,
7593 + "notNull": true,
7594 + "default": 0
7595 + },
7596 + "phase1_active": {
7597 + "name": "phase1_active",
7598 + "type": "integer",
7599 + "primaryKey": false,
7600 + "notNull": true,
7601 + "default": 0
7602 + },
7603 + "phase2_active": {
7604 + "name": "phase2_active",
7605 + "type": "integer",
7606 + "primaryKey": false,
7607 + "notNull": true,
7608 + "default": 0
7609 + },
7610 + "phase3_active": {
7611 + "name": "phase3_active",
7612 + "type": "integer",
7613 + "primaryKey": false,
7614 + "notNull": true,
7615 + "default": 0
7616 + },
7617 + "phase3_recruiting": {
7618 + "name": "phase3_recruiting",
7619 + "type": "integer",
7620 + "primaryKey": false,
7621 + "notNull": true,
7622 + "default": 0
7623 + },
7624 + "phase4_active": {
7625 + "name": "phase4_active",
7626 + "type": "integer",
7627 + "primaryKey": false,
7628 + "notNull": true,
7629 + "default": 0
7630 + },
7631 + "completed_trials": {
7632 + "name": "completed_trials",
7633 + "type": "integer",
7634 + "primaryKey": false,
7635 + "notNull": true,
7636 + "default": 0
7637 + },
7638 + "terminated_trials": {
7639 + "name": "terminated_trials",
7640 + "type": "integer",
7641 + "primaryKey": false,
7642 + "notNull": true,
7643 + "default": 0
7644 + },
7645 + "withdrawn_trials": {
7646 + "name": "withdrawn_trials",
7647 + "type": "integer",
7648 + "primaryKey": false,
7649 + "notNull": true,
7650 + "default": 0
7651 + },
7652 + "suspended_trials": {
7653 + "name": "suspended_trials",
7654 + "type": "integer",
7655 + "primaryKey": false,
7656 + "notNull": true,
7657 + "default": 0
7658 + },
7659 + "with_results": {
7660 + "name": "with_results",
7661 + "type": "integer",
7662 + "primaryKey": false,
7663 + "notNull": true,
7664 + "default": 0
7665 + },
7666 + "new_trials_12m": {
7667 + "name": "new_trials_12m",
7668 + "type": "integer",
7669 + "primaryKey": false,
7670 + "notNull": true,
7671 + "default": 0
7672 + },
7673 + "new_trials_prior_12m": {
7674 + "name": "new_trials_prior_12m",
7675 + "type": "integer",
7676 + "primaryKey": false,
7677 + "notNull": true,
7678 + "default": 0
7679 + },
7680 + "trial_growth_yoy": {
7681 + "name": "trial_growth_yoy",
7682 + "type": "real",
7683 + "primaryKey": false,
7684 + "notNull": false
7685 + },
7686 + "avg_enrollment": {
7687 + "name": "avg_enrollment",
7688 + "type": "real",
7689 + "primaryKey": false,
7690 + "notNull": false
7691 + },
7692 + "median_enrollment": {
7693 + "name": "median_enrollment",
7694 + "type": "real",
7695 + "primaryKey": false,
7696 + "notNull": false
7697 + },
7698 + "total_enrollment_active": {
7699 + "name": "total_enrollment_active",
7700 + "type": "integer",
7701 + "primaryKey": false,
7702 + "notNull": false
7703 + },
7704 + "distinct_sponsors": {
7705 + "name": "distinct_sponsors",
7706 + "type": "integer",
7707 + "primaryKey": false,
7708 + "notNull": true,
7709 + "default": 0
7710 + },
7711 + "industry_share": {
7712 + "name": "industry_share",
7713 + "type": "real",
7714 + "primaryKey": false,
7715 + "notNull": false
7716 + },
7717 + "sponsor_hhi": {
7718 + "name": "sponsor_hhi",
7719 + "type": "real",
7720 + "primaryKey": false,
7721 + "notNull": false
7722 + },
7723 + "top_sponsor": {
7724 + "name": "top_sponsor",
7725 + "type": "text",
7726 + "primaryKey": false,
7727 + "notNull": false
7728 + },
7729 + "top_sponsor_share": {
7730 + "name": "top_sponsor_share",
7731 + "type": "real",
7732 + "primaryKey": false,
7733 + "notNull": false
7734 + },
7735 + "distinct_countries": {
7736 + "name": "distinct_countries",
7737 + "type": "integer",
7738 + "primaryKey": false,
7739 + "notNull": true,
7740 + "default": 0
7741 + },
7742 + "us_share": {
7743 + "name": "us_share",
7744 + "type": "real",
7745 + "primaryKey": false,
7746 + "notNull": false
7747 + },
7748 + "top_country": {
7749 + "name": "top_country",
7750 + "type": "text",
7751 + "primaryKey": false,
7752 + "notNull": false
7753 + },
7754 + "top_country_share": {
7755 + "name": "top_country_share",
7756 + "type": "real",
7757 + "primaryKey": false,
7758 + "notNull": false
7759 + },
7760 + "country_hhi": {
7761 + "name": "country_hhi",
7762 + "type": "real",
7763 + "primaryKey": false,
7764 + "notNull": false
7765 + },
7766 + "termination_share": {
7767 + "name": "termination_share",
7768 + "type": "real",
7769 + "primaryKey": false,
7770 + "notNull": false
7771 + },
7772 + "why_stopped_breakdown": {
7773 + "name": "why_stopped_breakdown",
7774 + "type": "jsonb",
7775 + "primaryKey": false,
7776 + "notNull": true,
7777 + "default": "'{}'::jsonb"
7778 + },
7779 + "trials_per_1000_deaths": {
7780 + "name": "trials_per_1000_deaths",
7781 + "type": "real",
7782 + "primaryKey": false,
7783 + "notNull": false
7784 + },
7785 + "trials_per_100k_cases": {
7786 + "name": "trials_per_100k_cases",
7787 + "type": "real",
7788 + "primaryKey": false,
7789 + "notNull": false
7790 + },
7791 + "burden_geography": {
7792 + "name": "burden_geography",
7793 + "type": "text",
7794 + "primaryKey": false,
7795 + "notNull": false
7796 + },
7797 + "burden_year": {
7798 + "name": "burden_year",
7799 + "type": "integer",
7800 + "primaryKey": false,
7801 + "notNull": false
7802 + },
7803 + "burden_source_id": {
7804 + "name": "burden_source_id",
7805 + "type": "varchar(32)",
7806 + "primaryKey": false,
7807 + "notNull": false
7808 + },
7809 + "formula_version": {
7810 + "name": "formula_version",
7811 + "type": "text",
7812 + "primaryKey": false,
7813 + "notNull": true
7814 + },
7815 + "inputs": {
7816 + "name": "inputs",
7817 + "type": "jsonb",
7818 + "primaryKey": false,
7819 + "notNull": true,
7820 + "default": "'{}'::jsonb"
7821 + },
7822 + "updated_at": {
7823 + "name": "updated_at",
7824 + "type": "timestamp with time zone",
7825 + "primaryKey": false,
7826 + "notNull": true,
7827 + "default": "now()"
7828 + }
7829 + },
7830 + "indexes": {
7831 + "trial_intelligence_uq": {
7832 + "name": "trial_intelligence_uq",
7833 + "columns": [
7834 + {
7835 + "expression": "cancer_id",
7836 + "isExpression": false,
7837 + "asc": true,
7838 + "nulls": "last"
7839 + },
7840 + {
7841 + "expression": "entity_level",
7842 + "isExpression": false,
7843 + "asc": true,
7844 + "nulls": "last"
7845 + }
7846 + ],
7847 + "isUnique": true,
7848 + "concurrently": false,
7849 + "method": "btree",
7850 + "with": {}
7851 + },
7852 + "trial_intelligence_active_idx": {
7853 + "name": "trial_intelligence_active_idx",
7854 + "columns": [
7855 + {
7856 + "expression": "entity_level",
7857 + "isExpression": false,
7858 + "asc": true,
7859 + "nulls": "last"
7860 + },
7861 + {
7862 + "expression": "active_trials",
7863 + "isExpression": false,
7864 + "asc": true,
7865 + "nulls": "last"
7866 + }
7867 + ],
7868 + "isUnique": false,
7869 + "concurrently": false,
7870 + "method": "btree",
7871 + "with": {}
7872 + }
7873 + },
7874 + "foreignKeys": {},
7875 + "compositePrimaryKeys": {},
7876 + "uniqueConstraints": {},
7877 + "policies": {},
7878 + "checkConstraints": {},
7879 + "isRLSEnabled": false
7880 + },
7881 + "public.trial_site_country_counts": {
7882 + "name": "trial_site_country_counts",
7883 + "schema": "",
7884 + "columns": {
7885 + "id": {
7886 + "name": "id",
7887 + "type": "bigserial",
7888 + "primaryKey": true,
7889 + "notNull": true
7890 + },
7891 + "cancer_id": {
7892 + "name": "cancer_id",
7893 + "type": "varchar(32)",
7894 + "primaryKey": false,
7895 + "notNull": false
7896 + },
7897 + "phase": {
7898 + "name": "phase",
7899 + "type": "text",
7900 + "primaryKey": false,
7901 + "notNull": false
7902 + },
7903 + "recruiting_only": {
7904 + "name": "recruiting_only",
7905 + "type": "boolean",
7906 + "primaryKey": false,
7907 + "notNull": true,
7908 + "default": false
7909 + },
7910 + "country": {
7911 + "name": "country",
7912 + "type": "text",
7913 + "primaryKey": false,
7914 + "notNull": true
7915 + },
7916 + "iso3": {
7917 + "name": "iso3",
7918 + "type": "text",
7919 + "primaryKey": false,
7920 + "notNull": false
7921 + },
7922 + "sites": {
7923 + "name": "sites",
7924 + "type": "integer",
7925 + "primaryKey": false,
7926 + "notNull": true
7927 + },
7928 + "trials": {
7929 + "name": "trials",
7930 + "type": "integer",
7931 + "primaryKey": false,
7932 + "notNull": true
7933 + },
7934 + "formula_version": {
7935 + "name": "formula_version",
7936 + "type": "text",
7937 + "primaryKey": false,
7938 + "notNull": true
7939 + },
7940 + "updated_at": {
7941 + "name": "updated_at",
7942 + "type": "timestamp with time zone",
7943 + "primaryKey": false,
7944 + "notNull": true,
7945 + "default": "now()"
7946 + }
7947 + },
7948 + "indexes": {
7949 + "trial_site_country_uq": {
7950 + "name": "trial_site_country_uq",
7951 + "columns": [
7952 + {
7953 + "expression": "cancer_id",
7954 + "isExpression": false,
7955 + "asc": true,
7956 + "nulls": "last"
7957 + },
7958 + {
7959 + "expression": "phase",
7960 + "isExpression": false,
7961 + "asc": true,
7962 + "nulls": "last"
7963 + },
7964 + {
7965 + "expression": "recruiting_only",
7966 + "isExpression": false,
7967 + "asc": true,
7968 + "nulls": "last"
7969 + },
7970 + {
7971 + "expression": "country",
7972 + "isExpression": false,
7973 + "asc": true,
7974 + "nulls": "last"
7975 + }
7976 + ],
7977 + "isUnique": true,
7978 + "concurrently": false,
7979 + "method": "btree",
7980 + "with": {}
7981 + },
7982 + "trial_site_country_lookup_idx": {
7983 + "name": "trial_site_country_lookup_idx",
7984 + "columns": [
7985 + {
7986 + "expression": "cancer_id",
7987 + "isExpression": false,
7988 + "asc": true,
7989 + "nulls": "last"
7990 + },
7991 + {
7992 + "expression": "phase",
7993 + "isExpression": false,
7994 + "asc": true,
7995 + "nulls": "last"
7996 + },
7997 + {
7998 + "expression": "recruiting_only",
7999 + "isExpression": false,
8000 + "asc": true,
8001 + "nulls": "last"
8002 + }
8003 + ],
8004 + "isUnique": false,
8005 + "concurrently": false,
8006 + "method": "btree",
8007 + "with": {}
8008 + }
8009 + },
8010 + "foreignKeys": {},
8011 + "compositePrimaryKeys": {},
8012 + "uniqueConstraints": {},
8013 + "policies": {},
8014 + "checkConstraints": {},
8015 + "isRLSEnabled": false
8016 + }
8017 + },
8018 + "enums": {},
8019 + "schemas": {},
8020 + "sequences": {},
8021 + "roles": {},
8022 + "policies": {},
8023 + "views": {},
8024 + "_meta": {
8025 + "columns": {},
8026 + "schemas": {},
8027 + "tables": {}
8028 + }
8029 +}
\ No newline at end of file
modified packages/database/migrations/meta/_journal.json +7 −0
@@ -15,6 +15,13 @@
15 15 "when": 1788872445984,
16 16 "tag": "0001_jazzy_arclight",
17 17 "breakpoints": true
18 + },
19 + {
20 + "idx": 2,
21 + "version": "7",
22 + "when": 1789100478898,
23 + "tag": "0002_dizzy_pete_wisdom",
24 + "breakpoints": true
18 25 }
19 26 ]
20 27 }
\ No newline at end of file
modified packages/database/src/schema/index.ts +1 −0
@@ -8,3 +8,4 @@ export * from './evidence.js';
8 8 export * from './epidemiology.js';
9 9 export * from './rankings.js';
10 10 export * from './ext-ops.js';
11 +export * from './intelligence.js';
added packages/database/src/schema/intelligence.ts +164 −0
@@ -0,0 +1,164 @@
1 +import { pgTable, text, integer, bigserial, index, uniqueIndex, real, jsonb, doublePrecision, boolean } from 'drizzle-orm/pg-core';
2 +import { ciId, updatedAt } from './_common.js';
3 +
4 +/**
5 + * Derived layer — "intelligence" tables (SPEC §10, §15, §33-34, §115). Every row is recomputed
6 + * deterministically from canonical relations, carries a `formula_version` and keeps its inputs so a
7 + * number can be traced ("Why 542 active trials?"). Nothing here is an observation: the claim
8 + * category of every value is `computed_metric`.
9 + */
10 +
11 +/** Per-cancer clinical-trial intelligence (SPEC §10): counts, growth, sponsor & geographic concentration, failures. */
12 +export const trialIntelligence = pgTable(
13 + 'trial_intelligence',
14 + {
15 + id: bigserial('id', { mode: 'number' }).primaryKey(),
16 + cancerId: ciId('cancer_id').notNull(),
17 + /** top = mutually exclusive registry set (§246-247); all = every active malignant entity. */
18 + entityLevel: text('entity_level').notNull().default('all'),
19 + // --- counts (interventional studies over the entity and its descendants) ---
20 + totalTrials: integer('total_trials').notNull().default(0),
21 + activeTrials: integer('active_trials').notNull().default(0),
22 + recruitingTrials: integer('recruiting_trials').notNull().default(0),
23 + phase1Active: integer('phase1_active').notNull().default(0),
24 + phase2Active: integer('phase2_active').notNull().default(0),
25 + phase3Active: integer('phase3_active').notNull().default(0),
26 + phase3Recruiting: integer('phase3_recruiting').notNull().default(0),
27 + phase4Active: integer('phase4_active').notNull().default(0),
28 + completedTrials: integer('completed_trials').notNull().default(0),
29 + terminatedTrials: integer('terminated_trials').notNull().default(0),
30 + withdrawnTrials: integer('withdrawn_trials').notNull().default(0),
31 + suspendedTrials: integer('suspended_trials').notNull().default(0),
32 + withResults: integer('with_results').notNull().default(0),
33 + // --- growth (registration date = first_posted_date) ---
34 + newTrials12m: integer('new_trials_12m').notNull().default(0),
35 + newTrialsPrior12m: integer('new_trials_prior_12m').notNull().default(0),
36 + trialGrowthYoy: real('trial_growth_yoy'), // (new_12m − prior_12m) / prior_12m; null when prior < threshold
37 + // --- enrollment ---
38 + avgEnrollment: real('avg_enrollment'),
39 + medianEnrollment: real('median_enrollment'),
40 + totalEnrollmentActive: integer('total_enrollment_active'),
41 + // --- sponsors ---
42 + distinctSponsors: integer('distinct_sponsors').notNull().default(0),
43 + industryShare: real('industry_share'), // share of active trials with lead_sponsor_class = INDUSTRY
44 + sponsorHhi: real('sponsor_hhi'), // Herfindahl–Hirschman index of lead sponsors over active trials (0..1)
45 + topSponsor: text('top_sponsor'),
46 + topSponsorShare: real('top_sponsor_share'),
47 + // --- geography ---
48 + distinctCountries: integer('distinct_countries').notNull().default(0),
49 + usShare: real('us_share'), // share of active trials with ≥ 1 US site
50 + topCountry: text('top_country'),
51 + topCountryShare: real('top_country_share'),
52 + countryHhi: real('country_hhi'),
53 + // --- failures ---
54 + terminationShare: real('termination_share'), // (terminated + withdrawn) / (completed + terminated + withdrawn), studies first posted ≥ 2010
55 + whyStoppedBreakdown: jsonb('why_stopped_breakdown').$type<Record<string, number>>().notNull().default({}),
56 + // --- burden-normalized (US, latest year with both counts) ---
57 + trialsPer1000Deaths: real('trials_per_1000_deaths'),
58 + trialsPer100kCases: real('trials_per_100k_cases'),
59 + burdenGeography: text('burden_geography'),
60 + burdenYear: integer('burden_year'),
61 + burdenSourceId: ciId('burden_source_id'),
62 + formulaVersion: text('formula_version').notNull(),
63 + inputs: jsonb('inputs').$type<Record<string, unknown>>().notNull().default({}),
64 + computedAt: updatedAt(),
65 + },
66 + (t) => [uniqueIndex('trial_intelligence_uq').on(t.cancerId, t.entityLevel), index('trial_intelligence_active_idx').on(t.entityLevel, t.activeTrials)],
67 +);
68 +
69 +/**
70 + * Country-level trial site aggregates for the trial map (SPEC §11). `cancer_id` null = all oncology
71 + * trials; otherwise a top-level cancer (descendants included). `phase` null = any phase.
72 + */
73 +export const trialSiteCountryCounts = pgTable(
74 + 'trial_site_country_counts',
75 + {
76 + id: bigserial('id', { mode: 'number' }).primaryKey(),
77 + cancerId: ciId('cancer_id'),
78 + phase: text('phase'),
79 + recruitingOnly: boolean('recruiting_only').notNull().default(false),
80 + country: text('country').notNull(),
81 + iso3: text('iso3'),
82 + sites: integer('sites').notNull(),
83 + trials: integer('trials').notNull(),
84 + formulaVersion: text('formula_version').notNull(),
85 + computedAt: updatedAt(),
86 + },
87 + (t) => [uniqueIndex('trial_site_country_uq').on(t.cancerId, t.phase, t.recruitingOnly, t.country), index('trial_site_country_lookup_idx').on(t.cancerId, t.phase, t.recruitingOnly)],
88 +);
89 +
90 +/**
91 + * Drug development pipeline (SPEC §15, §114, §119): per drug (and optionally per cancer) the highest
92 + * development stage supported by registered trials and jurisdiction-aware approvals.
93 + */
94 +export const drugPipeline = pgTable(
95 + 'drug_pipeline',
96 + {
97 + id: bigserial('id', { mode: 'number' }).primaryKey(),
98 + drugId: ciId('drug_id').notNull(),
99 + cancerId: ciId('cancer_id'), // null = across all cancers
100 + /** preclinical | phase1 | phase2 | phase3 | phase4 | approved | withdrawn */
101 + stage: text('stage').notNull(),
102 + maxPhase: text('max_phase'), // highest phase among interventional trials (PHASE1..PHASE4)
103 + activeTrials: integer('active_trials').notNull().default(0),
104 + recruitingTrials: integer('recruiting_trials').notNull().default(0),
105 + phase3Trials: integer('phase3_trials').notNull().default(0),
106 + totalTrials: integer('total_trials').notNull().default(0),
107 + approvals: integer('approvals').notNull().default(0),
108 + jurisdictions: text('jurisdictions').array().notNull().default([]),
109 + firstApprovalDate: text('first_approval_date'),
110 + latestApprovalDate: text('latest_approval_date'),
111 + firstTrialDate: text('first_trial_date'),
112 + formulaVersion: text('formula_version').notNull(),
113 + inputs: jsonb('inputs').$type<Record<string, unknown>>().notNull().default({}),
114 + computedAt: updatedAt(),
115 + },
116 + (t) => [uniqueIndex('drug_pipeline_uq').on(t.drugId, t.cancerId), index('drug_pipeline_stage_idx').on(t.stage), index('drug_pipeline_cancer_idx').on(t.cancerId, t.stage)],
117 +);
118 +
119 +/** Cross-reference codes for drugs (CLAUDE.md §347): ATC, UNII, RxCUI, DIN, ChEMBL… searchable, never buried in JSON. */
120 +export const drugCodes = pgTable(
121 + 'drug_codes',
122 + {
123 + id: bigserial('id', { mode: 'number' }).primaryKey(),
124 + drugId: ciId('drug_id').notNull(),
125 + system: text('system').notNull(), // atc | unii | rxcui | din | chembl | drugbank | pubchem_cid | ncit | civic_therapy | hc_drug_code | ema_product | mhra | tga
126 + code: text('code').notNull(),
127 + label: text('label'), // e.g. ATC class name, brand for a DIN
128 + matchType: text('match_type').notNull().default('EXACT_IDENTIFIER'),
129 + sourceId: ciId('source_id'),
130 + },
131 + (t) => [uniqueIndex('drug_codes_uq').on(t.drugId, t.system, t.code), index('drug_codes_lookup_idx').on(t.system, t.code)],
132 +);
133 +
134 +/** Research-gap components per cancer and burden scope (SPEC §34, §113): shares and log-ratios with their inputs. */
135 +export const researchGapComponents = pgTable(
136 + 'research_gap_components',
137 + {
138 + id: bigserial('id', { mode: 'number' }).primaryKey(),
139 + cancerId: ciId('cancer_id').notNull(),
140 + geography: text('geography').notNull(), // ISO3 or WORLD
141 + year: integer('year').notNull(),
142 + sex: text('sex').notNull().default('all'),
143 + burdenSourceId: ciId('burden_source_id').notNull(),
144 + deaths: doublePrecision('deaths'),
145 + incidence: doublePrecision('incidence'),
146 + activeTrials: integer('active_trials').notNull().default(0),
147 + phase3Trials: integer('phase3_trials').notNull().default(0),
148 + publications5y: integer('publications_5y').notNull().default(0),
149 + approvedDrugs: integer('approved_drugs').notNull().default(0),
150 + deathShare: real('death_share'),
151 + trialShare: real('trial_share'),
152 + publicationShare: real('publication_share'),
153 + trialGapRatio: real('trial_gap_ratio'), // log2(deathShare / trialShare)
154 + researchGapRatio: real('research_gap_ratio'), // log2(deathShare / publicationShare)
155 + trialsPer1000Deaths: real('trials_per_1000_deaths'),
156 + publicationsPer1000Deaths: real('publications_per_1000_deaths'),
157 + eligible: boolean('eligible').notNull().default(true),
158 + ineligibleReason: text('ineligible_reason'),
159 + formulaVersion: text('formula_version').notNull(),
160 + inputs: jsonb('inputs').$type<Record<string, unknown>>().notNull().default({}),
161 + computedAt: updatedAt(),
162 + },
163 + (t) => [uniqueIndex('research_gap_components_uq').on(t.cancerId, t.geography, t.year, t.sex, t.burdenSourceId), index('research_gap_scope_idx').on(t.geography, t.year, t.sex)],
164 +);
modified packages/database/src/seed-data/metrics.ts +122 −0
@@ -282,4 +282,126 @@ export const METRIC_CATALOG: MetricSeed[] = [
282 282 eligibility: { requires: ['mortality_count', 'publications_5y'], entityLevel: 'top' },
283 283 experimental: false,
284 284 },
285 +
286 + // --- Clinical-trial intelligence (SPEC §10; computed in packages/ranking/src/trial-intelligence.ts) ---
287 + {
288 + slug: 'phase3_recruiting_trials',
289 + name: 'Recruiting Phase III trials',
290 + description: 'Interventional studies with PHASE3 among their phases and overall status RECRUITING, mapped to this cancer or its descendants.',
291 + formula: 'COUNT(DISTINCT trial) … overall_status = RECRUITING AND PHASE3 = ANY(phases) AND study_type = INTERVENTIONAL',
292 + formulaVersion: 'ci-phase3-recruiting-v1',
293 + unit: 'count',
294 + higherIsWorse: false,
295 + aggregation: 'descendants',
296 + validDimensions: ['entity_level'],
297 + sourceSlugs: ['clinicaltrials'],
298 + category: 'trials',
299 + eligibility: { entityLevel: 'any' },
300 + experimental: false,
301 + },
302 + {
303 + slug: 'trial_growth_yoy',
304 + name: 'Trial registration growth (year over year)',
305 + description: 'Relative change in the number of interventional studies first posted in the last 12 months versus the preceding 12 months, over the cancer and its descendants. Requires at least 20 studies in the prior window so small denominators do not produce spurious growth.',
306 + formula: '(new_trials_12m − new_trials_prior_12m) / new_trials_prior_12m (first_posted_date windows; interventional; descendants)',
307 + formulaVersion: 'ci-trial-growth-v1',
308 + unit: 'ratio',
309 + higherIsWorse: null,
310 + aggregation: 'descendants',
311 + validDimensions: ['entity_level'],
312 + sourceSlugs: ['clinicaltrials'],
313 + category: 'trend',
314 + eligibility: { entityLevel: 'any', minPriorTrials: 20 },
315 + experimental: false,
316 + },
317 + {
318 + slug: 'trial_termination_share',
319 + name: 'Trial termination share',
320 + description: 'Share of interventional studies first posted since 2010 that ended TERMINATED or WITHDRAWN among those that reached a terminal status (COMPLETED, TERMINATED, WITHDRAWN). Registrant-reported statuses; reasons are shown as posted and never inferred. Requires ≥ 30 terminal studies.',
321 + formula: '(terminated + withdrawn) / (completed + terminated + withdrawn) WHERE first_posted_date ≥ 2010-01-01 AND study_type = INTERVENTIONAL',
322 + formulaVersion: 'ci-trial-termination-v1',
323 + unit: 'ratio',
324 + higherIsWorse: true,
325 + aggregation: 'descendants',
326 + validDimensions: ['entity_level'],
327 + sourceSlugs: ['clinicaltrials'],
328 + category: 'trials',
329 + eligibility: { entityLevel: 'any', minTerminalTrials: 30 },
330 + experimental: false,
331 + },
332 + {
333 + slug: 'sponsor_concentration',
334 + name: 'Sponsor concentration (HHI)',
335 + description: 'Herfindahl–Hirschman index of lead sponsors over active interventional studies (sum of squared sponsor shares; 1 = a single sponsor). Requires ≥ 10 active studies.',
336 + formula: 'Σ (active_trials_by_lead_sponsor / active_trials)² over the cancer and its descendants',
337 + formulaVersion: 'ci-sponsor-hhi-v1',
338 + unit: 'index',
339 + higherIsWorse: null,
340 + aggregation: 'descendants',
341 + validDimensions: ['entity_level'],
342 + sourceSlugs: ['clinicaltrials'],
343 + category: 'trials',
344 + eligibility: { entityLevel: 'any', minActiveTrials: 10 },
345 + experimental: false,
346 + },
347 + {
348 + slug: 'trials_per_1000_deaths',
349 + name: 'Active trials per 1,000 annual deaths',
350 + description: 'Active interventional studies divided by annual deaths (thousands) in the same population scope. A burden-normalized measure of clinical-research intensity; it depends on the epidemiology source of the scope and on how registrants phrase conditions.',
351 + formula: 'active_trials / (mortality_count / 1000) (same geography, year, sex, source family; deaths ≥ 100)',
352 + formulaVersion: 'ci-trials-per-deaths-v1',
353 + unit: 'per_1000_deaths',
354 + higherIsWorse: false,
355 + aggregation: 'none',
356 + validDimensions: ['geography', 'year'],
357 + sourceSlugs: ['clinicaltrials', 'cdc-wonder', 'cdc-uscs', 'seer', 'iarc-globocan'],
358 + category: 'unmet_need',
359 + eligibility: { requires: ['mortality_count', 'active_trials'], minDeaths: 100, entityLevel: 'top' },
360 + experimental: false,
361 + },
362 + {
363 + slug: 'publications_per_1000_deaths',
364 + name: 'Publications (5 y) per 1,000 annual deaths',
365 + description: 'PubMed records over the last 5 years divided by annual deaths (thousands) in the same population scope. A burden-normalized measure of research output.',
366 + formula: 'publications_5y / (mortality_count / 1000) (same geography, year, sex, source family; deaths ≥ 100)',
367 + formulaVersion: 'ci-pubs-per-deaths-v1',
368 + unit: 'per_1000_deaths',
369 + higherIsWorse: false,
370 + aggregation: 'none',
371 + validDimensions: ['geography', 'year'],
372 + sourceSlugs: ['pubmed', 'cdc-wonder', 'cdc-uscs', 'seer', 'iarc-globocan'],
373 + category: 'unmet_need',
374 + eligibility: { requires: ['mortality_count', 'publications_5y'], minDeaths: 100, entityLevel: 'top' },
375 + experimental: false,
376 + },
377 + {
378 + slug: 'trial_gap_ratio',
379 + name: 'Trial Gap Ratio',
380 + description: 'log₂ of a cancer’s share of deaths divided by its share of active interventional trials, both computed over the eligible top-level cancers of the scope. 0 = trial share matches death share; +1 = twice as many deaths as trials would suggest; −1 = half. Scale-free, so it can be compared across scopes, unlike the percentile-based Trial Gap Index.',
381 + formula: 'log2( (deaths / Σ deaths) / (active_trials / Σ active_trials) ) over eligible top-level cancers (deaths ≥ 100, active_trials ≥ 1)',
382 + formulaVersion: 'ci-trial-gap-ratio-v1',
383 + unit: 'log2_ratio',
384 + higherIsWorse: true,
385 + aggregation: 'none',
386 + validDimensions: ['geography', 'year'],
387 + sourceSlugs: ['clinicaltrials', 'cdc-wonder', 'cdc-uscs', 'seer', 'iarc-globocan'],
388 + category: 'unmet_need',
389 + eligibility: { requires: ['mortality_count', 'active_trials'], minDeaths: 100, entityLevel: 'top' },
390 + experimental: false,
391 + },
392 + {
393 + slug: 'research_gap_ratio',
394 + name: 'Research Gap Ratio',
395 + description: 'log₂ of a cancer’s share of deaths divided by its share of publications (last 5 years), both over the eligible top-level cancers of the scope. 0 = literature share matches death share; positive values flag comparatively under-published cancers. Caveat: literature counts are query-based per entity and not aggregated over descendants.',
396 + formula: 'log2( (deaths / Σ deaths) / (publications_5y / Σ publications_5y) ) over eligible top-level cancers (deaths ≥ 100, publications_5y ≥ 1)',
397 + formulaVersion: 'ci-research-gap-ratio-v1',
398 + unit: 'log2_ratio',
399 + higherIsWorse: true,
400 + aggregation: 'none',
401 + validDimensions: ['geography', 'year'],
402 + sourceSlugs: ['pubmed', 'cdc-wonder', 'cdc-uscs', 'seer', 'iarc-globocan'],
403 + category: 'unmet_need',
404 + eligibility: { requires: ['mortality_count', 'publications_5y'], minDeaths: 100, entityLevel: 'top' },
405 + experimental: false,
406 + },
285 407 ];
added packages/ranking/src/drug-pipeline.ts +16 −0
@@ -0,0 +1,16 @@
1 +import type { Database } from '@cancerindex/database';
2 +
3 +export const DRUG_PIPELINE_FORMULA_VERSION = 'ci-drug-pipeline-v1';
4 +
5 +export interface DrugPipelineResult {
6 + rows: number;
7 +}
8 +
9 +/**
10 + * STUB — implemented by the Approvals & Pipeline work package.
11 + * Recomputes `drug_pipeline` (per drug, and per drug × cancer) from trial_interventions ×
12 + * trial_conditions × clinical_trials and drug_approvals.
13 + */
14 +export async function computeDrugPipeline(_db: Database): Promise<DrugPipelineResult> {
15 + return { rows: 0 };
16 +}
modified packages/ranking/src/engine.ts +1 −1
@@ -135,7 +135,7 @@ export async function computeAllRankings(db: Database): Promise<RankingResult[]>
135 135 return results;
136 136 }
137 137
138 −async function persistSnapshot(db: Database, def: typeof metricDefinitions.$inferSelect, scope: Scope, items: RankInput[], opts: { descending: boolean; sourceIds: string[] }): Promise<RankingResult> {
138 +export async function persistSnapshot(db: Database, def: typeof metricDefinitions.$inferSelect, scope: Scope, items: RankInput[], opts: { descending: boolean; sourceIds: string[] }): Promise<RankingResult> {
139 139 const key = scopeKey(scope);
140 140 const ranked = rankEntities(items, { descending: def.higherIsWorse === false ? opts.descending : opts.descending });
141 141 const hash = await inputsHash(items);
modified packages/ranking/src/index.ts +4 −0
@@ -2,3 +2,7 @@ export * from './rank.js';
2 2 export * from './counters.js';
3 3 export * from './engine.js';
4 4 export * from './trace.js';
5 +export * from './intelligence.js';
6 +export * from './trial-intelligence.js';
7 +export * from './drug-pipeline.js';
8 +export * from './research-gap.js';
added packages/ranking/src/intelligence.ts +48 −0
@@ -0,0 +1,48 @@
1 +import type { Database } from '@cancerindex/database';
2 +import { computeTrialIntelligence } from './trial-intelligence.js';
3 +import { computeDrugPipeline } from './drug-pipeline.js';
4 +import { computeResearchGap } from './research-gap.js';
5 +
6 +export interface IntelligenceResult {
7 + trialIntelligenceRows: number;
8 + trialSiteCountryRows: number;
9 + drugPipelineRows: number;
10 + researchGapRows: number;
11 + ms: number;
12 +}
13 +
14 +/**
15 + * Derived "intelligence" layer (SPEC §10-11, §15, §34): recomputed after counters, before rankings.
16 + * Each part is independent and deterministic; a failure in one part is reported, not hidden, and
17 + * does not prevent the others from running.
18 + */
19 +export async function computeIntelligence(db: Database, log: (msg: string, extra?: Record<string, unknown>) => void = () => {}): Promise<IntelligenceResult> {
20 + const t0 = Date.now();
21 + const out: IntelligenceResult = { trialIntelligenceRows: 0, trialSiteCountryRows: 0, drugPipelineRows: 0, researchGapRows: 0, ms: 0 };
22 + const errors: string[] = [];
23 + try {
24 + const r = await computeTrialIntelligence(db);
25 + out.trialIntelligenceRows = r.rows;
26 + out.trialSiteCountryRows = r.siteCountryRows;
27 + log('trial intelligence computed', { ...r });
28 + } catch (e) {
29 + errors.push(`trial-intelligence: ${(e as Error).message}`);
30 + }
31 + try {
32 + const r = await computeDrugPipeline(db);
33 + out.drugPipelineRows = r.rows;
34 + log('drug pipeline computed', { ...r });
35 + } catch (e) {
36 + errors.push(`drug-pipeline: ${(e as Error).message}`);
37 + }
38 + try {
39 + const r = await computeResearchGap(db);
40 + out.researchGapRows = r.rows;
41 + log('research gap components computed', { ...r });
42 + } catch (e) {
43 + errors.push(`research-gap: ${(e as Error).message}`);
44 + }
45 + out.ms = Date.now() - t0;
46 + if (errors.length) throw new Error(`intelligence partially failed: ${errors.join(' | ')}`);
47 + return out;
48 +}
added packages/ranking/src/research-gap.ts +18 −0
@@ -0,0 +1,18 @@
1 +import type { Database } from '@cancerindex/database';
2 +
3 +export const RESEARCH_GAP_FORMULA_VERSION = 'ci-research-gap-components-v1';
4 +
5 +export interface ResearchGapResult {
6 + rows: number;
7 + scopes: number;
8 +}
9 +
10 +/**
11 + * STUB — implemented by the Research Gap Index work package.
12 + * Recomputes `research_gap_components` per (cancer, geography, year, sex, burden source) and the
13 + * burden-normalized ranking snapshots (trials_per_1000_deaths, publications_per_1000_deaths,
14 + * trial_gap_ratio, research_gap_ratio).
15 + */
16 +export async function computeResearchGap(_db: Database): Promise<ResearchGapResult> {
17 + return { rows: 0, scopes: 0 };
18 +}
added packages/ranking/src/trial-intelligence.ts +17 −0
@@ -0,0 +1,17 @@
1 +import type { Database } from '@cancerindex/database';
2 +
3 +export const TRIAL_INTELLIGENCE_FORMULA_VERSION = 'ci-trial-intel-v1';
4 +export const TRIAL_SITE_COUNTRY_FORMULA_VERSION = 'ci-trial-sites-v1';
5 +
6 +export interface TrialIntelligenceResult {
7 + rows: number;
8 + siteCountryRows: number;
9 +}
10 +
11 +/**
12 + * STUB — implemented by the Clinical Trial Intelligence work package.
13 + * Recomputes `trial_intelligence` (per cancer × entity level) and `trial_site_country_counts`.
14 + */
15 +export async function computeTrialIntelligence(_db: Database): Promise<TrialIntelligenceResult> {
16 + return { rows: 0, siteCountryRows: 0 };
17 +}
modified scripts/ci.ts +13 −1
@@ -106,6 +106,18 @@ async function main() {
106 106 console.log(`[counters] refreshed ${n} entities`);
107 107 break;
108 108 }
109 + case 'intel': {
110 + const { computeIntelligence } = await import('@cancerindex/ranking');
111 + const r = await computeIntelligence(db, (m, extra) => console.log(`[intel] ${m}`, extra ?? ''));
112 + console.log(`[intel] trial_intelligence=${r.trialIntelligenceRows} site_countries=${r.trialSiteCountryRows} drug_pipeline=${r.drugPipelineRows} research_gap=${r.researchGapRows} (${r.ms} ms)`);
113 + break;
114 + }
115 + case 'reconcile-drugs': {
116 + const { reconcileInterventionDrugs } = await import('@cancerindex/connectors');
117 + const r = await reconcileInterventionDrugs(db, { remap: !!flags.remap });
118 + console.log('[reconcile-drugs]', r);
119 + break;
120 + }
109 121 case 'rank': {
110 122 const { computeAllRankings } = await import('@cancerindex/ranking');
111 123 const res = await computeAllRankings(db);
@@ -148,7 +160,7 @@ async function main() {
148 160 break;
149 161 }
150 162 default:
151 − console.log('usage: pnpm cix <connectors|run|run-all|health|sources:sync|counters|rank|stats|trace|doctor|alerts>');
163 + console.log('usage: pnpm cix <connectors|run|run-all|health|sources:sync|counters|intel|reconcile-drugs [--remap]|rank|stats|trace|doctor|alerts>');
152 164 }
153 165 } finally {
154 166 await closeDb();
modified workers/lib/env.ts +2 −0
@@ -27,6 +27,7 @@ export const JOBS = {
27 27 connectorRun: 'connector.run',
28 28 counters: 'maintenance.counters',
29 29 rank: 'maintenance.rank',
30 + intel: 'maintenance.intel',
30 31 healthProbe: 'health.probe',
31 32 } as const;
32 33 export type JobName = (typeof JOBS)[keyof typeof JOBS];
@@ -34,6 +35,7 @@ export type JobName = (typeof JOBS)[keyof typeof JOBS];
34 35 /** Daily maintenance (UTC): counters after the nightly connector windows, rankings after counters. */
35 36 export const SCHEDULES = {
36 37 counters: '0 6 * * *',
38 + intel: '15 6 * * *',
37 39 rank: '30 6 * * *',
38 40 healthProbe: '15 * * * *',
39 41 } as const;
modified workers/main.ts +20 −3
@@ -3,6 +3,7 @@
3 3 *
4 4 * connector.run {id, mode?, maxMinutes?, maxRecords?, resetCursor?} singleton per connector
5 5 * maintenance.counters {thenRank?} refreshCounters
6 + * maintenance.intel {thenRank?} computeIntelligence (trial intelligence, drug pipeline, research gap)
6 7 * maintenance.rank {} computeAllRankings
7 8 * health.probe {} healthCheck per connector → connector_cursors.health
8 9 *
@@ -15,7 +16,7 @@ import { sql } from 'drizzle-orm';
15 16 import { logger } from '@cancerindex/shared';
16 17 import { getDb, closeDb, raiseAlertSafe, resolveAlerts } from '@cancerindex/database';
17 18 import { ALERT_KINDS, CONNECTORS, getConnector, humanDuration, isStale, runConnector, RunContext, type RunMode } from '@cancerindex/connectors';
18 −import { refreshCounters, computeAllRankings } from '@cancerindex/ranking';
19 +import { refreshCounters, computeAllRankings, computeIntelligence } from '@cancerindex/ranking';
19 20
20 21 const log = logger.child({ component: 'worker' });
21 22 const db = getDb();
@@ -76,9 +77,10 @@ async function registerSchedules(): Promise<void> {
76 77 const skipped = CONNECTORS.filter((c) => !wanted.has(c.manifest.id)).map((c) => `${c.manifest.id}(${c.manifest.status}${c.manifest.schedule ? '' : ',no-schedule'})`);
77 78 if (skipped.length) log.info({ skipped }, 'connectors without schedule');
78 79 await boss.schedule(JOBS.counters, SCHEDULES.counters, { thenRank: false, requestedBy: 'schedule' }, { key: 'daily', singletonKey: 'counters', tz: 'UTC' });
80 + await boss.schedule(JOBS.intel, SCHEDULES.intel, { thenRank: false, requestedBy: 'schedule' }, { key: 'daily', singletonKey: 'intel', tz: 'UTC' });
79 81 await boss.schedule(JOBS.rank, SCHEDULES.rank, { requestedBy: 'schedule' }, { key: 'daily', singletonKey: 'rank', tz: 'UTC' });
80 82 await boss.schedule(JOBS.healthProbe, SCHEDULES.healthProbe, { requestedBy: 'schedule' }, { key: 'hourly', singletonKey: 'health', tz: 'UTC' });
81 − log.info({ counters: SCHEDULES.counters, rank: SCHEDULES.rank, health: SCHEDULES.healthProbe }, 'maintenance schedules registered (UTC)');
83 + log.info({ counters: SCHEDULES.counters, intel: SCHEDULES.intel, rank: SCHEDULES.rank, health: SCHEDULES.healthProbe }, 'maintenance schedules registered (UTC)');
82 84 }
83 85
84 86 async function handleConnectorRun([job]: Job<ConnectorRunData>[]): Promise<void> {
@@ -111,7 +113,20 @@ async function handleCounters([job]: Job<{ thenRank?: boolean; requestedBy?: str
111 113 const t0 = Date.now();
112 114 const n = await refreshCounters(db);
113 115 log.info({ entities: n, ms: Date.now() - t0, requestedBy: job!.data.requestedBy }, 'counters refreshed');
114 − if (job!.data.thenRank) await boss.send(JOBS.rank, { requestedBy: 'counters' }, { singletonKey: 'rank' });
116 + // Derived intelligence follows counters; rankings follow intelligence (chained by handleIntel).
117 + await boss.send(JOBS.intel, { thenRank: !!job!.data.thenRank, requestedBy: 'counters' }, { singletonKey: 'intel' });
118 +}
119 +
120 +async function handleIntel([job]: Job<{ thenRank?: boolean; requestedBy?: string }>[]): Promise<void> {
121 + try {
122 + const r = await computeIntelligence(db, (msg, extra) => log.info({ ...extra }, msg));
123 + log.info({ ...r, requestedBy: job!.data.requestedBy }, 'intelligence recomputed');
124 + } catch (err) {
125 + log.error({ err }, 'intelligence failed (partial results kept)');
126 + await raiseAlertSafe(db, { kind: 'intelligence_failure', severity: 'warn', message: `intelligence recompute failed: ${(err as Error).message.slice(0, 300)}` });
127 + } finally {
128 + if (job!.data.thenRank) await boss.send(JOBS.rank, { requestedBy: 'intel' }, { singletonKey: 'rank' });
129 + }
115 130 }
116 131
117 132 async function handleRank([job]: Job<{ requestedBy?: string }>[]): Promise<void> {
@@ -167,12 +182,14 @@ async function main(): Promise<void> {
167 182 await boss.start();
168 183 await ensureQueue(JOBS.connectorRun, (CI_MAX_RUN_MINUTES + 20) * 60);
169 184 await ensureQueue(JOBS.counters, 30 * 60);
185 + await ensureQueue(JOBS.intel, 60 * 60);
170 186 await ensureQueue(JOBS.rank, 60 * 60);
171 187 await ensureQueue(JOBS.healthProbe, 10 * 60);
172 188 await registerSchedules();
173 189
174 190 await boss.work<ConnectorRunData>(JOBS.connectorRun, { batchSize: 1, localConcurrency: WORKER_CONCURRENCY, pollingIntervalSeconds: 5 }, handleConnectorRun);
175 191 await boss.work(JOBS.counters, { batchSize: 1, pollingIntervalSeconds: 5 }, handleCounters);
192 + await boss.work(JOBS.intel, { batchSize: 1, pollingIntervalSeconds: 5 }, handleIntel);
176 193 await boss.work(JOBS.rank, { batchSize: 1, pollingIntervalSeconds: 5 }, handleRank);
177 194 await boss.work(JOBS.healthProbe, { batchSize: 1, pollingIntervalSeconds: 30 }, handleHealthProbe);
178 195 log.info({ concurrency: WORKER_CONCURRENCY, maxRunMinutes: CI_MAX_RUN_MINUTES, connectors: CONNECTORS.map((c) => c.manifest.id) }, 'worker ready');
179 196