From 6d2254a53e298ad3f2411252f9ffb22f38ab4676 Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Sat, 3 Oct 2026 12:39:04 +0000 Subject: Add /species/{species} for a single species' full row. Checked for an existing implementation first: GeneNetwork2's wqflask/api/router.py has /api/v_pre1/species/, 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}. --- test/python/test_openapi.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/python/test_openapi.py') diff --git a/test/python/test_openapi.py b/test/python/test_openapi.py index 03100b9..0815d34 100644 --- a/test/python/test_openapi.py +++ b/test/python/test_openapi.py @@ -20,7 +20,7 @@ class OpenApiTest(ServerTestCase): doc = json.loads(body) self.assertEqual(doc["info"]["title"], "GeneNetwork4 API") - for path in ("/", "/version", "/species"): + for path in ("/", "/version", "/species", "/species/{species}"): self.assertIn(path, doc["paths"]) -- cgit 1.4.1