Skip to content

Aedna/projects - #234

Merged
sedv8808 merged 8 commits into
developfrom
aedna/projects
Aug 6, 2026
Merged

Aedna/projects#234
sedv8808 merged 8 commits into
developfrom
aedna/projects

Conversation

@sedv8808

@sedv8808 sedv8808 commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

This pull request introduces new endpoints for retrieving aeDNA assay and project metadata linked to datasets, adds support for the recdatecreated field 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:

  • Added /v2.0/data/datasets/{datasetid}/assays and /v2.0/data/datasets/{datasetid}/projects endpoints 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]
  • Implemented new handlers assaysbydsid and projectsbydsid in v2.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:

  • Added the recdatecreated field 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:

  • Included the 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:

  • Updated test scripts to allow specifying the protocol scheme (http/https) for remote hosts in genoatt.sh, and added a flag to run tests against a local dev server in runmochabatch.sh. Also improved documentation and test running logic. [1] [2] [3] [4] [5]
  • Modified the test script in package.json to ensure APIPATH is always set, improving test reliability.

Authentication and Session Handling:

  • Extended ORCID session expiry from 5 to 7 days, and now returns both the session UUID and expiry time to clients. Improved code comments for clarity in validateuser.js and newlogin.sql. [1] [2]

Copilot AI lite review requested due to automatic review settings August 6, 2026 22:52
@sedv8808
sedv8808 merged commit adc88fe into develop Aug 6, 2026
2 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 recdatecreated to site SQL queries and to the documented site schema.
  • Added asv to 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 thread openapi.yaml
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,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants