From 18f20d6df2310ef822e541791770dfe9d7b26fc2 Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Sat, 3 Oct 2026 14:57:25 +0000 Subject: Add GET /groups/{group}/traits/{trait_id}/values, publish trait data. * 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 Claude-Session: https://claude.ai/code/session_01XDDpXvZBQat9uSgDeEMJ8d --- test/python/test_openapi.py | 1 + 1 file changed, 1 insertion(+) (limited to 'test/python/test_openapi.py') diff --git a/test/python/test_openapi.py b/test/python/test_openapi.py index 3b43f18..753df4e 100644 --- a/test/python/test_openapi.py +++ b/test/python/test_openapi.py @@ -28,6 +28,7 @@ class OpenApiTest(ServerTestCase): "/groups", "/groups/{group}", "/groups/{group}/strains", + "/groups/{group}/traits/{trait_id}/values", ): self.assertIn(path, doc["paths"]) -- cgit 1.4.1