Skip to content

Commit

Permalink
#2 add endpoints for filter and metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
David Rauh committed Feb 8, 2023
1 parent ab73952 commit 30bfca9
Show file tree
Hide file tree
Showing 12 changed files with 647 additions and 3 deletions.
34 changes: 33 additions & 1 deletion api/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,38 @@ paths:
application/json:
schema:
$ref: "./schemas/MBRecord.yaml"

/filter/options:
get:
summary: get filter options
operationId: getFilterOptions
responses:
'200':
description: "All Filter options"
content:
application/json:
schema:
$ref: "./schemas/FilterOptions.yaml#/components/schemas/FilterOptions"
/filter/browse:
get:
summary: get browse options
operationId: getBrowseOptions
responses:
'200':
description: "All browse options"
content:
application/json:
schema:
$ref: "./schemas/FilterOptions.yaml#/components/schemas/BrowseOptions"
/metadata:
get:
summary: get massbank metadata
operationId: getMetadata
responses:
'200':
description: "Metadata for database and datasets"
content:
application/json:
schema:
$ref: "./schemas/FilterOptions.yaml#/components/schemas/Metadata"


84 changes: 84 additions & 0 deletions api/schemas/FilterOptions.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
components:
schemas:
StringCount:
type: object
properties:
values:
type: array
items:
type: string
count:
type: integer
minimum: 0
FilterOptions:
type: object
properties:
metadata:
$ref: "#/components/schemas/Metadata"
instrument_type:
type: array
items:
type: string
ms_type:
type: array
items:
type: string
ion_mode:
type: array
items:
type: string
mass:
type: object
properties:
minimum:
type: number
format: double
default: 0
maximum:
type: number
format: double
default: 10000
intensity:
type: object
properties:
minimum:
type: integer
default: 0
maximum:
type: integer
default: 100
max_limit:
type: integer
minimum: 1
BrowseOptions:
type: object
properties:
metadata:
$ref: "#/components/schemas/Metadata"
contributor:
$ref: "#/components/schemas/StringCount"
instrument_type:
$ref: "#/components/schemas/StringCount"
ms_type:
$ref: "#/components/schemas/StringCount"
ion_mode:
$ref: "#/components/schemas/StringCount"
compound_start:
$ref: "#/components/schemas/StringCount"
Metadata:
type: object
properties:
version:
type: string
timestamp:
type: string
git_commit:
type: string
spectra_count:
type: integer
compound_count:
type: integer
isomer_count:
type: integer


6 changes: 6 additions & 0 deletions cmd/mb3server/.openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ src/model_ac_ion_mobility_inner.go
src/model_ac_mass_spec.go
src/model_ac_mass_spec_subtags_inner.go
src/model_authors_inner.go
src/model_browse_options.go
src/model_database_object.go
src/model_filter_options.go
src/model_filter_options_intensity.go
src/model_filter_options_mass.go
src/model_mb_record.go
src/model_mb_record_acquisition.go
src/model_mb_record_comments_inner.go
Expand All @@ -27,8 +31,10 @@ src/model_mb_record_peak_annotation.go
src/model_mb_record_peak_peak.go
src/model_mb_record_peak_peak_values_inner.go
src/model_mb_record_species.go
src/model_metadata.go
src/model_ms_data_processing_inner.go
src/model_ms_focused_ion_inner.go
src/model_search_result_inner.go
src/model_search_result_inner_spectra_inner.go
src/model_string_count.go
src/routers.go
203 changes: 203 additions & 0 deletions cmd/mb3server/api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,13 @@ paths:
schema:
$ref: '#/components/schemas/Limit'
style: form
- explode: true
in: query
name: page
required: false
schema:
$ref: '#/components/schemas/Page'
style: form
- description: "The Instensity cutoff for Peaklist search. Default: 5"
explode: true
in: query
Expand Down Expand Up @@ -159,6 +166,39 @@ paths:
$ref: '#/components/schemas/MBRecord'
description: A MassBank record
summary: Get a MassBank record
/filter/options:
get:
operationId: getFilterOptions
responses:
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/FilterOptions'
description: All Filter options
summary: get filter options
/filter/browse:
get:
operationId: getBrowseOptions
responses:
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/BrowseOptions'
description: All browse options
summary: get browse options
/metadata:
get:
operationId: getMetadata
responses:
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/Metadata'
description: Metadata for database and datasets
summary: get massbank metadata
components:
schemas:
InstrumentType:
Expand Down Expand Up @@ -218,6 +258,10 @@ components:
maximum: 500
minimum: 1
type: integer
Page:
default: 1
minimum: 1
type: integer
IntensityCutoff:
default: 5
maximum: 100
Expand Down Expand Up @@ -402,6 +446,139 @@ components:
- license
- title
type: object
FilterOptions:
example:
intensity:
maximum: 7
minimum: 2
max_limit: 1
metadata:
isomer_count: 1
git_commit: git_commit
compound_count: 6
spectra_count: 0
version: version
timestamp: timestamp
ms_type:
- ms_type
- ms_type
mass:
maximum: 5.637376656633329
minimum: 5.962133916683182
ion_mode:
- ion_mode
- ion_mode
instrument_type:
- instrument_type
- instrument_type
properties:
metadata:
$ref: '#/components/schemas/Metadata'
instrument_type:
items:
type: string
type: array
ms_type:
items:
type: string
type: array
ion_mode:
items:
type: string
type: array
mass:
$ref: '#/components/schemas/FilterOptions_mass'
intensity:
$ref: '#/components/schemas/FilterOptions_intensity'
max_limit:
minimum: 1
type: integer
type: object
Metadata:
example:
isomer_count: 1
git_commit: git_commit
compound_count: 6
spectra_count: 0
version: version
timestamp: timestamp
properties:
version:
type: string
timestamp:
type: string
git_commit:
type: string
spectra_count:
type: integer
compound_count:
type: integer
isomer_count:
type: integer
type: object
BrowseOptions:
example:
metadata:
isomer_count: 1
git_commit: git_commit
compound_count: 6
spectra_count: 0
version: version
timestamp: timestamp
compound_start:
values:
- values
- values
count: 0
contributor:
values:
- values
- values
count: 0
ms_type:
values:
- values
- values
count: 0
ion_mode:
values:
- values
- values
count: 0
instrument_type:
values:
- values
- values
count: 0
properties:
metadata:
$ref: '#/components/schemas/Metadata'
contributor:
$ref: '#/components/schemas/StringCount'
instrument_type:
$ref: '#/components/schemas/StringCount'
ms_type:
$ref: '#/components/schemas/StringCount'
ion_mode:
$ref: '#/components/schemas/StringCount'
compound_start:
$ref: '#/components/schemas/StringCount'
type: object
StringCount:
example:
values:
- values
- values
count: 0
properties:
values:
items:
type: string
type: array
count:
minimum: 0
type: integer
type: object
Authors:
items:
$ref: '#/components/schemas/Authors_inner'
Expand Down Expand Up @@ -880,6 +1057,32 @@ components:
- peak
- splash
type: object
FilterOptions_mass:
example:
maximum: 5.637376656633329
minimum: 5.962133916683182
properties:
minimum:
default: 0
format: double
type: number
maximum:
default: 10000
format: double
type: number
type: object
FilterOptions_intensity:
example:
maximum: 7
minimum: 2
properties:
minimum:
default: 0
type: integer
maximum:
default: 100
type: integer
type: object
Authors_inner:
description: Name of the author or affiliation
example:
Expand Down
Loading

0 comments on commit 30bfca9

Please sign in to comment.