Skip to content

Commit

Permalink
Flag disable classifier filter (#80)
Browse files Browse the repository at this point in the history
* created route to get samples
* modify API response for samples to include auto
  • Loading branch information
Anugerah Erlaut authored Apr 1, 2021
1 parent 9ae4719 commit 91eee58
Show file tree
Hide file tree
Showing 10 changed files with 257 additions and 80 deletions.
25 changes: 25 additions & 0 deletions src/api/route-services/__mocks__/samples.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const mockGetSamples = jest.fn(() => new Promise((resolve) => {
resolve({
samples: {
ids: ['sample-1'],
'sample-1': {
name: 'sample-1',
},
},
});
}));

const mockGetSampleIds = jest.fn(() => new Promise((resolve) => {
resolve({
samples: {
ids: ['sample-1', 'sample-2'],
},
});
}));

const mock = jest.fn().mockImplementation(() => ({
getSamples: mockGetSamples,
getSampleIds: mockGetSampleIds,
}));

module.exports = mock;
11 changes: 11 additions & 0 deletions src/api/routes/samples.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const SamplesService = require('../route-services/samples');

const samplesService = new SamplesService();

module.exports = {
'samples#get': (req, res, next) => {
samplesService.getSamples(req.params.experimentId)
.then((data) => res.json(data))
.catch(next);
},
};
141 changes: 73 additions & 68 deletions src/specs/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ info:
description: The main Node.js pipeline API.
license:
name: MIT
url: 'https://github.com/biomage-ltd/api/blob/master/LICENSE'
url: "https://github.com/biomage-ltd/api/blob/master/LICENSE"
contact:
name: Biomage Ltd.
servers:
Expand All @@ -26,10 +26,10 @@ paths:
- heartbeat
summary: API health check
operationId: checkHealth
x-eov-operation-id: 'health#check'
x-eov-operation-id: health#check
x-eov-operation-handler: routes/health
responses:
'200':
"200":
description: API is available.
content:
application/json:
Expand Down Expand Up @@ -61,10 +61,10 @@ paths:
/workResults:
post:
operationId: receiveWork
x-eov-operation-id: 'work#response'
x-eov-operation-id: work#response
x-eov-operation-handler: routes/work
requestBody:
description: The results from the execution of a work request, sent via SNS.
description: "The results from the execution of a work request, sent via SNS."
required: true
content:
text/plain:
Expand All @@ -77,14 +77,14 @@ paths:
properties: {}
examples: {}
responses:
'200':
description: 'A JSON-parseable was received by the server, *irrespective of whether it was correct/acceptable or not*.'
"200":
description: "A JSON-parseable was received by the server, *irrespective of whether it was correct/acceptable or not*."
content:
text/plain:
schema:
type: string
pattern: ok
'500':
"500":
description: The data sent by the server could not be parsed as JSON.
content:
text/plain:
Expand All @@ -104,10 +104,10 @@ paths:
/pipelineResults:
post:
operationId: receivePipelineResponse
x-eov-operation-id: 'pipelines#response'
x-eov-operation-id: pipelines#response
x-eov-operation-handler: routes/pipelines
requestBody:
description: The results from the execution of a pipeline step, sent via SNS.
description: "The results from the execution of a pipeline step, sent via SNS."
required: true
content:
text/plain:
Expand All @@ -120,14 +120,14 @@ paths:
properties: {}
examples: {}
responses:
'200':
description: 'A JSON-parseable was received by the server, *irrespective of whether it was correct/acceptable or not*.'
"200":
description: "A JSON-parseable was received by the server, *irrespective of whether it was correct/acceptable or not*."
content:
text/plain:
schema:
type: string
pattern: ok
'500':
"500":
description: The data sent by the server could not be parsed as JSON.
content:
text/plain:
Expand All @@ -144,23 +144,23 @@ paths:
tags:
- work
parameters: []
'/experiments/{experimentId}':
"/experiments/{experimentId}":
get:
tags:
- experiments
summary: Get experiment details
description: Returns the main details of the experiment.
operationId: getExperimentById
x-eov-operation-id: 'experiment#findByID'
x-eov-operation-id: experiment#findByID
x-eov-operation-handler: routes/experiment
responses:
'200':
description: successful operation
"200":
description: "Fetch successful, response below"
content:
application/json:
schema:
$ref: ./models/api-body-schemas/Experiment.v1.yaml
'404':
"404":
description: Experiment not found
content:
application/json:
Expand All @@ -173,18 +173,18 @@ paths:
in: path
required: true
description: ID of the experiment to find.
'/experiments/{experimentId}/cellSets':
"/experiments/{experimentId}/cellSets":
get:
tags:
- experiments
summary: Get cell sets for experiment
description: Returns a hirearchical view of cell sets in the experiment.
operationId: getExperimentCellSetsById
x-eov-operation-id: 'experiment#getCellSets'
x-eov-operation-id: experiment#getCellSets
x-eov-operation-handler: routes/experiment
responses:
'200':
description: 'Request successful, hierarchy returned below.'
"200":
description: "Request successful, hierarchy returned below."
content:
application/json:
schema:
Expand All @@ -194,7 +194,7 @@ paths:
type: array
items:
$ref: ./models/api-body-schemas/CellSets.v1.yaml
'404':
"404":
description: Experiment not found.
content:
application/json:
Expand All @@ -208,12 +208,12 @@ paths:
schema:
type: string
put:
summary: ''
summary: ""
operationId: updateExperimentCellSetsById
x-eov-operation-id: 'experiment#updateCellSets'
x-eov-operation-id: experiment#updateCellSets
x-eov-operation-handler: routes/experiment
responses:
'200':
"200":
description: Update to object in response successful.
content:
application/json:
Expand All @@ -233,21 +233,21 @@ paths:
- $ref: ./models/api-body-schemas/CellSets.v1.yaml
tags:
- experiments
'/experiments/{experimentId}/processingConfig':
"/experiments/{experimentId}/processingConfig":
get:
summary: Retrieve processing configuration
description: Returns a hirearchical view of processing configuration used in the experiment.
operationId: getExperimentProcessingConfigById
x-eov-operation-id: 'experiment#getProcessingConfig'
x-eov-operation-id: experiment#getProcessingConfig
x-eov-operation-handler: routes/experiment
responses:
'200':
description: 'Fetch successful, response below.'
"200":
description: "Fetch successful, response below."
content:
application/json:
schema:
$ref: ./models/ProcessingConfig.v1.yaml
'404':
"404":
description: Experiment not found.
content:
application/json:
Expand All @@ -263,12 +263,12 @@ paths:
schema:
type: string
put:
summary: ''
summary: ""
operationId: updateExperimentProcessingConfigById
x-eov-operation-id: 'experiment#updateProcessingConfig'
x-eov-operation-id: experiment#updateProcessingConfig
x-eov-operation-handler: routes/experiment
responses:
'200':
"200":
description: Update to object in response successful.
content:
application/json:
Expand Down Expand Up @@ -296,7 +296,7 @@ paths:
description: Updates the keys specified by `name` with the body specified by `body`. A standard DynamoDB UpdateItem request should be called on the update.
tags:
- processing-config
'/experiments/{experimentId}/plots-tables/{plotUuid}':
"/experiments/{experimentId}/plots-tables/{plotUuid}":
parameters:
- schema:
type: string
Expand All @@ -309,24 +309,24 @@ paths:
in: path
required: true
put:
summary: ''
summary: ""
operationId: updatePlotTable
x-eov-operation-id: 'plots-tables#update'
x-eov-operation-id: plots-tables#update
x-eov-operation-handler: routes/plots-tables
responses:
'200':
"200":
description: Update to object in response successful.
content:
application/json:
schema:
$ref: ./models/api-body-schemas/PlotTableConfig.v1.yaml
'201':
"201":
description: New resource created.
content:
application/json:
schema:
$ref: ./models/api-body-schemas/PlotTableConfig.v1.yaml
'404':
"404":
description: Invalid experiment ID specified.
description: Updates a plot and table for a given experiment with the data specified.
requestBody:
Expand All @@ -336,28 +336,28 @@ paths:
$ref: ./models/api-body-schemas/PlotTableConfig.v1.yaml
description: The new configuration to update the old one by.
get:
summary: ''
summary: ""
operationId: getPlotTable
x-eov-operation-id: 'plots-tables#read'
x-eov-operation-id: plots-tables#read
x-eov-operation-handler: routes/plots-tables
responses:
'200':
"200":
description: OK
content:
application/json:
schema:
$ref: ./models/api-body-schemas/PlotTableConfig.v1.yaml
description: Reads a plot and table for a given experiment with the data specified.
delete:
summary: ''
summary: ""
operationId: deletePlotTable
x-eov-operation-id: 'plots-tables#delete'
x-eov-operation-id: plots-tables#delete
x-eov-operation-handler: routes/plots-tables
responses:
'200':
"200":
description: OK
description: Deletes a plot and table for a given experiment with the data specified.
'/experiments/{experimentId}/pipelines':
"/experiments/{experimentId}/pipelines":
parameters:
- schema:
type: string
Expand All @@ -367,10 +367,10 @@ paths:
post:
summary: Create a new pipeline for taks execution
operationId: createNewPipeline
x-eov-operation-id: 'pipelines#create'
x-eov-operation-id: pipelines#create
x-eov-operation-handler: routes/pipelines
responses:
'200':
"200":
description: OK
content:
application/json:
Expand All @@ -379,37 +379,42 @@ paths:
properties: {}
description: This path will create a new pipeline that can run a state machine with different bioinformatics tasks.
get:
summary: ''
summary: ""
operationId: get-experiments-experimentId-pipelines
x-eov-operation-id: 'pipelines#get'
x-eov-operation-id: pipelines#get
x-eov-operation-handler: routes/pipelines
responses:
'200':
"200":
description: OK
content:
application/json:
schema:
type: object
properties: {}
'/experiments/{experimentId}/mitochondrialContent':
"/experiments/{experimentId}/samples":
parameters:
- schema:
type: string
name: experimentId
in: path
required: true
'/experiments/{experimentId}/doubletScores':
parameters:
- schema:
type: string
name: experimentId
in: path
required: true
components:
schemas:
dummy:
title: dummy
type: object
properties:
id:
type: string
get:
summary: Your GET endpoint
operationId: getSamples
x-eov-operation-id: samples#get
x-eov-operation-handler: routes/samples
tags: []
responses:
"200":
description: "Fetch successful, samples returned below."
content:
application/json:
schema:
$ref: ./models/SampleResponse.v1.yaml
"400":
description: Samples not found.
content:
application/json:
schema:
$ref: ./models/HTTPError.v1.yaml
description: Get all samples for an experiment
Loading

0 comments on commit 91eee58

Please sign in to comment.