@inflexa-ai/harness 0.30.2 → 0.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/contracts/target-dossier.d.ts +61 -61
- package/dist/execution/run-synthesis.js +7 -2
- package/dist/lib/zod-issues.d.ts +8 -0
- package/dist/lib/zod-issues.js +13 -0
- package/dist/literature/sources/semantic-scholar.d.ts +34 -0
- package/dist/literature/sources/semantic-scholar.js +15 -4
- package/dist/sandbox/cpu-files.d.ts +37 -0
- package/dist/sandbox/cpu-files.js +55 -0
- package/dist/sandbox/docker-client.d.ts +15 -0
- package/dist/sandbox/docker-client.js +100 -11
- package/dist/sandbox/k8s-client.d.ts +5 -0
- package/dist/sandbox/k8s-client.js +128 -19
- package/dist/sandbox/thread-env.d.ts +29 -0
- package/dist/sandbox/thread-env.js +49 -0
- package/dist/state/data-profile.d.ts +35 -0
- package/dist/state/data-profile.js +56 -0
- package/dist/state/index.d.ts +1 -1
- package/dist/state/index.js +1 -1
- package/dist/tasks/data-profile.d.ts +16 -1
- package/dist/tasks/data-profile.js +31 -10
- package/dist/tools/bio/chembl.js +4 -3
- package/dist/tools/bio/drug-gene-interactions.d.ts +2 -14
- package/dist/tools/bio/drug-gene-interactions.js +10 -18
- package/dist/tools/bio/gene-disease-evidence.d.ts +3 -1
- package/dist/tools/bio/gene-disease-evidence.js +12 -9
- package/dist/tools/bio/keys.js +1 -0
- package/dist/tools/bio/lookup-annotation.d.ts +43 -0
- package/dist/tools/bio/lookup-annotation.js +19 -4
- package/dist/tools/bio/pubchem.js +5 -3
- package/dist/tools/bio/search-clinical-trials.js +5 -4
- package/dist/tools/bio/search-geo-datasets.d.ts +39 -9
- package/dist/tools/bio/search-geo-datasets.js +38 -20
- package/dist/tools/lib/api-utils.d.ts +27 -2
- package/dist/tools/lib/api-utils.js +43 -3
- package/dist/tools/lib/bgee-client.d.ts +16 -0
- package/dist/tools/lib/bgee-client.js +16 -5
- package/dist/tools/lib/cbioportal-client.d.ts +20 -0
- package/dist/tools/lib/cbioportal-client.js +16 -8
- package/dist/tools/lib/chembl-client.d.ts +105 -3
- package/dist/tools/lib/chembl-client.js +196 -84
- package/dist/tools/lib/clinical-benchmarks-client.d.ts +5 -0
- package/dist/tools/lib/clinical-benchmarks-client.js +5 -0
- package/dist/tools/lib/clinical-trials-client.d.ts +131 -2
- package/dist/tools/lib/clinical-trials-client.js +32 -6
- package/dist/tools/lib/clinvar-client.d.ts +35 -0
- package/dist/tools/lib/clinvar-client.js +34 -28
- package/dist/tools/lib/ctx-ops.d.ts +106 -35
- package/dist/tools/lib/ctx-ops.js +135 -69
- package/dist/tools/lib/dgidb-client.d.ts +73 -0
- package/dist/tools/lib/dgidb-client.js +25 -13
- package/dist/tools/lib/disgenet-client.d.ts +117 -24
- package/dist/tools/lib/disgenet-client.js +127 -34
- package/dist/tools/lib/disgenet-config.d.ts +1 -1
- package/dist/tools/lib/disgenet-config.js +5 -3
- package/dist/tools/lib/drugbank-client.d.ts +57 -58
- package/dist/tools/lib/drugbank-client.js +69 -64
- package/dist/tools/lib/drugbank-config.d.ts +6 -1
- package/dist/tools/lib/drugbank-config.js +6 -1
- package/dist/tools/lib/ema-client.d.ts +53 -0
- package/dist/tools/lib/ema-client.js +19 -7
- package/dist/tools/lib/ensembl-client.d.ts +4 -0
- package/dist/tools/lib/ensembl-client.js +4 -0
- package/dist/tools/lib/gwas-catalog-client.d.ts +64 -1
- package/dist/tools/lib/gwas-catalog-client.js +21 -6
- package/dist/tools/lib/identifier-resolver.d.ts +17 -1
- package/dist/tools/lib/identifier-resolver.js +13 -4
- package/dist/tools/lib/impc-client.d.ts +4 -0
- package/dist/tools/lib/impc-client.js +4 -0
- package/dist/tools/lib/iuphar-client.d.ts +10 -5
- package/dist/tools/lib/iuphar-client.js +49 -13
- package/dist/tools/lib/monarch-client.d.ts +4 -0
- package/dist/tools/lib/monarch-client.js +4 -0
- package/dist/tools/lib/openfda-client.d.ts +34 -0
- package/dist/tools/lib/openfda-client.js +22 -8
- package/dist/tools/lib/opentargets-client.d.ts +99 -4
- package/dist/tools/lib/opentargets-client.js +97 -37
- package/dist/tools/lib/pathway-client.d.ts +45 -0
- package/dist/tools/lib/pathway-client.js +88 -8
- package/dist/tools/lib/pharmgkb-client.d.ts +35 -1
- package/dist/tools/lib/pharmgkb-client.js +22 -6
- package/dist/tools/lib/pharmgkb-config.d.ts +8 -1
- package/dist/tools/lib/pharmgkb-config.js +8 -1
- package/dist/tools/lib/pubchem-client.d.ts +22 -0
- package/dist/tools/lib/pubchem-client.js +36 -33
- package/dist/tools/lib/pubchem-ops.d.ts +85 -5
- package/dist/tools/lib/pubchem-ops.js +96 -68
- package/dist/tools/lib/pubmed-client.d.ts +4 -0
- package/dist/tools/lib/pubmed-client.js +4 -0
- package/dist/tools/lib/string-client.d.ts +52 -0
- package/dist/tools/lib/string-client.js +12 -7
- package/dist/tools/lib/uniprot-client.d.ts +4 -0
- package/dist/tools/lib/uniprot-client.js +4 -0
- package/dist/tools/research/context7-docs.d.ts +23 -0
- package/dist/tools/research/context7-docs.js +49 -9
- package/dist/tools/research/search-github-repos.d.ts +4 -0
- package/dist/tools/research/search-github-repos.js +4 -0
- package/dist/workflows/execute-target-assessment.js +4 -4
- package/dist/workflows/target-assessment/assemblers/orchestrator.d.ts +2 -1
- package/dist/workflows/target-assessment/assemblers/orchestrator.js +3 -3
- package/dist/workflows/target-assessment/collectors/index.d.ts +8 -2
- package/dist/workflows/target-assessment/collectors/index.js +37 -10
- package/dist/workflows/target-assessment/fanout/index.d.ts +2 -1
- package/dist/workflows/target-assessment/fanout/index.js +2 -2
- package/dist/workflows/target-assessment/lib/safety-corroboration.js +2 -2
- package/dist/workflows/target-assessment/lib/target-identity-filter.d.ts +3 -2
- package/dist/workflows/target-assessment/lib/target-identity-filter.js +16 -5
- package/dist/workflows/target-assessment/phase4-assemble.d.ts +61 -60
- package/dist/workflows/target-assessment/phase4-assemble.js +2 -2
- package/dist/workflows/target-assessment/schemas.d.ts +2 -8
- package/dist/workflows/target-assessment/schemas.js +8 -2
- package/dist/workflows/target-assessment/steps/phase2-aggregate.d.ts +1 -4
- package/dist/workflows/target-assessment/steps/phase3-aggregate.d.ts +1 -4
- package/package.json +1 -1
- package/dist/agents/sandbox/__fixtures__/deps.d.ts +0 -23
- package/dist/agents/sandbox/__fixtures__/deps.js +0 -102
- package/dist/citations/__fixtures__/resolver.d.ts +0 -3
- package/dist/citations/__fixtures__/resolver.js +0 -9
- package/dist/loop/__fixtures__/scripted-provider.d.ts +0 -31
- package/dist/loop/__fixtures__/scripted-provider.js +0 -81
- package/dist/providers/__fixtures__/session.d.ts +0 -17
- package/dist/providers/__fixtures__/session.js +0 -20
- package/dist/tools/__fixtures__/tool-context.d.ts +0 -13
- package/dist/tools/__fixtures__/tool-context.js +0 -22
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Used by target-assessment workflow steps for §2.5 (clinical record),
|
|
5
5
|
* §2.6.3 (trial AEs), §2.5 (failed trials), and §6.5 (discovery trials).
|
|
6
|
+
*
|
|
7
|
+
* Absence policy: the API omits the key of an absent value, and its OpenAPI
|
|
8
|
+
* document marks nothing as nullable. Thus a maybe-absent field carries
|
|
9
|
+
* `.optional()`, not `.nullable()`.
|
|
6
10
|
*/
|
|
7
11
|
import { z } from "zod";
|
|
8
12
|
import { withHost } from "../../lib/host-concurrency.js";
|
|
@@ -93,14 +97,20 @@ const CtResultsSectionSchema = z.object({
|
|
|
93
97
|
outcomeMeasuresModule: z.object({ outcomeMeasures: z.array(CtResultsMeasureSchema).optional() }).optional(),
|
|
94
98
|
adverseEventsModule: CtAdverseEventsModuleSchema.optional(),
|
|
95
99
|
});
|
|
96
|
-
|
|
100
|
+
/** One study record. It is exported so that the golden-fixture table drives it. */
|
|
101
|
+
export const CtStudySchema = z.object({
|
|
97
102
|
protocolSection: CtProtocolSectionSchema.optional(),
|
|
98
103
|
resultsSection: CtResultsSectionSchema.optional(),
|
|
99
104
|
});
|
|
100
|
-
|
|
105
|
+
/** The search envelope. It is exported so that the golden-fixture table drives it. */
|
|
106
|
+
export const CtSearchResponseSchema = z.object({
|
|
101
107
|
studies: z.array(CtStudySchema).optional(),
|
|
102
108
|
totalCount: z.number().optional(),
|
|
103
109
|
});
|
|
110
|
+
/** The page ceiling of the v2 `pageSize` parameter. */
|
|
111
|
+
const CT_MAX_PAGE_SIZE = 1000;
|
|
112
|
+
/** How many rows a phase-filtered search asks for, per row that the caller wants. */
|
|
113
|
+
const PHASE_PAGE_FACTOR = 5;
|
|
104
114
|
const STUDY_FIELDS = [
|
|
105
115
|
"NCTId",
|
|
106
116
|
"BriefTitle",
|
|
@@ -157,16 +167,30 @@ export function mapClinicalTrialStudy(s) {
|
|
|
157
167
|
sponsor,
|
|
158
168
|
};
|
|
159
169
|
}
|
|
170
|
+
/** Does the study run under the requested phase? The tokens are the wire tokens. */
|
|
171
|
+
function studyHasPhase(study, phase) {
|
|
172
|
+
return (study.protocolSection?.designModule?.phases ?? []).includes(phase);
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Search the registry.
|
|
176
|
+
*
|
|
177
|
+
* `totalFound` is the count of the whole query, which `countTotal=true` asks
|
|
178
|
+
* for. A phase filter runs over the returned page only, thus `totalFound` can
|
|
179
|
+
* exceed the number of trials that the answer carries.
|
|
180
|
+
*/
|
|
160
181
|
export async function searchTrials(query, options = {}) {
|
|
161
182
|
const limit = options.limit ?? 20;
|
|
183
|
+
// `filter.phase` is not a v2 parameter, and the API answers HTTP 400 for it.
|
|
184
|
+
// The phase filter runs here, over `designModule.phases`. A filtered page
|
|
185
|
+
// holds fewer rows than the caller asked for, thus the request asks for more.
|
|
186
|
+
const pageSize = options.phase ? Math.min(limit * PHASE_PAGE_FACTOR, CT_MAX_PAGE_SIZE) : limit;
|
|
162
187
|
const params = new URLSearchParams({
|
|
163
188
|
"query.term": query,
|
|
164
|
-
pageSize: String(
|
|
189
|
+
pageSize: String(pageSize),
|
|
165
190
|
format: "json",
|
|
191
|
+
countTotal: "true",
|
|
166
192
|
fields: STUDY_FIELDS,
|
|
167
193
|
});
|
|
168
|
-
if (options.phase)
|
|
169
|
-
params.set("filter.phase", options.phase);
|
|
170
194
|
if (options.status)
|
|
171
195
|
params.set("filter.overallStatus", options.status);
|
|
172
196
|
const res = await apiFetchValidated(`${CT_BASE}/studies?${params.toString()}`, CtSearchResponseSchema, {
|
|
@@ -175,7 +199,9 @@ export async function searchTrials(query, options = {}) {
|
|
|
175
199
|
if (res.isErr())
|
|
176
200
|
throw new Error(describeApiError(res.error));
|
|
177
201
|
const studies = res.value?.studies ?? [];
|
|
178
|
-
const
|
|
202
|
+
const phase = options.phase;
|
|
203
|
+
const selected = phase ? studies.filter((study) => studyHasPhase(study, phase)) : studies;
|
|
204
|
+
const trials = selected.slice(0, limit).map(mapClinicalTrialStudy);
|
|
179
205
|
return { totalFound: res.value?.totalCount ?? trials.length, trials };
|
|
180
206
|
}
|
|
181
207
|
/** Search trials whose intervention or condition mentions the gene/target. */
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Used by §3.4 (Genetic Alterations — ClinVar variants).
|
|
5
5
|
*/
|
|
6
|
+
import { z } from "zod";
|
|
6
7
|
export type ClinicalSignificance = "pathogenic" | "likely-pathogenic" | "benign" | "likely-benign" | "uncertain";
|
|
7
8
|
export interface ClinvarVariant {
|
|
8
9
|
variationId: string;
|
|
@@ -14,6 +15,32 @@ export interface ClinvarVariant {
|
|
|
14
15
|
conditions: string[];
|
|
15
16
|
accession: string;
|
|
16
17
|
}
|
|
18
|
+
export declare const ClinvarSearchResponseSchema: z.ZodObject<{
|
|
19
|
+
esearchresult: z.ZodOptional<z.ZodObject<{
|
|
20
|
+
idlist: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
21
|
+
count: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
22
|
+
}, z.core.$strip>>;
|
|
23
|
+
}, z.core.$strip>;
|
|
24
|
+
export declare const ClinvarSummaryResponseSchema: z.ZodObject<{
|
|
25
|
+
result: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodObject<{
|
|
26
|
+
title: z.ZodOptional<z.ZodString>;
|
|
27
|
+
accession: z.ZodOptional<z.ZodString>;
|
|
28
|
+
genes: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
29
|
+
symbol: z.ZodOptional<z.ZodString>;
|
|
30
|
+
}, z.core.$strip>>>;
|
|
31
|
+
germline_classification: z.ZodOptional<z.ZodObject<{
|
|
32
|
+
description: z.ZodOptional<z.ZodString>;
|
|
33
|
+
review_status: z.ZodOptional<z.ZodString>;
|
|
34
|
+
trait_set: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
35
|
+
trait_name: z.ZodOptional<z.ZodString>;
|
|
36
|
+
}, z.core.$strip>>>;
|
|
37
|
+
}, z.core.$strip>>;
|
|
38
|
+
molecular_consequence_list: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
39
|
+
variation_set: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
40
|
+
variant_type: z.ZodOptional<z.ZodString>;
|
|
41
|
+
}, z.core.$strip>>>;
|
|
42
|
+
}, z.core.$strip>]>>>;
|
|
43
|
+
}, z.core.$strip>;
|
|
17
44
|
/** Filter out uninformative ClinVar entries (literal "not provided", placeholders). */
|
|
18
45
|
export declare function filterInformative(variants: ClinvarVariant[]): ClinvarVariant[];
|
|
19
46
|
export declare function searchClinvar(ncbiApiKey: string | undefined, query: string, options?: {
|
|
@@ -23,3 +50,11 @@ export declare function searchClinvar(ncbiApiKey: string | undefined, query: str
|
|
|
23
50
|
totalFound: number;
|
|
24
51
|
variants: ClinvarVariant[];
|
|
25
52
|
}>;
|
|
53
|
+
/**
|
|
54
|
+
* Map one ClinVar esummary answer onto the variant records.
|
|
55
|
+
*
|
|
56
|
+
* `ids` is the id list of the search, and it names the order of the answer when
|
|
57
|
+
* the answer carries no `uids` key. The function is pure, thus the
|
|
58
|
+
* golden-fixture table exercises it against a stored payload.
|
|
59
|
+
*/
|
|
60
|
+
export declare function mapClinvarVariants(ids: string[], summary: z.infer<typeof ClinvarSummaryResponseSchema>): ClinvarVariant[];
|
|
@@ -9,24 +9,27 @@ import { ncbiUrl } from "./ncbi-utils.js";
|
|
|
9
9
|
// NCBI esummary wire shapes, validated at the fetch boundary. Every field is
|
|
10
10
|
// optional — esummary omits absent values, and the record mapping below tolerates
|
|
11
11
|
// partial payloads, so an over-strict schema would regress graceful degradation.
|
|
12
|
-
/** NCBI esummary v2 classification block
|
|
12
|
+
/** NCBI esummary v2 germline classification block. */
|
|
13
13
|
const ClinvarClassificationSchema = z.object({
|
|
14
14
|
description: z.string().optional(),
|
|
15
15
|
review_status: z.string().optional(),
|
|
16
16
|
trait_set: z.array(z.object({ trait_name: z.string().optional() })).optional(),
|
|
17
17
|
});
|
|
18
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* A single ClinVar esummary record.
|
|
20
|
+
*
|
|
21
|
+
* `variant_type` is a field of `variation_set[]`, and never of the nested
|
|
22
|
+
* `variation_loc[]`, which carries the assembly coordinates alone.
|
|
23
|
+
*/
|
|
19
24
|
const ClinvarSummaryRecordSchema = z.object({
|
|
20
25
|
title: z.string().optional(),
|
|
21
26
|
accession: z.string().optional(),
|
|
22
27
|
genes: z.array(z.object({ symbol: z.string().optional() })).optional(),
|
|
23
28
|
germline_classification: ClinvarClassificationSchema.optional(),
|
|
24
|
-
clinical_significance: z.union([ClinvarClassificationSchema, z.string()]).optional(),
|
|
25
|
-
trait_set: z.array(z.object({ trait_name: z.string().optional() })).optional(),
|
|
26
29
|
molecular_consequence_list: z.array(z.string()).optional(),
|
|
27
|
-
variation_set: z.array(z.object({
|
|
30
|
+
variation_set: z.array(z.object({ variant_type: z.string().optional() })).optional(),
|
|
28
31
|
});
|
|
29
|
-
const ClinvarSearchResponseSchema = z.object({
|
|
32
|
+
export const ClinvarSearchResponseSchema = z.object({
|
|
30
33
|
esearchresult: z
|
|
31
34
|
.object({
|
|
32
35
|
idlist: z.array(z.string()).optional(),
|
|
@@ -38,7 +41,7 @@ const ClinvarSearchResponseSchema = z.object({
|
|
|
38
41
|
// the returned UIDs, so a record value is a summary object OR that string[].
|
|
39
42
|
// The array member is listed first so an actual array never falls through to
|
|
40
43
|
// the object schema (which rejects arrays).
|
|
41
|
-
const ClinvarSummaryResponseSchema = z.object({
|
|
44
|
+
export const ClinvarSummaryResponseSchema = z.object({
|
|
42
45
|
result: z.record(z.string(), z.union([z.array(z.string()), ClinvarSummaryRecordSchema])).optional(),
|
|
43
46
|
});
|
|
44
47
|
const SIG_MAP = {
|
|
@@ -46,7 +49,7 @@ const SIG_MAP = {
|
|
|
46
49
|
"likely-pathogenic": "clinsig_likely_pathogenic",
|
|
47
50
|
benign: "clinsig_benign",
|
|
48
51
|
"likely-benign": "clinsig_likely_benign",
|
|
49
|
-
uncertain: "
|
|
52
|
+
uncertain: "clinsig_vus",
|
|
50
53
|
};
|
|
51
54
|
/** Filter out uninformative ClinVar entries (literal "not provided", placeholders). */
|
|
52
55
|
export function filterInformative(variants) {
|
|
@@ -85,32 +88,36 @@ export async function searchClinvar(ncbiApiKey, query, options = {}) {
|
|
|
85
88
|
const summaryRes = await apiFetchValidated(summaryUrl, ClinvarSummaryResponseSchema);
|
|
86
89
|
if (summaryRes.isErr())
|
|
87
90
|
throw new Error(describeApiError(summaryRes.error));
|
|
88
|
-
|
|
91
|
+
return { totalFound, variants: mapClinvarVariants(ids, summaryRes.value) };
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Map one ClinVar esummary answer onto the variant records.
|
|
95
|
+
*
|
|
96
|
+
* `ids` is the id list of the search, and it names the order of the answer when
|
|
97
|
+
* the answer carries no `uids` key. The function is pure, thus the
|
|
98
|
+
* golden-fixture table exercises it against a stored payload.
|
|
99
|
+
*/
|
|
100
|
+
export function mapClinvarVariants(ids, summary) {
|
|
101
|
+
const result = summary?.result ?? {};
|
|
89
102
|
const rawUids = result.uids;
|
|
90
103
|
const uids = Array.isArray(rawUids) ? rawUids : ids;
|
|
91
|
-
|
|
104
|
+
return uids.map((uid) => {
|
|
92
105
|
const recEntry = result[uid];
|
|
93
106
|
const rec = recEntry && !Array.isArray(recEntry) ? recEntry : {};
|
|
94
107
|
const genes = rec.genes ?? [];
|
|
95
108
|
const geneSymbol = genes[0]?.symbol ?? "";
|
|
96
|
-
// NCBI esummary v2
|
|
97
|
-
// pathogenicity call
|
|
98
|
-
// no longer appears in responses — fall back gracefully for older cached data.
|
|
109
|
+
// NCBI esummary v2: `germline_classification` holds the primary
|
|
110
|
+
// pathogenicity call, and it holds the conditions.
|
|
99
111
|
const germline = rec.germline_classification ?? {};
|
|
100
|
-
|
|
101
|
-
const
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
const
|
|
107
|
-
const
|
|
108
|
-
|
|
109
|
-
?.flatMap((vs) => vs.variation_loc ?? [])
|
|
110
|
-
.map((vl) => vl.variant_type ?? "")
|
|
111
|
-
.filter(Boolean)
|
|
112
|
-
.join(", ") ??
|
|
113
|
-
"";
|
|
112
|
+
const clinSig = germline.description ?? "";
|
|
113
|
+
const reviewStatus = germline.review_status ?? "";
|
|
114
|
+
const conditions = (germline.trait_set ?? []).map((t) => t.trait_name ?? "");
|
|
115
|
+
// The record of a copy-number variant carries an empty consequence list,
|
|
116
|
+
// and the variant type of the variation set is the answer there. Thus an
|
|
117
|
+
// empty list must fall through, and it must not join to an empty string.
|
|
118
|
+
const consequences = rec.molecular_consequence_list ?? [];
|
|
119
|
+
const variantTypes = (rec.variation_set ?? []).map((vs) => vs.variant_type ?? "").filter(Boolean);
|
|
120
|
+
const molecularConsequence = (consequences.length > 0 ? consequences : variantTypes).join(", ");
|
|
114
121
|
return {
|
|
115
122
|
variationId: uid,
|
|
116
123
|
title: rec.title ?? "",
|
|
@@ -122,5 +129,4 @@ export async function searchClinvar(ncbiApiKey, query, options = {}) {
|
|
|
122
129
|
accession: rec.accession ?? `VCV${uid.padStart(9, "0")}`,
|
|
123
130
|
};
|
|
124
131
|
});
|
|
125
|
-
return { totalFound, variants };
|
|
126
132
|
}
|
|
@@ -7,6 +7,19 @@
|
|
|
7
7
|
* point they share: a DTXSID is used directly, anything else is resolved by
|
|
8
8
|
* exact match against the chemical-search endpoint. `null` means the query
|
|
9
9
|
* resolved to no chemical — an expected outcome, not an error.
|
|
10
|
+
*
|
|
11
|
+
* UNVERIFIED CONTRACT, 2026-08-28. Every data path of the CTX API demands
|
|
12
|
+
* `EPA_CCTE_API_KEY`, and no key exists, thus no schema here parsed a live
|
|
13
|
+
* answer. The contract comes from three secondary sources: the server source of
|
|
14
|
+
* the EPA (`github.com/USEPA/ccte-api-{chemical,hazard,exposure,bioactivity}`,
|
|
15
|
+
* branch `dev`), the contract tests of the EPA (`USEPA/ccte-api-karate`), and
|
|
16
|
+
* the response bodies that the R client of the EPA (`ctxR` 1.1.3) recorded
|
|
17
|
+
* against this same base. A Java `List<T>` return type serializes to a JSON
|
|
18
|
+
* array, thus the server source settles each container shape.
|
|
19
|
+
*
|
|
20
|
+
* Absence policy: the CTX API sends an explicit `null` for an absent value, and
|
|
21
|
+
* it omits a key that its projection excludes. Thus a field carries both
|
|
22
|
+
* `.nullable()` and `.optional()`.
|
|
10
23
|
*/
|
|
11
24
|
import { z } from "zod";
|
|
12
25
|
export interface CtxResolved {
|
|
@@ -14,6 +27,11 @@ export interface CtxResolved {
|
|
|
14
27
|
preferredName: string;
|
|
15
28
|
casrn: string | null;
|
|
16
29
|
}
|
|
30
|
+
export declare const CtxChemicalSearchRowSchema: z.ZodObject<{
|
|
31
|
+
dtxsid: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
32
|
+
preferredName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
33
|
+
casrn: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
34
|
+
}, z.core.$strip>;
|
|
17
35
|
/** Resolve a DTXSID / CASRN / name to a chemical. `null` = no match (valid no-data). */
|
|
18
36
|
export declare function resolveDtxsid(query: string, headers: Record<string, string>): Promise<CtxResolved | null>;
|
|
19
37
|
export interface ToxcastAssayResult {
|
|
@@ -31,6 +49,19 @@ export interface ToxcastBioactivity {
|
|
|
31
49
|
activeHitRate: number;
|
|
32
50
|
results: ToxcastAssayResult[];
|
|
33
51
|
}
|
|
52
|
+
export declare const ToxcastBioactivityRowSchema: z.ZodObject<{
|
|
53
|
+
aeid: z.ZodOptional<z.ZodNumber>;
|
|
54
|
+
hitc: z.ZodOptional<z.ZodNumber>;
|
|
55
|
+
maxMean: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
56
|
+
modl: z.ZodOptional<z.ZodString>;
|
|
57
|
+
mc5Param: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
58
|
+
ac50: z.ZodOptional<z.ZodNumber>;
|
|
59
|
+
acc: z.ZodOptional<z.ZodNumber>;
|
|
60
|
+
}, z.core.$strip>>>;
|
|
61
|
+
mc6Param: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
62
|
+
flag: z.ZodOptional<z.ZodUnknown>;
|
|
63
|
+
}, z.core.$strip>>>;
|
|
64
|
+
}, z.core.$strip>;
|
|
34
65
|
/**
|
|
35
66
|
* ToxCast/Tox21 assay results for a chemical, sorted by AC50 ascending.
|
|
36
67
|
* `totalAssays` / `activeAssays` / `activeHitRate` always describe the full
|
|
@@ -40,10 +71,10 @@ export declare function fetchToxcastBioactivity(dtxsid: string, headers: Record<
|
|
|
40
71
|
activeOnly: boolean;
|
|
41
72
|
limit: number;
|
|
42
73
|
}): Promise<ToxcastBioactivity>;
|
|
43
|
-
declare const ToxValSchema: z.ZodPipe<z.ZodObject<{
|
|
74
|
+
export declare const ToxValSchema: z.ZodPipe<z.ZodObject<{
|
|
44
75
|
source: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
45
76
|
toxvalType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
46
|
-
toxvalNumeric: z.ZodOptional<z.
|
|
77
|
+
toxvalNumeric: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<number | null, string | number>>>>;
|
|
47
78
|
toxvalUnits: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
48
79
|
studyType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
49
80
|
studyDurationClass: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -52,7 +83,7 @@ declare const ToxValSchema: z.ZodPipe<z.ZodObject<{
|
|
|
52
83
|
toxicologicalEffect: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
53
84
|
riskAssessmentClass: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
54
85
|
humanEco: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
55
|
-
year: z.ZodOptional<z.
|
|
86
|
+
year: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<number | null, string | number>>>>;
|
|
56
87
|
quality: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
57
88
|
}, z.core.$strip>, z.ZodTransform<{
|
|
58
89
|
source: string;
|
|
@@ -71,7 +102,7 @@ declare const ToxValSchema: z.ZodPipe<z.ZodObject<{
|
|
|
71
102
|
}, {
|
|
72
103
|
source?: string | null | undefined;
|
|
73
104
|
toxvalType?: string | null | undefined;
|
|
74
|
-
toxvalNumeric?:
|
|
105
|
+
toxvalNumeric?: number | null | undefined;
|
|
75
106
|
toxvalUnits?: string | null | undefined;
|
|
76
107
|
studyType?: string | null | undefined;
|
|
77
108
|
studyDurationClass?: string | null | undefined;
|
|
@@ -80,49 +111,50 @@ declare const ToxValSchema: z.ZodPipe<z.ZodObject<{
|
|
|
80
111
|
toxicologicalEffect?: string | null | undefined;
|
|
81
112
|
riskAssessmentClass?: string | null | undefined;
|
|
82
113
|
humanEco?: string | null | undefined;
|
|
83
|
-
year?:
|
|
114
|
+
year?: number | null | undefined;
|
|
84
115
|
quality?: string | null | undefined;
|
|
85
116
|
}>>;
|
|
86
117
|
export type ToxValEntry = z.infer<typeof ToxValSchema>;
|
|
87
|
-
declare const GenetoxSchema: z.ZodPipe<z.ZodObject<{
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
118
|
+
export declare const GenetoxSchema: z.ZodPipe<z.ZodObject<{
|
|
119
|
+
ames: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
120
|
+
genetoxCall: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
121
|
+
micronucleus: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
122
|
+
reportsPositive: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
123
|
+
reportsNegative: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
124
|
+
reportsOther: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
125
|
+
clowderDocId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
95
126
|
}, z.core.$strip>, z.ZodTransform<{
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
127
|
+
ames: string;
|
|
128
|
+
genetoxCall: string;
|
|
129
|
+
micronucleus: string;
|
|
130
|
+
reportsPositive: number | null;
|
|
131
|
+
reportsNegative: number | null;
|
|
132
|
+
reportsOther: number | null;
|
|
133
|
+
clowderDocId: string;
|
|
103
134
|
}, {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
135
|
+
ames?: string | null | undefined;
|
|
136
|
+
genetoxCall?: string | null | undefined;
|
|
137
|
+
micronucleus?: string | null | undefined;
|
|
138
|
+
reportsPositive?: number | null | undefined;
|
|
139
|
+
reportsNegative?: number | null | undefined;
|
|
140
|
+
reportsOther?: number | null | undefined;
|
|
141
|
+
clowderDocId?: string | null | undefined;
|
|
111
142
|
}>>;
|
|
112
143
|
export type GenetoxSummary = z.infer<typeof GenetoxSchema>;
|
|
113
|
-
declare const CancerSchema: z.ZodPipe<z.ZodObject<{
|
|
144
|
+
export declare const CancerSchema: z.ZodPipe<z.ZodObject<{
|
|
114
145
|
source: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
115
|
-
|
|
116
|
-
|
|
146
|
+
exposureRoute: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
147
|
+
cancerCall: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
117
148
|
url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
118
149
|
}, z.core.$strip>, z.ZodTransform<{
|
|
119
150
|
source: string;
|
|
120
|
-
|
|
151
|
+
exposureRoute: string;
|
|
152
|
+
cancerCall: string;
|
|
121
153
|
url: string;
|
|
122
154
|
}, {
|
|
123
155
|
source?: string | null | undefined;
|
|
124
|
-
|
|
125
|
-
|
|
156
|
+
exposureRoute?: string | null | undefined;
|
|
157
|
+
cancerCall?: string | null | undefined;
|
|
126
158
|
url?: string | null | undefined;
|
|
127
159
|
}>>;
|
|
128
160
|
export type CancerSummary = z.infer<typeof CancerSchema>;
|
|
@@ -150,7 +182,6 @@ export interface ChemicalDetail {
|
|
|
150
182
|
smiles: string;
|
|
151
183
|
inchikey: string;
|
|
152
184
|
monoisotopicMass: number | null;
|
|
153
|
-
averageMass: number | null;
|
|
154
185
|
qcLevel: number | null;
|
|
155
186
|
totalAssays: number | null;
|
|
156
187
|
activeAssays: number | null;
|
|
@@ -171,6 +202,24 @@ export interface PropertySummary {
|
|
|
171
202
|
predictedMin: number | null;
|
|
172
203
|
predictedMax: number | null;
|
|
173
204
|
}
|
|
205
|
+
export declare const RawChemicalDetailSchema: z.ZodObject<{
|
|
206
|
+
dtxsid: z.ZodOptional<z.ZodString>;
|
|
207
|
+
dtxcid: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
208
|
+
casrn: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
209
|
+
preferredName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
210
|
+
iupacName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
211
|
+
molFormula: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
212
|
+
smiles: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
213
|
+
inchikey: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
214
|
+
monoisotopicMass: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
215
|
+
qcLevel: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
216
|
+
totalAssays: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
217
|
+
activeAssays: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
218
|
+
percentAssays: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
219
|
+
pubchemCid: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
220
|
+
pubmedCount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
221
|
+
sourcesCount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
222
|
+
}, z.core.$strip>;
|
|
174
223
|
/** Chemical identity, mass, and dashboard counts for a DTXSID. */
|
|
175
224
|
export declare function fetchCtxChemicalDetail(dtxsid: string, headers: Record<string, string>): Promise<ChemicalDetail>;
|
|
176
225
|
/** Experimental + predicted physicochemical property summaries. `undefined` = none served. */
|
|
@@ -206,6 +255,29 @@ export interface ProductData {
|
|
|
206
255
|
centralWeightFraction: number | null;
|
|
207
256
|
weightFractionType: string;
|
|
208
257
|
}
|
|
258
|
+
export declare const RawSeemPredictionSchema: z.ZodObject<{
|
|
259
|
+
dtxsid: z.ZodOptional<z.ZodString>;
|
|
260
|
+
productionVolume: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
261
|
+
units: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
262
|
+
probabilityDietary: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
263
|
+
probabilityResidential: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
264
|
+
probabilityPesticde: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
265
|
+
probabilityIndustrial: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
266
|
+
}, z.core.$strip>;
|
|
267
|
+
export declare const RawHttkRowSchema: z.ZodObject<{
|
|
268
|
+
parameter: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
269
|
+
measured: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
270
|
+
predicted: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
271
|
+
units: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
272
|
+
model: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
273
|
+
species: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
274
|
+
reference: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
275
|
+
}, z.core.$strip>;
|
|
276
|
+
export declare const RawFunctionalUseRowSchema: z.ZodObject<{
|
|
277
|
+
functioncategory: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
278
|
+
reportedfunction: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
279
|
+
doctitle: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
280
|
+
}, z.core.$strip>;
|
|
209
281
|
export type CtxExposureDataType = "seem" | "httk" | "functional-use" | "product-data" | "all";
|
|
210
282
|
export interface CtxExposureData {
|
|
211
283
|
seem?: SeemPrediction;
|
|
@@ -221,4 +293,3 @@ export declare function fetchCtxExposureData(dtxsid: string, headers: Record<str
|
|
|
221
293
|
dataType: CtxExposureDataType;
|
|
222
294
|
limit: number;
|
|
223
295
|
}): Promise<CtxExposureData>;
|
|
224
|
-
export {};
|