about summary refs log tree commit diff
path: root/gn3/api
AgeCommit message (Collapse)Author
2026-10-12gemma: remove the broken /api/gemma endpoints and their unreachable codePjotr
gn3/computations/gemma.py's generate_gemma_cmd always appended "-gk" to every composed command, including its gwa-compute/k-gwa-compute endpoints that also set -lmm. Confirmed by actually running the composed command against real gemma-wrapper/GEMMA: real GEMMA rejects that combination outright ("only one of -gk ... -lmm ... options is allowed"), so none of these endpoints could ever produce output. tests/integration/test_gemma.py was entirely @unittest.skip, so this was never caught. Checked that GeneNetwork2 never called these endpoints over HTTP (no reference to api/gemma, k-compute, gwa-compute or k-gwa-compute anywhere in its codebase) -- it runs gemma-wrapper itself directly (wqflask/marker_regression/gemma_mapping.py), via its own GEMMA_WRAPPER_COMMAND and os.system() calls, never through GN3's API. So these endpoints had no real caller on either side. Removed: - gn3/api/gemma.py and its blueprint registration in gn3/app.py. - generate_gemma_cmd and generate_pheno_txt_file from gn3/computations/gemma.py (gn3/api/gemma.py was their only caller). generate_hash_of_string stays: GeneNetwork2 imports it directly (gemma_mapping.py, export_traits.py, views.py), and gn3/computations/rqtl.py uses it too. - compose_gemma_cmd from gn3/commands.py (generate_gemma_cmd was its only caller), and the now-unused `List` import that went with it. - tests/integration/test_gemma.py (tested only the removed blueprint). - The generate_gemma_cmd/generate_pheno_txt_file tests from tests/unit/computations/test_gemma.py and the compose_gemma_cmd tests from tests/unit/test_commands.py; generate_hash_of_string's and compose_rqtl_cmd's own tests stay. - CACHEDIR and GEMMA_WRAPPER_CMD from gn3/settings.json: both were read only by the removed gn3/api/gemma.py. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-09api: check dataset is public before serving sample dataPjotr
sampledata.get_sampledata and lmdb_sample_data.get_sample_data read LMDB directly by dataset/trait name with no check that the dataset is public and non-confidential. Add dataset_is_public() to db_utils, checked against ProbeSetFreeze/PublishFreeze/GenoFreeze, and use it in both handlers to return 404 before touching LMDB when the dataset isn't found or isn't public. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-01Initialise the listing of species.Frederick Muriuki Muriithi
2026-09-01Add the root endpoint and documentation to help use the API.Frederick Muriuki Muriithi
Add a root endpoint for the GN3 system. Use the HATEOAS paradigm (or adjacent) to help with discovery of the API.
2026-08-31fix(api): migrate auth/system/roles → auth/resource/system/rolesClaude
Update the two call-sites (metadata.py and case_attributes.py) to use the non-deprecated endpoint path.
2026-08-28Fix __population_privileges__: pass Bearer token to resource roles endpointClaude Sonnet 4.6
GET /auth/resource/<id>/roles requires authentication. The call was made without an Authorization header, so the auth server always returned an error and resource_privs was always an empty tuple. The resource_spec branch of can_edit (gn_libs.privileges.resources) was therefore permanently unreachable, meaning resource-owners could never edit case attributes via their role. The system roles call on the line below correctly forwarded the bearer token; this applies the same pattern to the resource roles call. Reviewed-By: Frederick M. Muriithi <fredmanglis@gmail.com>
2026-08-28refactor(case-attr): remove dead required_access helperFrederick Muriuki Muriithi
required_access is no longer called anywhere — both approve and reject now use __population_privileges__ + resources.can_apply_or_reject_edit. Also removes the Union and _HTTPException imports that were only used by required_access. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Reviewed-By: Frederick M. Muriithi <fredmanglis@gmail.com>
2026-08-28feat(case-attr): add deprecation headers to flat caseattr blueprintFrederick Muriuki Muriithi
All flat /case-attribute/ endpoints now return: Deprecation: true Link: </api/v1/>; rel="successor-version" Implemented via @caseattr.after_request so it applies automatically to every existing and future flat endpoint without per-function changes. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Reviewed-By: Frederick M. Muriith <fredmanglis@gmail.com>
2026-08-28fix(case-attr): replace required_access with can_apply_or_reject_editFrederick Muriuki Muriithi
approve_case_attributes_diff and reject_case_attributes_diff were using the old required_access helper which checked a single wrong privilege name (system:inbredset:edit-case-attribute). Replace with __population_privileges__ + resources.can_apply_or_reject_edit, consistent with the v1 endpoints. Flat endpoints derive species_id from the DB since it is not in the URL. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Reviewed-By: Frederick M. Muriithi <fredmanglis@gmail.com>
2026-08-28fix(case-attr): add can_edit privilege check to edit endpointsFrederick Muriuki Muriithi
Both the flat and v1 edit endpoints had @require_token but no privilege check, so any valid token could queue an edit. - edit_case_attributes (flat): fetch species_id from DB, call __population_privileges__, raise AuthorisationError if not can_edit. - v1_edit_case_attributes: same pattern; species_id comes from the URL. Case-attribute names remain publicly accessible (no token required). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Reviewed-By: Frederick M. Muriithi <fredmanglis@gmail.com>
2026-08-27api: add v1 blueprint hierarchy for species/populations/case-attributesFrederick Muriuki Muriithi
Introduces a nested blueprint structure that provides clean RESTful URLs alongside the existing flat endpoints (which are left unchanged): /api/v1/species/<s>/populations/<p>/case-attributes/ /api/v1/species/<s>/populations/<p>/case-attributes/edit (POST) /api/v1/species/<s>/populations/<p>/case-attributes/diffs/<t>/list /api/v1/species/<s>/populations/<p>/case-attributes/diffs/<id>/approve /api/v1/species/<s>/populations/<p>/case-attributes/diffs/<id>/reject New files: * gn3/api/version01.py — top-level v1 blueprint; registers speciesbp at /species * gn3/api/species.py — species blueprint; registers popbp; stubs list/detail (501) * gn3/api/populations.py — populations blueprint; registers caseattrsbp; stubs (501) Changes to existing files: * gn3/api/case_attributes.py — adds caseattrsbp Blueprint and v1_ route handlers that delegate to the existing private helper functions; **kwargs absorbs species_id so existing logic only needs pop_id (= InbredSet ID) * gn3/app.py — registers v01 at /api/v1 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Reviewed-By: Frederick M. Muriithi <fredmanglis@gmail.com>
2026-05-28Swap the values for 'name' and 'fullName'.Frederick Muriuki Muriithi
This commit fixes the values for the "name" and "fullName" fields, which, prior to this commit, seem to have been swapped.
2026-05-28Pass missing argument.Frederick Muriuki Muriithi
2026-03-31Update imports after upstream changesFrederick Muriuki Muriithi
Update the `can_edit` import after changes to upstream `gn-libs` library.
2026-03-30metadata edit: Update authorisation.Frederick Muriuki Muriithi
* Update authorisation paradigm for metadata edits. * Leave some notes for @bonfacem to have a look at in order to fix any misunderstandings I might have had about the code.
2026-02-09refactor: remove null traits from results.Alexander_Kabui
2026-02-09Add ".json" extension to lmdb end-point.Munyoki Kilyungi
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2026-02-07feat: Add endpoints to fetch lmdb traits.Alexander_Kabui
2026-01-13Handle CURIE-style ids when fetching dataset metadata.Munyoki Kilyungi
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2026-01-13Minor API cleanup around JSON-LD framing and compation.Munyoki Kilyungi
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2026-01-06Extend/modify the envvars rather than overridingFrederick Muriuki Muriithi
If env is provided for subprocess.Popen() or subprocess.run() functions, those are used rather than what is inherited from the parent process. We, thus, need to extend the parent process' environment for the command rather than replacing it in its entirety. This commit fixes that.
2025-10-22Fetch configs from app setting and pass them downFrederick Muriuki Muriithi
Fix the code to avoid using global variables holding configuration variables to avoid the failures caused by action-at-a-distance effects due to change of a value elsewhere. This way, all code consistently receives the same configuration values passed on from callers. We pass on the following configuration settings: * TMPDIR * SQL_URI * TEXTDIR
2025-09-10Fix pylint failing tests.Munyoki Kilyungi
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2025-07-16refactor: pass request headers as dict.Alexander_Kabui
2025-07-16refactor: pass required fields directly instead of request object for rate ↵Alexander_Kabui
limiting.
2025-07-16feat: Minor fix.Alexander_Kabui
2025-07-16feat: Implement gnqna rate limiter.Alexander_Kabui
2025-07-09Re-apply "Chores/gnqa no login"BonfaceKilz
This reverts commit f5e89525f941caa6546ea777bb632b7aa44f9b1f.
2025-07-09Revert "Chores/gnqa no login" (#229)BonfaceKilz
2025-07-07Delete unused import.Munyoki Kilyungi
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2025-07-07Only queue an edit during edits.Munyoki Kilyungi
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2025-07-07Update endpoint for listing diffs to include the change_type.Munyoki Kilyungi
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2025-07-07Delete view_diff end-point.Munyoki Kilyungi
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2025-07-07Update list_diffs to filter by change_type, remove auth check.Munyoki Kilyungi
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2025-07-07Feed json object directly into CaseAttributeEdit when editing.Munyoki Kilyungi
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2025-07-07Fix mypy errors.Munyoki Kilyungi
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2025-07-07Fix pylint errors.Munyoki Kilyungi
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2025-07-07Use app config for LMDB path in case attributes API.Munyoki Kilyungi
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2025-07-07Add missing keyword arg when applying changes.Munyoki Kilyungi
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2025-07-07Fix value access in data dict for case attribute updates.Munyoki Kilyungi
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2025-07-07Delete unused imports.Munyoki Kilyungi
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2025-07-07Delete "update_case_attribute"Munyoki Kilyungi
To update an attribute, you can use the "apply_change" function instead. Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2025-07-07Use "401 Authorized" status code for auth errors.Munyoki Kilyungi
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2025-07-07Add authorisation to view-diff endpoint.Munyoki Kilyungi
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2025-07-07Add authorisation for listing diffs.Munyoki Kilyungi
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2025-07-07Use new functions for edit and approve/reject APIs.Munyoki Kilyungi
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2025-07-07Add function for viewing a single diff change.Munyoki Kilyungi
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2025-07-07Delete unused case-attributes functions and variables.Munyoki Kilyungi
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2025-07-07Remove add/delete case attributes end-points.Munyoki Kilyungi
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2025-07-07Update "edit" case attribute end-point.Munyoki Kilyungi
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>