Aedna/projects - #234
Merged
Merged
Conversation
API-56 Fixed allowed domains, allow localhost to run for explorer whe…
There was a problem hiding this comment.
Pull request overview
This pull request expands the v2.0 API to expose aeDNA assay/library and project/participant metadata by dataset, extends site metadata responses to include recdatecreated, and updates aeDNA sequence payloads and supporting tooling (OpenAPI + test scripts + ORCID session handling).
Changes:
- Added dataset-scoped endpoints for aeDNA assays and research projects, with new SQL/helper modules and route wiring.
- Added
recdatecreatedto site SQL queries and to the documented site schema. - Added
asvto aeDNA sequence queries, and improved auth session return shape (via SQL) plus test script ergonomics.
Reviewed changes
Copilot reviewed 21 out of 23 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| v2.0/routes/data.js | Adds routes for /datasets/:datasetid/assays and /datasets/:datasetid/projects. |
| v2.0/handlers/data_handlers.js | Wires new handlers that delegate to the new helper modules. |
| v2.0/helpers/assays/assays.js | Implements the assays-by-dataset handler and special-cases missing aeDNA tables. |
| v2.0/helpers/assays/assaysbydataset.sql | New query building dataset→assays→libraries JSON. |
| v2.0/helpers/projects/projects.js | Implements the projects-by-dataset handler. |
| v2.0/helpers/projects/projectsbydataset.sql | New query building dataset→projects→participants JSON. |
| v2.0/helpers/sites/sitequeryfaster.sql | Adds recdatecreated to site query output. |
| v2.0/helpers/sites/sitebyid.sql | Adds recdatecreated to site-by-id output. |
| v2.0/helpers/sites/sitebygpid.sql | Adds recdatecreated to site-by-geopol-unit output JSON. |
| v2.0/helpers/sites/sitebydsid.sql | Adds recdatecreated to site-by-dataset output. |
| v2.0/helpers/sites/sitebyctid.sql | Adds recdatecreated to site-by-contact output JSON. |
| v2.0/helpers/aedna/sequences.sql | Adds asv into aeDNA sequences grouped-by-taxon JSON payload. |
| v2.0/helpers/aedna/sequencesbytaxon.sql | Adds asv to aeDNA sequences-by-taxon row output. |
| v2.0/helpers/validation/validateuser.js | Updates explanatory comments for ORCID→session flow. |
| v2.0/helpers/validation/newlogin.sql | Extends session expiry to 7 days and returns expiresat with the UUID. |
| openapi/paths/v20/data.yml | Documents the two new dataset endpoints (assays/projects). |
| openapi/components/schemas/schemas.yml | Adds recdatecreated to the sitesv2 schema. |
| openapi.yaml | Mirrors OpenAPI changes (sitesv2 recdatecreated + new endpoints). |
| genoatt.sh | Allows specifying scheme (http/https) for oatts generation based on target host. |
| runmochabatch.sh | Adds a -l flag to run tests against a local dev server. |
| package.json | Ensures APIPATH has a default for yarn test. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+7
to
+10
| // The session UUID is the credential for every authenticated request afterwards, | ||
| // passed as `Authorization: Bearer <sessionuuid>` and checked by sessionauth.js. | ||
| // Session lifetime is set in newlogin.sql — currently 1 week — and its expiry is | ||
| // returned alongside the UUID so clients don't have to guess. |
Comment on lines
+336
to
+347
| /v2.0/data/datasets/{datasetid}/assays: | ||
| get: | ||
| description: Returns the aeDNA assays (and their sequencing libraries) linked to a dataset. | ||
| parameters: | ||
| - $ref: '#/components/parameters/datasetidPath' | ||
| responses: | ||
| '200': | ||
| content: | ||
| application/json: | ||
| schema: | ||
| type: object | ||
| description: Assays |
Comment on lines
+3350
to
+3377
| /v2.0/data/datasets/{datasetid}/assays: | ||
| get: | ||
| description: Returns the aeDNA assays (and their sequencing libraries) linked to a dataset. | ||
| parameters: | ||
| - $ref: '#/components/parameters/datasetidPath' | ||
| responses: | ||
| '200': | ||
| content: | ||
| application/json: | ||
| schema: | ||
| type: object | ||
| description: Assays | ||
| summary: aeDNA assay and library metadata for a dataset. | ||
| tags: | ||
| - Assay metadata | ||
| - v2.0 | ||
| /v2.0/data/datasets/{datasetid}/projects: | ||
| get: | ||
| description: Returns the research projects (and their participants) linked to a dataset. | ||
| parameters: | ||
| - $ref: '#/components/parameters/datasetidPath' | ||
| responses: | ||
| '200': | ||
| content: | ||
| application/json: | ||
| schema: | ||
| type: object | ||
| description: Projects |
Comment on lines
66
to
72
| json_build_object( | ||
| 'sequenceid', sd.sequenceid, | ||
| 'sequence', sd.sequence, | ||
| 'asv', sd.asv, | ||
| 'model', sd.model, | ||
| 'primername', sd.primername, | ||
| 'publicationdoi', sd.publicationdoi |
Comment on lines
1
to
7
| SELECT | ||
| sq.sequenceid, | ||
| sq.sequence, | ||
| sq.asv, | ||
| am.model, | ||
| sq.primername, | ||
| pb.doi AS publicationdoi |
Comment on lines
+25
to
+29
| 'libraries', COALESCE(( | ||
| SELECT json_agg(json_build_object( | ||
| 'libraryid', l.libraryid, | ||
| 'libid', l.libid, | ||
| 'seqrunid', l.seqrunid, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces new endpoints for retrieving aeDNA assay and project metadata linked to datasets, adds support for the
recdatecreatedfield to site-related queries and schemas, and makes several improvements to test scripts and authentication handling. The most important changes are grouped below.New API Endpoints and Handlers:
/v2.0/data/datasets/{datasetid}/assaysand/v2.0/data/datasets/{datasetid}/projectsendpoints to the OpenAPI specification (openapi.yaml,openapi/paths/v20/data.yml). These endpoints return aeDNA assay/library and project/participant metadata for a dataset. [1] [2]assaysbydsidandprojectsbydsidinv2.0/handlers/data_handlers.js, with corresponding SQL and JavaScript modules for querying assay and project data (v2.0/helpers/assays/assays.js,v2.0/helpers/assays/assaysbydataset.sql,v2.0/helpers/projects/projects.js,v2.0/helpers/projects/projectsbydataset.sql). [1] [2] [3] [4] [5]Site Metadata Improvements:
recdatecreatedfield to site queries and the OpenAPI schema, ensuring this metadata is available in API responses and documented (openapi.yaml,openapi/components/schemas/schemas.yml, and all relevant SQL queries). [1] [2] [3] [4] [5] [6] [7]aeDNA Sequence Enhancements:
asv(amplicon sequence variant) field in aeDNA sequence queries to provide more detailed sequence data (v2.0/helpers/aedna/sequences.sql,v2.0/helpers/aedna/sequencesbytaxon.sql). [1] [2] [3]Test and Script Improvements:
genoatt.sh, and added a flag to run tests against a local dev server inrunmochabatch.sh. Also improved documentation and test running logic. [1] [2] [3] [4] [5]testscript inpackage.jsonto ensureAPIPATHis always set, improving test reliability.Authentication and Session Handling:
validateuser.jsandnewlogin.sql. [1] [2]