| Age | Commit message (Collapse) | Author |
|
/accessions.
Answers four more questions of aisearch's full_benchmark.csv from
tables the API did not expose.
* src/db.rs (Group, GroupDetail), src/routes/groups.rs: groups gain
`mapping_method`, the name of the MappingMethod row their
mapping_method_id points to (qtlreaper, Rqtl, ...), or null.
* src/db.rs (Dataset): datasets gain `tissue`, the Tissue their
ProbeFreeze points to (e.g. "Brain mRNA").
* src/routes/mapping_methods.rs: GET /mapping-methods lists the
MappingMethod table, including tools no group uses (PLINK, FastMap).
* src/routes/accessions.rs: GET /accessions/{accession} resolves a
GeneNetwork accession number (GN602, gn602 or 602) via InfoFiles to the
dataset's name, title, category (publish/probeset) and group.
* docs/genenetwork_datatypes.md: MappingMethodId is a key into the
MappingMethod table (the authoritative reading); GN2's code-based reading
is noted as superseded.
* tests/benchmark.rs, test/data/benchmark_search.json: add the 60 new
full-benchmark rows that pass (full rows 0..114; search rows run against
recorded production gn3, the rest need the database), and full rows 33
(mapping tools), 34 (Rqtl for outbred sets), 35 (GN602) and 44 (only
GTEx v8 has TPM datasets). The untested rows are listed in the file's
header comment with the reason for each.
* tests, test/python: tests for the new fields and endpoints; both
endpoints added to the OpenAPI and next-link crawl tests.
* README.md, RELEASE_NOTES.md: document the new fields and endpoints.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
|
Breaking: every success body is now {"data", "meta": {"state",
"took_ms", "request_id"}, "notes", "next"}; clients read `data`. Only
`/` (plain text) and `/openapi.json` are unwrapped.
* src/response.rs (Envelope, Meta, State, Ctx, RequestInfo): handlers
take Ctx first and build the response with ctx.envelope(data), so
timing and the request id are never filled in by hand. `state` is
`complete` or `partial`; notes are server-authored only; `next` are
concrete relative hrefs (path_segment percent-encodes names).
* src/routes/*.rs, src/lib.rs (version): every handler returns
Envelope<..> with next links; /search is `partial` when the locus
lookup fails or a sorted 1000-hit window may be truncated, and
/publications/{pubmed_id}/traits when datasets were left out for
authorization.
* src/error.rs (ApiError): add `took_ms`, an RFC 7807 extension member.
* src/auth.rs (AuthToken): the 401 now carries request_id and took_ms
(it never had a request_id); Ctx stores RequestInfo in the request
extensions for it.
* tests: common::data / envelope_data parse every success body through
the envelope; tests/envelope.rs and test/python/test_envelope.py check
the shape, errors, and that every `next` link resolves;
tests/envelope_partial.rs checks the `partial` search without a
database; tests/openapi.rs fails if a JSON success response is not an
Envelope_* schema.
* README.md, docs/SKILL.md, docs/gn-auth.md, RELEASE_NOTES.md: document
the envelope and took_ms on errors.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
|
Lists the published traits (across groups) a publication reports.
Datasets the caller may not view are left out, using the same check as
GET /traits/{dataset} (traits.rs is_authorised is now pub(crate)).
* src/db.rs (TraitInfo, trait_info_sql): TraitInfo gains `dataset`,
`abbreviation` (Phenotype.Post_publication_abbreviation, else Pre) and
`url` (the GeneNetwork show_trait page). The three TraitInfo queries
now share one SELECT. New get_group_traits_by_abbreviation and
get_publication_traits.
* src/routes/groups.rs (group_traits): add ?abbreviation= filter.
* src/db.rs (Group), src/routes/groups.rs (groups): groups carry
`family` and `species`; add family, species and q filters.
* src/routes/search.rs (search): add `page` (gn3's page unsorted, a
page of the ranked list with `sort`); declare `pubmed_id`; hits gain
`abbreviation` next to `locus` (get_publish_annotations).
* src/db.rs (LRS_PER_LOD): LOD = LRS / 4.604, the divisor the
benchmark's RDF data uses (was 4.61).
* tests, test/python, test/data/benchmark_search.json, README.md: cover
all of the above; tests/benchmark.rs now also answers rows 11, 16, 25,
30, 34 and 37 of small_benchmark.csv, and compares LOD exactly.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
|
The expression (ProbeSet) counterpart to the PublishXRef endpoints:
ProbeSetXRef has no single Id column of its own (its primary key is
DataId; the natural key is the pair (ProbeSetFreezeId, ProbeSetId)),
so a trait here is addressed by dataset name plus ProbeSet.Name
instead of a single numeric trait id.
* src/db.rs (Dataset): New struct, one ProbeSetFreeze row.
(get_group_datasets): New function. Joins ProbeSetFreeze and
ProbeFreeze by group Id, matching GeneNetwork2's
wqflask.api.router.get_datasets_for_group.
(get_dataset_by_name): New function. Matches Name, Name2, FullName,
ShortName or numeric Id, matching
wqflask.api.router.get_dataset_info's ProbeSet-branch matching logic.
A dataset name is globally unique on its own, unlike a group's
traits, so this isn't scoped by group.
(ProbeSetInfo): New struct, a probe's ProbeSetXRef mapping stats plus
its ProbeSet gene annotation.
(get_dataset_probeset_info): New function, matching
wqflask.api.router.get_trait_info's ProbeSet branch.
(ProbeSetValue): New struct.
(get_dataset_probeset_values): New function, matching
wqflask.api.router.trait_sample_data's ProbeSet branch.
* src/lib.rs (DatasetProbesetLookup): New enum, the expression-dataset
equivalent of GroupTraitLookup -- distinguishes a missing dataset from
a missing probeset in an existing dataset.
(group_datasets): New handler for GET /groups/{group}/datasets.
(dataset_by_name): New handler for GET /datasets/{dataset}.
(get_dataset_probeset_info_result, dataset_probeset_info): New
function and handler for GET /datasets/{dataset}/probesets/{probeset}.
(get_dataset_probeset_values_result, dataset_probeset_values): New
function and handler for
GET /datasets/{dataset}/probesets/{probeset}/values.
(app): Register all four.
* tests/group_datasets.rs, tests/dataset_by_name.rs,
tests/dataset_probeset_info.rs, tests/dataset_probeset_values.rs,
test/python/test_group_datasets.py, test/python/test_dataset_by_name.py,
test/python/test_dataset_probeset_info.py,
test/python/test_dataset_probeset_values.py: New files. Br_U_0803_M
(dataset) / 100001_at (probeset, gene symbol Cd3g) in BXD are real rows
used as fixtures.
* tests/openapi.rs, test/python/test_openapi.py: Check the four new
paths are in the generated spec.
* README.md: Document the four new endpoints and list the new test
files.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XDDpXvZBQat9uSgDeEMJ8d
|
|
* src/db.rs (TraitInfo): New struct. Joins PublishXRef, Phenotype and
Publication; LEFT JOIN on the latter two since a handful of
PublishXRef rows have no matching row. SQL column aliases are written
to match mysql_common's UpperCamelCase conversion exactly, so no field
needs a #[mysql(rename = "...")] override.
(get_group_trait_info): New function.
(pool): New function. mysql::Pool::new eagerly opens its default 10
connections before returning (about 7s against this database); every
query function here used to call it per request, paying that cost on
every single API call. Builds the Pool once behind a
OnceLock<Mutex<Option<Pool>>> and shares the cheap, Arc-backed handle
from then on (OnceLock::get_or_init can't be used alone since
Pool::new is fallible and get_or_try_init is still unstable).
(get_all_species, get_species_by_name, get_all_groups,
get_group_by_name, get_group_strains, get_group_trait_values,
get_group_trait_info): Use it instead of building their own Pool.
* src/lib.rs (GroupTraitLookup): Generalize over the found value (was
Vec<db::TraitValue>-specific), so group_trait_info can share it with
group_trait_values.
(get_group_trait_info_result): New function.
(group_trait_info): New handler for GET /groups/{group}/traits/{trait_id}.
(app): Register it.
* tests/common/mod.rs: New file. get() issues a GET against
genenetwork4::app() and warns on stderr if it takes over a second --
this is what surfaced the Pool::new cost above.
* tests/species.rs, tests/species_by_name.rs, tests/groups.rs,
tests/group_by_name.rs, tests/group_strains.rs,
tests/group_trait_values.rs: Use tests/common::get instead of building
each request by hand.
* tests/group_trait_info.rs, test/python/test_group_trait_info.py: New
files.
* tests/openapi.rs, test/python/test_openapi.py: Check the new path is
in the generated spec.
* README.md (GET /groups/{group}/traits/{trait_id}): Document it.
(Tests): List the new test files; document tests/common::get's timing
warnings and how to see them.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XDDpXvZBQat9uSgDeEMJ8d
|
|
* src/db.rs (TraitValue): New struct.
(get_group_trait_values): New function. Joins PublishData, Strain and
PublishXRef by group Id and PublishXRef.Id, matching gn-guile's
gn.data.dataset:get-bxd-publish-name-value-dict generalized beyond
BXD: PublishXRef.Id alone isn't unique across groups, only the pair
(InbredSetId, Id) is, the same way GeneNetwork2's
wqflask.api.router.trait_sample_data combines trait_name with a group
or dataset to resolve a Publish trait.
* src/lib.rs (GroupTraitLookup): New enum, distinguishes a missing
group from a missing trait in an existing group.
(get_group_trait_values_result): New function, looks up a group then
its trait, returning a GroupTraitLookup.
(group_trait_values): New handler for GET
/groups/{group}/traits/{trait_id}/values. 404s as group_not_found or
trait_not_found depending on what get_group_trait_values_result
found.
(app): Register it.
* tests/group_trait_values.rs, test/python/test_group_trait_values.py:
New files.
* tests/openapi.rs, test/python/test_openapi.py: Check the new path
is in the generated spec.
* README.md (GET /groups/{group}/traits/{trait_id}/values): Document
it, including that only Publish (phenotype) traits are supported so
far, not ProbeSet or Geno traits.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XDDpXvZBQat9uSgDeEMJ8d
|
|
* src/db.rs (Strain): New struct.
(get_group_strains): New function. Joins Strain and StrainXRef by
group Id, optionally filtered to strains used for mapping, matching
gn-guile's gn.data.strains:strain-id-names (same InbredSetId and
used-for-mapping? arguments), returning strain names as well as ids.
* src/lib.rs (GroupStrainsParams): New struct, the used_for_mapping
query parameter.
(group_strains): New handler for GET /groups/{group}/strains. Looks
the group up the same way group_by_name does, for the same 404 shape
on an unknown group.
(app): Register it.
* tests/group_strains.rs, test/python/test_group_strains.py: New
files.
* tests/openapi.rs, test/python/test_openapi.py: Check the new path
is in the generated spec.
* README.md (GET /groups/{group}/strains): Document it, including the
used_for_mapping filter excluding BXD's parent strains.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XDDpXvZBQat9uSgDeEMJ8d
|
|
* src/db.rs (Group): New struct. Summary of one InbredSet row,
matching the shape of GeneNetwork2's GET /api/v_pre1/groups response.
(get_all_groups): New function. Mirrors GeneNetwork2's
wqflask.api.router.get_groups_list (no species filter yet).
(GroupDetail): New struct, deriving FromRow instead of being built
from a tuple like SpeciesDetail, since InbredSet has 14 columns, more
than mysql_common's FromRow is implemented for tuples (up to 12).
FromRow matches by column name (PascalCase of the field name via
#[mysql(rename_all = "PascalCase")]), except public, which is
lowercase in the schema and needs its own #[mysql(rename = "public")].
(get_group_by_name): New function. Mirrors GeneNetwork2's
wqflask.api.router.get_group_info, but returns every column instead of
a fixed subset.
* src/lib.rs (app): Add /groups and /groups/{group} routes.
(groups, group_by_name): New handlers, following the same
ApiError/request-id/spawn_blocking pattern as species/species_by_name.
(group_by_name): On no match, set ApiError's next to /groups.
* tests/groups.rs: New file. Checks BXD is present (used throughout
the GeneNetwork2 and GeneNetwork3 test suites as a fixture group,
always present in the database); skips rather than fails when no
database is reachable, same as species.rs.
* test/python/test_groups.py: New file. Likewise.
* tests/group_by_name.rs: New file. Checks BXD's full row and an
unknown-group 404 case, same pattern as species_by_name.rs.
* test/python/test_group_by_name.py: New file. Likewise.
* tests/openapi.rs (openapi_json_describes_all_endpoints): Check for
/groups and /groups/{group} among the documented paths.
* test/python/test_openapi.py
(test_openapi_json_describes_all_endpoints): Likewise.
* README.md: Document /groups and /groups/{group}.
|
|
Checked for an existing implementation first: GeneNetwork2's
wqflask/api/router.py has /api/v_pre1/species/<species_name>, matching
Name, FullName or SpeciesName, but returning only a 4-column subset
(Id, Name, FullName, TaxonomyId). GeneNetwork3's gn3/db/wiki.py has
only internal name-to-id lookups for the wiki feature; its /species is
SPARQL-based metadata, not a Species table row. gn-guile's species
code (gn/data/species.scm) is also SPARQL/RDF metadata, not backed by
db_webqtl.
* src/db.rs (params): Import.
(SpeciesDetail): New struct, one full row of the Species table.
(get_species_by_name): New function. Same match logic as
GeneNetwork2's get_species_info (Name, FullName or SpeciesName), but
selects every column instead of a fixed subset.
* src/lib.rs (app): Add /species/{species} route.
(species_by_name): New handler. 404 if no species matches.
* tests/species_by_name.rs: New file. Tests mouse specifically
(Name=mouse is always present) and an unknown-species 404 case; skips
rather than fails when no database is reachable, same as species.rs.
* test/python/test_species_by_name.py: New file. Likewise.
* tests/openapi.rs (openapi_json_describes_all_endpoints): Check for
/species/{species} among the documented paths.
* test/python/test_openapi.py (test_openapi_json_describes_all_endpoints):
Likewise.
* README.md: Document /species/{species}.
|
|
* Cargo.toml (dependencies): Add utoipa, feature axum_extras; add
utoipa-axum.
* src/lib.rs: Use utoipa_axum::router::OpenApiRouter and routes!
instead of axum::Router and route!, so paths register into an OpenApi
document as well as the router.
(ApiDoc): New struct, deriving utoipa::OpenApi with title, description
and license.
(app): Add /openapi.json, serving the OpenApi document split out of
OpenApiRouter via split_for_parts.
(hello_world, version, species): Add #[utoipa::path(...)] attributes
describing each endpoint's responses.
(VersionInfo): Derive utoipa::ToSchema in addition to Serialize.
* src/db.rs (Species): Likewise.
* tests/openapi.rs: New file. Checks /openapi.json's info.title and
that it lists all three endpoints.
* test/python/test_openapi.py: New file. Likewise.
* README.md: Document /openapi.json.
* rust-package.scm: Regenerate with guix import crate -f Cargo.lock
genenetwork4. Adds crate-source definitions for utoipa, utoipa-gen,
utoipa-axum and pastey.
* guix.scm (genenetwork4-git)[native-inputs]: Add rust-utoipa-6.0.0,
rust-utoipa-gen-6.0.1, rust-utoipa-axum-0.3.0 and rust-pastey-0.2.3.
|