Skill Tracer
Skills › Scientific Agent Skills › ncats-arax › output-schema.md

output-schema.md

197 lines · skills/ncats-arax/references/output-schema.md at 5f2bc03

Open on GitHub
1# ARAX artifact and output contract
2

ARAX artifact and output contract

Raw lines 1 to 2
3## Contents
4
5- [Artifact sets](#artifact-sets)
6- [Exact byte preservation](#exact-byte-preservation)
7- [Query summary](#query-summary)
8- [Normalization and preflight summaries](#normalization-and-preflight-summaries)
9- [Provenance interpretation](#provenance-interpretation)
10- [Truncation and completeness](#truncation-and-completeness)
11- [Manifest](#manifest)
12- [Warnings and exit codes](#warnings-and-exit-codes)

Contents

  • Artifact sets
  • Exact byte preservation
  • Query summary
  • Normalization and preflight summaries
  • Provenance interpretation
  • Truncation and completeness
  • Manifest
  • Warnings and exit codes
Raw lines 3 to 13
14## Artifact sets
16Every graph query requires a new or empty output directory and writes:
18```text
19request.json
20response.json
21summary.json
22manifest.json
23```
25Normalization writes the exact entity response, a bounded normalization summary, and a manifest.
26Preflight writes the exact OpenAPI response, a service summary, and a manifest only when an output
27directory is requested. GET commands do not create a fictitious `request.json`; the corresponding
28manifest file, byte, and hash fields are null. Offline `summarize` writes nothing.
30Reject an existing nonempty directory before network access. Write artifacts through a private
31temporary file, flush and `fsync`, set mode `0600` where supported, and atomically replace the final
32path. Write the manifest last.

Artifact sets

Every graph query requires a new or empty output directory and writes:

request.json
response.json
summary.json
manifest.json

Normalization writes the exact entity response, a bounded normalization summary, and a manifest. Preflight writes the exact OpenAPI response, a service summary, and a manifest only when an output directory is requested. GET commands do not create a fictitious request.json; the corresponding manifest file, byte, and hash fields are null. Offline summarize writes nothing.

Reject an existing nonempty directory before network access. Write artifacts through a private temporary file, flush and fsync, set mode 0600 where supported, and atomically replace the final path. Write the manifest last.

Raw lines 14 to 33
34## Exact byte preservation
36Serialize a POST body once with sorted keys, compact separators, UTF-8, and `ensure_ascii=False`.
37Save and send that same byte string. Request `Accept-Encoding: identity`, save the raw response
38before JSON parsing, and hash request and response bytes with SHA-256.
40Read at most 26,214,401 response bytes. If the extra byte exists, treat the response as oversized,
41save no partial `response.json`, retain the request when applicable, write a terminal manifest, and
42exit 6. A bounded HTTP-error body is preserved exactly. A bounded malformed JSON response is also
43preserved, but no misleading summary is produced.

Exact byte preservation

Serialize a POST body once with sorted keys, compact separators, UTF-8, and ensure_ascii=False. Save and send that same byte string. Request Accept-Encoding: identity, save the raw response before JSON parsing, and hash request and response bytes with SHA-256.

Read at most 26,214,401 response bytes. If the extra byte exists, treat the response as oversized, save no partial response.json, retain the request when applicable, write a terminal manifest, and exit 6. A bounded HTTP-error body is preserved exactly. A bounded malformed JSON response is also preserved, but no misleading summary is produced.

Raw lines 34 to 44
45## Query summary
47`summary.json` is a normalized bounded view; `response.json` remains authoritative.
49```json
51 "schema_version": "1.0",
52 "query": {
53 "kind": "one-hop|two-hop",
54 "mode": "lookup|federated",
55 "provider_ids": [],
56 "expand_order": "right-first|left-first|null",
57 "qnode_ids": {},
58 "result_limit": 20
59 },
60 "service": {
61 "base_url": null,
62 "arax_version": null,
63 "trapi_version": null,
64 "biolink_version": null
65 },
66 "counts": {
67 "results_returned": 0,
68 "results_summarized": 0,
69 "analyses_summarized": 0,
70 "bound_edges_summarized": 0,
71 "knowledge_graph_nodes": 0,
72 "knowledge_graph_edges": 0,
73 "server_total_results_count": null
74 },
75 "truncation_status": "no|possible|confirmed",
76 "completeness": "complete|partial|unknown",
77 "results": [],
78 "warnings": []
80```
82Keep response order. A result contains its one-based unscored `position`, bounded description,
83normalized node bindings, and separate analyses. Each analysis contains its resource ID, returned
84score, support-graph IDs, and bound-edge objects grouped by query-edge key.
86A bound-edge object contains the returned edge ID, physical subject/predicate/object and names,
87query-direction match flag, qualifiers, full source objects, role-derived source ID lists,
88publication IDs and availability, and support-graph IDs and status.

Query summary

summary.json is a normalized bounded view; response.json remains authoritative.

{
  "schema_version": "1.0",
  "query": {
    "kind": "one-hop|two-hop",
    "mode": "lookup|federated",
    "provider_ids": [],
    "expand_order": "right-first|left-first|null",
    "qnode_ids": {},
    "result_limit": 20
  },
  "service": {
    "base_url": null,
    "arax_version": null,
    "trapi_version": null,
    "biolink_version": null
  },
  "counts": {
    "results_returned": 0,
    "results_summarized": 0,
    "analyses_summarized": 0,
    "bound_edges_summarized": 0,
    "knowledge_graph_nodes": 0,
    "knowledge_graph_edges": 0,
    "server_total_results_count": null
  },
  "truncation_status": "no|possible|confirmed",
  "completeness": "complete|partial|unknown",
  "results": [],
  "warnings": []
}

Keep response order. A result contains its one-based unscored position, bounded description, normalized node bindings, and separate analyses. Each analysis contains its resource ID, returned score, support-graph IDs, and bound-edge objects grouped by query-edge key.

A bound-edge object contains the returned edge ID, physical subject/predicate/object and names, query-direction match flag, qualifiers, full source objects, role-derived source ID lists, publication IDs and availability, and support-graph IDs and status.

Raw lines 45 to 89
90## Normalization and preflight summaries
92A normalization summary records the input, expected category, whether free-text confirmation is
93required, service versions, canonical identifier/name/category, category-count mapping, total
94synonym count, bounded candidate preview, and warnings.
96A preflight summary records service versions plus Boolean checks for ARAX identity, `/query`, and
97version compatibility. Preflight also requires `POST /query` and `GET /entity` in OpenAPI.
98Neither summary claims graph results. Normalization retains preflight version/endpoint warnings.

Normalization and preflight summaries

A normalization summary records the input, expected category, whether free-text confirmation is required, service versions, canonical identifier/name/category, category-count mapping, total synonym count, bounded candidate preview, and warnings.

A preflight summary records service versions plus Boolean checks for ARAX identity, /query, and version compatibility. Preflight also requires POST /query and GET /entity in OpenAPI. Neither summary claims graph results. Normalization retains preflight version/endpoint warnings.

Raw lines 90 to 99
100## Provenance interpretation
102Use each analysis's `edge_bindings` to select knowledge-graph edges. Do not include unrelated graph
103edges. Preserve multiple analyses separately and retain all entries from each bound edge's
104`sources`, including `resource_id`, `resource_role`, `upstream_resource_ids`, and
105`source_record_urls`. Derive unique, first-seen resource ID lists for primary, aggregator, and
106supporting-data roles without discarding the full objects.
108Preserve returned qualifiers as type/value pairs. Preserve physical edge direction and set
109`matches_query_direction: false` rather than rewriting a reversed edge.
111V1 recognizes `biolink:publications` edge attributes. Accept a string or list of strings and
112deduplicate in first-seen order. Missing recognized metadata means:
114```text
115publication_ids: []
116publication_availability: not_returned
117```
119It never means that no publications exist.
121Use `analysis.support_graphs` as the support-graph references. If none are returned, report
122`not_returned`; if all appear in `message.auxiliary_graphs`, report `available`; if a referenced ID
123is absent, report `missing` and warn.

Provenance interpretation

Use each analysis's edge_bindings to select knowledge-graph edges. Do not include unrelated graph edges. Preserve multiple analyses separately and retain all entries from each bound edge's sources, including resource_id, resource_role, upstream_resource_ids, and source_record_urls. Derive unique, first-seen resource ID lists for primary, aggregator, and supporting-data roles without discarding the full objects.

Preserve returned qualifiers as type/value pairs. Preserve physical edge direction and set matches_query_direction: false rather than rewriting a reversed edge.

V1 recognizes biolink:publications edge attributes. Accept a string or list of strings and deduplicate in first-seen order. Missing recognized metadata means:

publication_ids: []
publication_availability: not_returned

It never means that no publications exist.

Use analysis.support_graphs as the support-graph references. If none are returned, report not_returned; if all appear in message.auxiliary_graphs, report available; if a referenced ID is absent, report missing and warn.

Raw lines 100 to 124
125## Truncation and completeness
127- Fewer results than the requested limit: `no`, unless logs or counts show removal.
128- Exactly the limit: `possible` and `RESULT_LIMIT_REACHED`.
129- More than the limit, an explicit pruning/removal log, or a larger server total: `confirmed`.
131Keep only the first requested number of results in the normalized summary while preserving the
132entire size-bounded raw response.
134KP timeout, provider error, or malformed-provider evidence in warning/error logs yields
135`completeness: partial`, `result_status: partial`, retained artifacts, and exit 7 in either lookup
136or federated mode. Informational timeout configuration and advisory CURIE warnings do not alone
137indicate provider failure. This classification depends on returned logs; `complete` means no
138recognized failure was reported, not that every possible biomedical relationship was searched.
140HTTP 200 alone is not success. ARAX can return an application error in `status` (for example,
141`InvalidKP` or `QueryNotTraversable`). An explicit status other than `Success` or legacy `OK`
142produces exit 6 with the raw response and failure manifest retained, but no success summary.
143Absent/null status is allowed by TRAPI and still requires the graph/results checks. A valid
144successful `results: []` remains a zero-result lookup. Malformed responses also produce no summary.
145This behavior follows the [ARAX query envelope handling](https://github.com/RTXteam/RTX/blob/master/code/ARAX/ARAXQuery/ARAX_query.py)
146and [provider response handling](https://github.com/RTXteam/RTX/blob/master/code/ARAX/ARAXQuery/Expand/trapi_querier.py).

Truncation and completeness

  • Fewer results than the requested limit: no, unless logs or counts show removal.
  • Exactly the limit: possible and RESULT_LIMIT_REACHED.
  • More than the limit, an explicit pruning/removal log, or a larger server total: confirmed.

Keep only the first requested number of results in the normalized summary while preserving the entire size-bounded raw response.

KP timeout, provider error, or malformed-provider evidence in warning/error logs yields completeness: partial, result_status: partial, retained artifacts, and exit 7 in either lookup or federated mode. Informational timeout configuration and advisory CURIE warnings do not alone indicate provider failure. This classification depends on returned logs; complete means no recognized failure was reported, not that every possible biomedical relationship was searched.

HTTP 200 alone is not success. ARAX can return an application error in status (for example, InvalidKP or QueryNotTraversable). An explicit status other than Success or legacy OK produces exit 6 with the raw response and failure manifest retained, but no success summary. Absent/null status is allowed by TRAPI and still requires the graph/results checks. A valid successful results: [] remains a zero-result lookup. Malformed responses also produce no summary. This behavior follows the ARAX query envelope handling and provider response handling.

Raw lines 125 to 147
148## Manifest
150The manifest records run UUID, UTC timestamps, command, execution/result status, privacy
151acknowledgment, fixed client identity, service versions, request/response method, URL, filenames,
152byte counts, hashes, elapsed time, applied limits, attempt counts, artifact names, bounded error,
153and warnings. Fields for artifacts that do not exist are null rather than false filenames.
155Execution statuses are `success`, `http_error`, and `client_error`. Result statuses are `results`,
156`no_results`, `partial`, and `not_available`.

Manifest

The manifest records run UUID, UTC timestamps, command, execution/result status, privacy acknowledgment, fixed client identity, service versions, request/response method, URL, filenames, byte counts, hashes, elapsed time, applied limits, attempt counts, artifact names, bounded error, and warnings. Fields for artifacts that do not exist are null rather than false filenames.

Execution statuses are success, http_error, and client_error. Result statuses are results, no_results, partial, and not_available.

Raw lines 148 to 157
158## Warnings and exit codes
160Warnings are objects with a stable `code`, bounded sanitized `message`, and a small scalar
161`context`. Supported codes:
163```text
164PUBLIC_QUERY
165NORMALIZATION_REQUIRES_CONFIRMATION
166NORMALIZATION_CATEGORY_MISMATCH
167NO_RESULTS
168NO_PUBLICATIONS_RETURNED
169NO_PRIMARY_SOURCE_RETURNED
170UNSCORED_RESPONSE_ORDER
171RESULT_LIMIT_REACHED
172INTERNAL_PRUNING_DETECTED
173KP_TIMEOUT
174KP_ERROR
175MALFORMED_KP_RESPONSE
176MISSING_AUXILIARY_GRAPH
177REVERSED_EDGE_BINDING
178UNTESTED_SERVICE_VERSION
179NONPRODUCTION_ENDPOINT
180```
182Exit codes:
184| Code | Meaning |
185| ---: | --- |
186| 0 | Complete success, including a valid zero-result graph response |
187| 2 | Invalid CLI input, unsupported saved request, or local validation failure |
188| 3 | Service preflight or unsupported-version failure |
189| 4 | Normalization returned no usable result |
190| 5 | Transport or HTTP failure |
191| 6 | Non-success ARAX status, malformed/oversized response, or artifact-integrity failure |
192| 7 | Partial lookup or federated response with retained artifacts |
194Text output prints at most the bounded result set and ten publication IDs per edge, labels every
195position unscored, includes all source-role IDs, and points to `summary.json` and `response.json`.
196Use "ARAX returned" and "not returned under these constraints," never proof, absence, or ranking
197language.

Warnings and exit codes

Warnings are objects with a stable code, bounded sanitized message, and a small scalar context. Supported codes:

PUBLIC_QUERY
NORMALIZATION_REQUIRES_CONFIRMATION
NORMALIZATION_CATEGORY_MISMATCH
NO_RESULTS
NO_PUBLICATIONS_RETURNED
NO_PRIMARY_SOURCE_RETURNED
UNSCORED_RESPONSE_ORDER
RESULT_LIMIT_REACHED
INTERNAL_PRUNING_DETECTED
KP_TIMEOUT
KP_ERROR
MALFORMED_KP_RESPONSE
MISSING_AUXILIARY_GRAPH
REVERSED_EDGE_BINDING
UNTESTED_SERVICE_VERSION
NONPRODUCTION_ENDPOINT

Exit codes:

CodeMeaning
0Complete success, including a valid zero-result graph response
2Invalid CLI input, unsupported saved request, or local validation failure
3Service preflight or unsupported-version failure
4Normalization returned no usable result
5Transport or HTTP failure
6Non-success ARAX status, malformed/oversized response, or artifact-integrity failure
7Partial lookup or federated response with retained artifacts

Text output prints at most the bounded result set and ten publication IDs per edge, labels every position unscored, includes all source-role IDs, and points to summary.json and response.json. Use "ARAX returned" and "not returned under these constraints," never proof, absence, or ranking language.

Raw lines 158 to 197