Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,4 @@ build_deploy.sh
output.txt

.yarn/
tasks/
8 changes: 3 additions & 5 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,14 @@ const limiter = rateLimiter({
app.engine('html', require('ejs').renderFile);

const {optionalAuth} = require('./v2.0/helpers/validation/sessionauth');
const allowedOrigins = env === 'production'
? ['https://data.neotomadb.org', 'https://apps.neotomadb.org']
: [ 'http://localhost:5173', 'http://127.0.0.1:5173',
'http://localhost:3305', 'http://127.0.0.1:3305'
];
const allowedOrigins = ['https://data.neotomadb.org', 'https://apps.neotomadb.org'];
const localhostRe = /^https?:\/\/(localhost|127\.0\.0\.1)(:\d+)?$/;

const corsOptions = {
origin: function(origin, callback) {
if (!origin) return callback(null, true); // server-to-server, curl, R package
if (allowedOrigins.includes(origin)) return callback(null, true);
if (env !== 'production' && localhostRe.test(origin)) return callback(null, true);
return callback(new Error(`CORS: origin ${origin} not allowed`));
},
credentials: true,
Expand Down
142 changes: 142 additions & 0 deletions openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3125,6 +3125,43 @@ paths:
tags:
- Contact metadata
- v2.0
/v2.0/data/contacts/{contactid}/publications:
get:
description: Returns publications authored by a specific contact.
parameters:
- $ref: '#/components/parameters/contactidPath'
responses:
'200':
content:
application/json:
schema:
type: object
properties:
status:
type: string
example: success
data:
type: array
items:
type: object
properties:
publicationid:
type: integer
citation:
type: string
year:
type: integer
doi:
type: string
nullable: true
message:
type: string
description: An array of publications associated with the contact.
summary: Publications by a contact.
tags:
- Contact metadata
- Publication metadata
- v2.0
/v2.0/data/contacts/{contactid}/sites:
get:
description: Returns the set of sites associated with an individual (or individuals).
Expand Down Expand Up @@ -3946,6 +3983,111 @@ paths:
tags:
- Occurrence metadata
- v2.0
/v2.0/data/aedna/sequences/{datasetid}:
get:
description: >-
Returns aeDNA sequences for a given dataset, grouped by taxon. Includes the taxonomic hierarchy chain, model
information, primer name, and publication DOI. Only returns the most recent (non-superseded) model assignments.
parameters:
- $ref: '#/components/parameters/datasetidPath'
responses:
'200':
content:
application/json:
schema:
type: object
properties:
status:
type: string
example: success
data:
type: object
properties:
datasetid:
type: integer
sequences:
type: array
items:
type: object
properties:
taxonid:
type: integer
taxonname:
type: string
taxonchain:
type: array
items:
type: string
description: Taxonomic hierarchy from highest rank to the taxon itself.
sequences:
type: array
items:
type: object
properties:
sequenceid:
type: integer
sequence:
type: string
description: The DNA sequence string.
model:
type: string
description: The bioinformatics model used for taxonomic assignment (e.g. DADA2).
primername:
type: string
nullable: true
publicationdoi:
type: string
nullable: true
message:
type: string
description: aeDNA sequences grouped by taxon for the dataset.
summary: aeDNA sequences for a dataset.
tags:
- aeDNA
- v2.0
/v2.0/data/aedna/taxa/{taxonid}/sequences:
get:
description: >-
Returns all aeDNA sequences associated with a given taxon. Only returns the most recent (non-superseded) model
assignments.
parameters:
- $ref: '#/components/parameters/taxonidPath'
responses:
'200':
content:
application/json:
schema:
type: object
properties:
status:
type: string
example: success
data:
type: array
items:
type: object
properties:
sequenceid:
type: integer
sequence:
type: string
description: The DNA sequence string.
model:
type: string
description: The bioinformatics model used for taxonomic assignment.
primername:
type: string
nullable: true
publicationdoi:
type: string
nullable: true
message:
type: string
description: An array of aeDNA sequences for the taxon.
summary: aeDNA sequences for a taxon.
tags:
- aeDNA
- v2.0
tags:
- description: |-
Endpoints that access tables from Neotoma verbatim. Documentation for the database can be found in
Expand Down
138 changes: 138 additions & 0 deletions openapi/paths/v20/data.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,43 @@
tags:
- Contact metadata
- v2.0
/v2.0/data/contacts/{contactid}/publications:
get:
description: Returns publications authored by a specific contact.
parameters:
- $ref: '#/components/parameters/contactidPath'
responses:
'200':
content:
application/json:
schema:
type: object
properties:
status:
type: string
example: success
data:
type: array
items:
type: object
properties:
publicationid:
type: integer
citation:
type: string
year:
type: integer
doi:
type: string
nullable: true
message:
type: string
description: An array of publications associated with the contact.
summary: Publications by a contact.
tags:
- Contact metadata
- Publication metadata
- v2.0
/v2.0/data/contacts/{contactid}/sites:
get:
description: Returns the set of sites associated with an individual (or individuals).
Expand Down Expand Up @@ -949,3 +986,104 @@
tags:
- Occurrence metadata
- v2.0
/v2.0/data/aedna/sequences/{datasetid}:
get:
description: Returns aeDNA sequences for a given dataset, grouped by taxon. Includes the taxonomic hierarchy chain, model information, primer name, and publication DOI. Only returns the most recent (non-superseded) model assignments.
parameters:
- $ref: '#/components/parameters/datasetidPath'
responses:
'200':
content:
application/json:
schema:
type: object
properties:
status:
type: string
example: success
data:
type: object
properties:
datasetid:
type: integer
sequences:
type: array
items:
type: object
properties:
taxonid:
type: integer
taxonname:
type: string
taxonchain:
type: array
items:
type: string
description: Taxonomic hierarchy from highest rank to the taxon itself.
sequences:
type: array
items:
type: object
properties:
sequenceid:
type: integer
sequence:
type: string
description: The DNA sequence string.
model:
type: string
description: The bioinformatics model used for taxonomic assignment (e.g. DADA2).
primername:
type: string
nullable: true
publicationdoi:
type: string
nullable: true
message:
type: string
description: aeDNA sequences grouped by taxon for the dataset.
summary: aeDNA sequences for a dataset.
tags:
- aeDNA
- v2.0
/v2.0/data/aedna/taxa/{taxonid}/sequences:
get:
description: Returns all aeDNA sequences associated with a given taxon. Only returns the most recent (non-superseded) model assignments.
parameters:
- $ref: '#/components/parameters/taxonidPath'
responses:
'200':
content:
application/json:
schema:
type: object
properties:
status:
type: string
example: success
data:
type: array
items:
type: object
properties:
sequenceid:
type: integer
sequence:
type: string
description: The DNA sequence string.
model:
type: string
description: The bioinformatics model used for taxonomic assignment.
primername:
type: string
nullable: true
publicationdoi:
type: string
nullable: true
message:
type: string
description: An array of aeDNA sequences for the taxon.
summary: aeDNA sequences for a taxon.
tags:
- aeDNA
- v2.0
2 changes: 1 addition & 1 deletion public/tests.html

Large diffs are not rendered by default.

Loading