megaqc.rest_api package

Submodules

megaqc.rest_api.content module

Utilities to help with content negotiation.

megaqc.rest_api.content.flatten_dicts(dictionary, delim='.', _path=None)[source]

Flattens a nested JSON dictionary into a flat dictionary, but does NOT flatten any lists in the structure.

Parameters
  • dictionary – Dictionary to flatten

  • delim – The delimiter for nested fields

megaqc.rest_api.content.json_to_csv(json, **writer_opts)[source]

megaqc.rest_api.fields module

class megaqc.rest_api.fields.FilterReference(*args, **kwargs)[source]

Bases: megaqc.rest_api.fields.ModelAssociation

Dumps as a SampleFilter foreign key, e.g. “3”, and loads as a filter array.

class megaqc.rest_api.fields.JsonString(*args, invert=False, **kwargs)[source]

Bases: marshmallow.fields.Field

Serializes a JSON structure as JSON, but deserializes it as a string (for DB storage), or vice-versa.

class megaqc.rest_api.fields.ModelAssociation(model, *args, **kwargs)[source]

Bases: marshmallow.fields.Field

Dumps as a foreign key, e.g. “3”, and loads as a model instance, e.g. User.

megaqc.rest_api.filters module

megaqc.rest_api.filters.add_operator(lhs, op, rhs)[source]

Returns an SQLAlchemy expression comparing two values.

megaqc.rest_api.filters.build_filter_query(filters)[source]

Returns an SQLAlchemy query with the provided filters applied. This filter will only select Sample IDs that meet the filter, so you should only use this as a subquery.

Parameters

filters (list) – Array of filters in the MegaQC filter format (each filter is a dictionary)

Return type

Query

megaqc.rest_api.filters.concat_clauses(clauses, operator)[source]

Combines a list of SQL clauses using the provided operator.

Parameters

operator (str) – “and” or “or”

megaqc.rest_api.filters.round_date(date, direction)[source]

megaqc.rest_api.outlier module

class megaqc.rest_api.outlier.GrubbsDetector(threshold=None)[source]

Bases: megaqc.rest_api.outlier.OutlierDetector

get_outliers(y)[source]

Returns a boolean “mask array” that can be used to select outliers.

class megaqc.rest_api.outlier.OutlierDetector(threshold=None)[source]

Bases: object

get_outliers(y)[source]

Returns a boolean “mask array” that can be used to select outliers.

class megaqc.rest_api.outlier.ZScoreDetector(threshold=None)[source]

Bases: megaqc.rest_api.outlier.OutlierDetector

get_outliers(y)[source]

Returns a boolean “mask array” that can be used to select outliers.

megaqc.rest_api.plot module

megaqc.rest_api.plot.encode_to_numeric(y: Iterable, chunk_size: int) → Iterable[numpy.ndarray][source]
megaqc.rest_api.plot.extract_query_data(query: sqlalchemy.orm.query.Query, ncol: int) → Tuple[numpy.ndarray[Any, numpy.dtype[numpy.bytes_]], numpy.ndarray[Any, numpy.dtype[numpy.bytes_]], numpy.ndarray[Any, numpy.dtype[numpy.datetime64]], numpy.ndarray[Any, numpy.dtype[numpy.float64]]][source]
megaqc.rest_api.plot.isolation_forest_trend(query: Any, fields: collections.abc.Sequence[str], plot_prefix: str, statistic_options: dict) → Iterator[dict][source]

Yields plotly series for the “Isolation Forest” statistic.

megaqc.rest_api.plot.maha_distance(y, alpha=0.05)[source]
megaqc.rest_api.plot.rgb_to_rgba(rgb, alpha)[source]

Appends an alpha (transparency) value to an RGB string.

megaqc.rest_api.plot.trend_data(fields: collections.abc.Sequence[str], filter: Any, statistic: str, **kwargs) → Iterator[dict][source]

Returns data suitable for a plotly plot.

megaqc.rest_api.plot.univariate_trend_data(query: Any, fields: collections.abc.Sequence[str], plot_prefix: str, statistic_options: dict) → Iterator[dict][source]

Returns the plot series for the “raw measurement” statistic.

megaqc.rest_api.schemas module

These schemas describe the format of the web requests to and from the API.

They incidentally share most fields with the database models, but they can be opinionated about REST-specific fields

class megaqc.rest_api.schemas.ControlLimitSchema(*, only: types.StrSequenceOrSet | None = None, exclude: types.StrSequenceOrSet = (), many: bool = False, context: dict | None = None, load_only: types.StrSequenceOrSet = (), dump_only: types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet = False, unknown: str | None = None)[source]

Bases: marshmallow.schema.Schema

Defines “control limits” for a control chart.

opts = <marshmallow.schema.SchemaOpts object>[source]
class megaqc.rest_api.schemas.DashboardSchema(use_links=True, *args, **kwargs)[source]

Bases: megaqc.rest_api.schemas.OptionalLinkSchema

class Meta[source]

Bases: object

model[source]

alias of megaqc.model.models.Dashboard

self_url = None[source]
self_url_kwargs = None[source]
self_url_many = None[source]
sqla_session = <sqlalchemy.orm.scoping.scoped_session object>[source]
type_ = 'dashboards'[source]
opts = <marshmallow_jsonapi.flask.SchemaOpts object>[source]
class megaqc.rest_api.schemas.FavouritePlotSchema(use_links=True, *args, **kwargs)[source]

Bases: megaqc.rest_api.schemas.OptionalLinkSchema

class Meta[source]

Bases: object

model[source]

alias of megaqc.model.models.PlotFavourite

self_url = 'rest_api.favouriteplot'[source]
self_url_kwargs = {'id': '<id>'}[source]
self_url_many = None[source]
self_view = 'rest_api.favouriteplot'[source]
self_view_kwargs = {'id': '<id>'}[source]
sqla_session = <sqlalchemy.orm.scoping.scoped_session object>[source]
type_ = 'favourites'[source]
opts = <marshmallow_jsonapi.flask.SchemaOpts object>[source]
class megaqc.rest_api.schemas.FilterGroupSchema(use_links=True, *args, **kwargs)[source]

Bases: megaqc.rest_api.schemas.OptionalLinkSchema

Fake schema (no underlying model) for filter groups, which dump from a filter object.

class Meta[source]

Bases: object

model[source]

alias of megaqc.model.models.SampleFilter

self_url = None[source]
self_url_kwargs = None[source]
self_url_many = None[source]
sqla_session = <sqlalchemy.orm.scoping.scoped_session object>[source]
type_ = 'filter_groups'[source]
opts = <marshmallow_jsonapi.flask.SchemaOpts object>[source]
class megaqc.rest_api.schemas.FilterObjectSchema(*, only: types.StrSequenceOrSet | None = None, exclude: types.StrSequenceOrSet = (), many: bool = False, context: dict | None = None, load_only: types.StrSequenceOrSet = (), dump_only: types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet = False, unknown: str | None = None)[source]

Bases: marshmallow.schema.Schema

A single filter object, e.g. { ‘type’: ‘daterange’, ‘value’: [], ‘cmp’:

‘in’ }

opts = <marshmallow.schema.SchemaOpts object>[source]
class megaqc.rest_api.schemas.IsolationForestSchema(*, only: types.StrSequenceOrSet | None = None, exclude: types.StrSequenceOrSet = (), many: bool = False, context: dict | None = None, load_only: types.StrSequenceOrSet = (), dump_only: types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet = False, unknown: str | None = None)[source]

Bases: marshmallow.schema.Schema

Schema for the isolation forest statistic option.

opts = <marshmallow.schema.SchemaOpts object>[source]
class megaqc.rest_api.schemas.OptionalLinkSchema(use_links=True, *args, **kwargs)[source]

Bases: marshmallow_jsonapi.flask.Schema

Hook for adding links to a resource object.

opts = <marshmallow_jsonapi.flask.SchemaOpts object>[source]
remove_empty_id(item, **kwargs)[source]

Hack to deal with empty ID field that has to be sent.

class megaqc.rest_api.schemas.PlotSchema(*args, **kwargs)[source]

Bases: marshmallow_jsonapi.flask.Schema

Data that can be used to generate a plot.

class Meta[source]

Bases: object

self_url = None[source]
self_url_kwargs = None[source]
self_url_many = None[source]
type_ = 'plots'[source]
unknown = 'include'[source]
opts = <marshmallow_jsonapi.flask.SchemaOpts object>[source]
class megaqc.rest_api.schemas.RawMeasurementSchema(*, only: types.StrSequenceOrSet | None = None, exclude: types.StrSequenceOrSet = (), many: bool = False, context: dict | None = None, load_only: types.StrSequenceOrSet = (), dump_only: types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet = False, unknown: str | None = None)[source]

Bases: marshmallow.schema.Schema

For when the user has chosen the raw measurement option.

opts = <marshmallow.schema.SchemaOpts object>[source]
class megaqc.rest_api.schemas.Relationship(related_view=None, related_view_kwargs=None, *, self_view=None, self_view_kwargs=None, **kwargs)[source]

Bases: marshmallow_jsonapi.flask.Relationship

class megaqc.rest_api.schemas.ReportMetaSchema(use_links=True, *args, **kwargs)[source]

Bases: megaqc.rest_api.schemas.OptionalLinkSchema

class Meta[source]

Bases: object

model[source]

alias of megaqc.model.models.ReportMeta

self_url = None[source]
self_url_kwargs = None[source]
self_url_many = None[source]
sqla_session = <sqlalchemy.orm.scoping.scoped_session object>[source]
type_ = 'report_meta'[source]
opts = <marshmallow_jsonapi.flask.SchemaOpts object>[source]
class megaqc.rest_api.schemas.ReportMetaTypeSchema(use_links=True, *args, **kwargs)[source]

Bases: megaqc.rest_api.schemas.OptionalLinkSchema

This is an artificial type that doesn’t have a backing model.

class Meta[source]

Bases: object

model[source]

alias of megaqc.model.models.ReportMeta

self_url = None[source]
self_url_kwargs = None[source]
self_url_many = None[source]
sqla_session = <sqlalchemy.orm.scoping.scoped_session object>[source]
type_ = 'report_meta_types'[source]
opts = <marshmallow_jsonapi.flask.SchemaOpts object>[source]
class megaqc.rest_api.schemas.ReportSchema(use_links=True, *args, **kwargs)[source]

Bases: megaqc.rest_api.schemas.OptionalLinkSchema

This is an abstraction of Report + ReportMeta.

class Meta[source]

Bases: object

model[source]

alias of megaqc.model.models.Report

self_url = 'rest_api.report'[source]
self_url_kwargs = {'id': '<id>'}[source]
self_url_many = 'rest_api.reportlist'[source]
self_view = 'rest_api.report'[source]
self_view_kwargs = {'id': '<id>'}[source]
self_view_many = 'rest_api.reportlist'[source]
sqla_session = <sqlalchemy.orm.scoping.scoped_session object>[source]
strict = True[source]
type_ = 'reports'[source]
opts = <marshmallow_jsonapi.flask.SchemaOpts object>[source]
class megaqc.rest_api.schemas.SampleDataSchema(use_links=True, *args, **kwargs)[source]

Bases: megaqc.rest_api.schemas.OptionalLinkSchema

class Meta[source]

Bases: object

model[source]

alias of megaqc.model.models.SampleData

self_url = None[source]
self_url_kwargs = None[source]
self_url_many = None[source]
sqla_session = <sqlalchemy.orm.scoping.scoped_session object>[source]
type_ = 'sample_data'[source]
opts = <marshmallow_jsonapi.flask.SchemaOpts object>[source]
class megaqc.rest_api.schemas.SampleDataTypeSchema(use_links=True, *args, **kwargs)[source]

Bases: megaqc.rest_api.schemas.OptionalLinkSchema

class Meta[source]

Bases: object

model[source]

alias of megaqc.model.models.SampleDataType

self_url = None[source]
self_url_kwargs = None[source]
self_url_many = None[source]
sqla_session = <sqlalchemy.orm.scoping.scoped_session object>[source]
type_ = 'data_types'[source]
opts = <marshmallow_jsonapi.flask.SchemaOpts object>[source]
class megaqc.rest_api.schemas.SampleFilterSchema(use_links=True, *args, **kwargs)[source]

Bases: megaqc.rest_api.schemas.OptionalLinkSchema

class Meta[source]

Bases: object

model[source]

alias of megaqc.model.models.SampleFilter

self_url = 'rest_api.filter'[source]
self_url_kwargs = {'id': '<id>'}[source]
self_url_many = 'rest_api.filterlist'[source]
self_view = 'rest_api.filter'[source]
self_view_kwargs = {'id': '<id>'}[source]
self_view_many = 'rest_api.filterlist'[source]
sqla_session = <sqlalchemy.orm.scoping.scoped_session object>[source]
type_ = 'filters'[source]
opts = <marshmallow_jsonapi.flask.SchemaOpts object>[source]
class megaqc.rest_api.schemas.SampleSchema(use_links=True, *args, **kwargs)[source]

Bases: megaqc.rest_api.schemas.OptionalLinkSchema

class Meta[source]

Bases: object

model[source]

alias of megaqc.model.models.Sample

self_url = 'rest_api.sample'[source]
self_url_kwargs = {'id': '<id>'}[source]
self_url_many = 'rest_api.samplelist'[source]
self_view = 'rest_api.sample'[source]
self_view_kwargs = {'id': '<id>'}[source]
self_view_many = 'rest_api.samplelist'[source]
sqla_session = <sqlalchemy.orm.scoping.scoped_session object>[source]
type_ = 'samples'[source]
opts = <marshmallow_jsonapi.flask.SchemaOpts object>[source]
megaqc.rest_api.schemas.Schema[source]

alias of megaqc.rest_api.schemas.OptionalLinkSchema

class megaqc.rest_api.schemas.TrendInputSchema(*, only: types.StrSequenceOrSet | None = None, exclude: types.StrSequenceOrSet = (), many: bool = False, context: dict | None = None, load_only: types.StrSequenceOrSet = (), dump_only: types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet = False, unknown: str | None = None)[source]

Bases: marshmallow.schema.Schema

Schema for the request for trend data (not the response)

opts = <marshmallow.schema.SchemaOpts object>[source]
class megaqc.rest_api.schemas.TrendSchema(*args, **kwargs)[source]

Bases: megaqc.rest_api.schemas.PlotSchema

Data that can be used to generate a trend plot.

opts = <marshmallow_jsonapi.flask.SchemaOpts object>[source]
class megaqc.rest_api.schemas.UploadSchema(use_links=True, *args, **kwargs)[source]

Bases: megaqc.rest_api.schemas.OptionalLinkSchema

class Meta[source]

Bases: object

model[source]

alias of megaqc.model.models.Upload

self_url = 'rest_api.upload'[source]
self_url_kwargs = {'id': '<id>'}[source]
self_url_many = 'rest_api.uploadlist'[source]
self_view = 'rest_api.upload'[source]
self_view_kwargs = {'id': '<id>'}[source]
self_view_many = 'rest_api.uploadlist'[source]
sqla_session = <sqlalchemy.orm.scoping.scoped_session object>[source]
strict = True[source]
type_ = 'uploads'[source]
opts = <marshmallow_jsonapi.flask.SchemaOpts object>[source]
class megaqc.rest_api.schemas.UserSchema(use_links=True, *args, **kwargs)[source]

Bases: megaqc.rest_api.schemas.OptionalLinkSchema

class Meta[source]

Bases: object

model[source]

alias of megaqc.user.models.User

self_url = 'rest_api.user'[source]
self_url_kwargs = {'id': '<id>'}[source]
self_url_many = None[source]
self_view = 'rest_api.user'[source]
self_view_kwargs = {'id': '<id>'}[source]
sqla_session = <sqlalchemy.orm.scoping.scoped_session object>[source]
type_ = 'users'[source]
opts = <marshmallow_jsonapi.flask.SchemaOpts object>[source]

megaqc.rest_api.utils module

class megaqc.rest_api.utils.Permission(value)[source]

Bases: enum.IntEnum

An enumeration.

ADMIN = 3[source]
NONUSER = 1[source]
USER = 2[source]
megaqc.rest_api.utils.api_perms(min_level: megaqc.rest_api.utils.Permission = <Permission.NONUSER: 1>)[source]

Adds a “user” and “permission” kwarg to the view function. Also verifies a minimum permissions level.

Parameters

min_level – If provided, this is the minimum permission level required by this endpoint

megaqc.rest_api.utils.get_unique_filename()[source]
megaqc.rest_api.utils.get_upload_dir()[source]

megaqc.rest_api.views module

Location of a rewritten API in a RESTful style, with appropriate resources Following the JSON API standard where relevant: https://jsonapi.org/format/

class megaqc.rest_api.views.CurrentUser(*args, **kwargs)[source]

Bases: megaqc.rest_api.views.PermissionsMixin, flapison.resource.ResourceDetail

data_layer = {'model': <class 'megaqc.user.models.User'>, 'session': <sqlalchemy.orm.scoping.scoped_session object>}[source]
decorators = ()[source]
get(**kwargs)[source]

Get details about the current user.

This is also how the frontend can get an access token. For that reason, this endpoint is authenticated using the session, NOT the access token

methods = {'DELETE', 'GET', 'PATCH', 'POST'}[source]
schema[source]

alias of megaqc.rest_api.schemas.UserSchema

view = 'rest_api.currentuser'[source]
class megaqc.rest_api.views.Dashboard(*args, **kwargs)[source]

Bases: megaqc.rest_api.views.PermissionsMixin, flapison.resource.ResourceDetail

data_layer = {'model': <class 'megaqc.model.models.Dashboard'>, 'session': <sqlalchemy.orm.scoping.scoped_session object>}[source]
decorators = ()[source]
methods = {'DELETE', 'GET', 'PATCH', 'POST'}[source]
schema[source]

alias of megaqc.rest_api.schemas.DashboardSchema

view = 'rest_api.dashboard'[source]
class megaqc.rest_api.views.DashboardList(*args, **kwargs)[source]

Bases: megaqc.rest_api.views.PermissionsMixin, flapison.resource.ResourceList

data_layer = {'model': <class 'megaqc.model.models.Dashboard'>, 'session': <sqlalchemy.orm.scoping.scoped_session object>}[source]
decorators = ()[source]
methods = {'DELETE', 'GET', 'PATCH', 'POST'}[source]
schema[source]

alias of megaqc.rest_api.schemas.DashboardSchema

view = 'rest_api.user_dashboardlist'[source]
view_kwargs = True[source]
class megaqc.rest_api.views.DashboardRelationship(*args, **kwargs)[source]

Bases: megaqc.rest_api.views.PermissionsMixin, flapison.resource.ResourceList

data_layer = {'model': <class 'megaqc.model.models.Dashboard'>, 'session': <sqlalchemy.orm.scoping.scoped_session object>}[source]
decorators = ()[source]
methods = {'DELETE', 'GET', 'PATCH', 'POST'}[source]
schema[source]

alias of megaqc.rest_api.schemas.DashboardSchema

view = 'rest_api.user_dashboards_rel'[source]
view_kwargs = True[source]
class megaqc.rest_api.views.DataType(*args, **kwargs)[source]

Bases: megaqc.rest_api.views.PermissionsMixin, flapison.resource.ResourceDetail

data_layer = {'model': <class 'megaqc.model.models.SampleDataType'>, 'session': <sqlalchemy.orm.scoping.scoped_session object>}[source]
decorators = ()[source]
methods = {'DELETE', 'GET', 'PATCH', 'POST'}[source]
schema[source]

alias of megaqc.rest_api.schemas.SampleDataTypeSchema

view = 'rest_api.datatype'[source]
class megaqc.rest_api.views.DataTypeList(*args, **kwargs)[source]

Bases: megaqc.rest_api.views.PermissionsMixin, flapison.resource.ResourceList

data_layer = {'model': <class 'megaqc.model.models.SampleDataType'>, 'session': <sqlalchemy.orm.scoping.scoped_session object>}[source]
decorators = ()[source]
methods = {'DELETE', 'GET', 'PATCH', 'POST'}[source]
schema[source]

alias of megaqc.rest_api.schemas.SampleDataTypeSchema

view = 'rest_api.datatypelist'[source]
view_kwargs = True[source]
class megaqc.rest_api.views.FavouritePlot(*args, **kwargs)[source]

Bases: megaqc.rest_api.views.PermissionsMixin, flapison.resource.ResourceDetail

data_layer = {'model': <class 'megaqc.model.models.PlotFavourite'>, 'session': <sqlalchemy.orm.scoping.scoped_session object>}[source]
decorators = ()[source]
methods = {'DELETE', 'GET', 'PATCH', 'POST'}[source]
schema[source]

alias of megaqc.rest_api.schemas.FavouritePlotSchema

view = 'rest_api.favouriteplot'[source]
class megaqc.rest_api.views.FavouritePlotList(*args, **kwargs)[source]

Bases: megaqc.rest_api.views.PermissionsMixin, flapison.resource.ResourceList

data_layer = {'model': <class 'megaqc.model.models.PlotFavourite'>, 'session': <sqlalchemy.orm.scoping.scoped_session object>}[source]
decorators = ()[source]
methods = {'DELETE', 'GET', 'PATCH', 'POST'}[source]
schema[source]

alias of megaqc.rest_api.schemas.FavouritePlotSchema

view = 'rest_api.user_favouriteplotlist'[source]
view_kwargs = True[source]
class megaqc.rest_api.views.FavouritePlotRelationship(*args, **kwargs)[source]

Bases: megaqc.rest_api.views.PermissionsMixin, flapison.resource.ResourceRelationship

data_layer = {'model': <class 'megaqc.model.models.PlotFavourite'>, 'session': <sqlalchemy.orm.scoping.scoped_session object>}[source]
decorators = ()[source]
methods = {'DELETE', 'GET', 'PATCH', 'POST'}[source]
schema[source]

alias of megaqc.rest_api.schemas.FavouritePlotSchema

view = 'rest_api.user_favourites_rel'[source]
class megaqc.rest_api.views.Filter(*args, **kwargs)[source]

Bases: megaqc.rest_api.views.PermissionsMixin, flapison.resource.ResourceDetail

data_layer = {'model': <class 'megaqc.model.models.SampleFilter'>, 'session': <sqlalchemy.orm.scoping.scoped_session object>}[source]
decorators = ()[source]
methods = {'DELETE', 'GET', 'PATCH', 'POST'}[source]
schema[source]

alias of megaqc.rest_api.schemas.SampleFilterSchema

view = 'rest_api.filter'[source]
class megaqc.rest_api.views.FilterGroupList(*args, **kwargs)[source]

Bases: megaqc.rest_api.views.PermissionsMixin, flapison.resource.ResourceList

data_layer = {'model': <class 'megaqc.model.models.SampleFilter'>, 'session': <sqlalchemy.orm.scoping.scoped_session object>}[source]
decorators = ()[source]
get_collection(qs, kwargs, filters=None)[source]
methods = {'DELETE', 'GET', 'PATCH', 'POST'}[source]
schema[source]

alias of megaqc.rest_api.schemas.FilterGroupSchema

view = 'rest_api.filtergrouplist'[source]
view_kwargs = True[source]
class megaqc.rest_api.views.FilterList(*args, **kwargs)[source]

Bases: megaqc.rest_api.views.PermissionsMixin, flapison.resource.ResourceList

data_layer = {'model': <class 'megaqc.model.models.SampleFilter'>, 'session': <sqlalchemy.orm.scoping.scoped_session object>}[source]
decorators = ()[source]
methods = {'DELETE', 'GET', 'PATCH', 'POST'}[source]
schema[source]

alias of megaqc.rest_api.schemas.SampleFilterSchema

view = 'rest_api.user_filterlist'[source]
view_kwargs = True[source]
class megaqc.rest_api.views.FilterRelationship(*args, **kwargs)[source]

Bases: megaqc.rest_api.views.PermissionsMixin, flapison.resource.ResourceRelationship

data_layer = {'model': <class 'megaqc.model.models.SampleFilter'>, 'session': <sqlalchemy.orm.scoping.scoped_session object>}[source]
decorators = ()[source]
methods = {'DELETE', 'GET', 'PATCH', 'POST'}[source]
schema[source]

alias of megaqc.rest_api.schemas.SampleFilterSchema

class megaqc.rest_api.views.PermissionsMixin[source]

Bases: object

Adds shared config to all views.

Logged-out users shouldn’t be able to access the API at all, logged in users should be able to only GET, and only admins should be able to POST, PATCH or DELETE. These decorators can be overriden by child classes, however

delete(**kwargs)[source]
get(**kwargs)[source]
patch(**kwargs)[source]
post(**kwargs)[source]
class megaqc.rest_api.views.Report(*args, **kwargs)[source]

Bases: megaqc.rest_api.views.PermissionsMixin, flapison.resource.ResourceDetail

data_layer = {'model': <class 'megaqc.model.models.Report'>, 'session': <sqlalchemy.orm.scoping.scoped_session object>}[source]
decorators = ()[source]
methods = {'DELETE', 'GET', 'PATCH', 'POST'}[source]
schema[source]

alias of megaqc.rest_api.schemas.ReportSchema

view = 'rest_api.report'[source]
class megaqc.rest_api.views.ReportList(*args, **kwargs)[source]

Bases: megaqc.rest_api.views.PermissionsMixin, flapison.resource.ResourceList

data_layer = {'model': <class 'megaqc.model.models.Report'>, 'session': <sqlalchemy.orm.scoping.scoped_session object>}[source]
decorators = ()[source]
methods = {'DELETE', 'GET', 'PATCH', 'POST'}[source]
schema[source]

alias of megaqc.rest_api.schemas.ReportSchema

view = 'rest_api.user_reportlist'[source]
view_kwargs = True[source]
class megaqc.rest_api.views.ReportMeta(*args, **kwargs)[source]

Bases: megaqc.rest_api.views.PermissionsMixin, flapison.resource.ResourceDetail

data_layer = {'model': <class 'megaqc.model.models.ReportMeta'>, 'session': <sqlalchemy.orm.scoping.scoped_session object>}[source]
decorators = ()[source]
methods = {'DELETE', 'GET', 'PATCH', 'POST'}[source]
schema[source]

alias of megaqc.rest_api.schemas.ReportMetaSchema

view = 'rest_api.reportmeta'[source]
view_kwargs = True[source]
class megaqc.rest_api.views.ReportMetaList(*args, **kwargs)[source]

Bases: megaqc.rest_api.views.PermissionsMixin, flapison.resource.ResourceList

data_layer = {'model': <class 'megaqc.model.models.ReportMeta'>, 'session': <sqlalchemy.orm.scoping.scoped_session object>}[source]
decorators = ()[source]
methods = {'DELETE', 'GET', 'PATCH', 'POST'}[source]
schema[source]

alias of megaqc.rest_api.schemas.ReportMetaSchema

view = 'rest_api.report_reportmetalist'[source]
view_kwargs = True[source]
class megaqc.rest_api.views.ReportMetaRelationship(*args, **kwargs)[source]

Bases: megaqc.rest_api.views.PermissionsMixin, flapison.resource.ResourceRelationship

data_layer = {'model': <class 'megaqc.model.models.ReportMeta'>, 'session': <sqlalchemy.orm.scoping.scoped_session object>}[source]
decorators = ()[source]
methods = {'DELETE', 'GET', 'PATCH', 'POST'}[source]
schema[source]

alias of megaqc.rest_api.schemas.ReportMetaSchema

view = 'rest_api.report_reportmeta_rel'[source]
class megaqc.rest_api.views.ReportMetaTypeList(*args, **kwargs)[source]

Bases: megaqc.rest_api.views.PermissionsMixin, flapison.resource.ResourceList

data_layer = {'model': <class 'megaqc.model.models.ReportMeta'>, 'session': <sqlalchemy.orm.scoping.scoped_session object>}[source]
decorators = ()[source]
get_collection(qs, kwargs, filters=None)[source]
methods = {'DELETE', 'GET', 'PATCH', 'POST'}[source]
schema[source]

alias of megaqc.rest_api.schemas.ReportMetaTypeSchema

view = 'rest_api.metatypelist'[source]
view_kwargs = True[source]
class megaqc.rest_api.views.ReportRelationship(*args, **kwargs)[source]

Bases: megaqc.rest_api.views.PermissionsMixin, flapison.resource.ResourceRelationship

data_layer = {'model': <class 'megaqc.model.models.Report'>, 'session': <sqlalchemy.orm.scoping.scoped_session object>}[source]
decorators = ()[source]
methods = {'DELETE', 'GET', 'PATCH', 'POST'}[source]
schema[source]

alias of megaqc.rest_api.schemas.ReportSchema

view = 'rest_api.report_samples_rel'[source]
class megaqc.rest_api.views.Sample(*args, **kwargs)[source]

Bases: megaqc.rest_api.views.PermissionsMixin, flapison.resource.ResourceDetail

data_layer = {'model': <class 'megaqc.model.models.Sample'>, 'session': <sqlalchemy.orm.scoping.scoped_session object>}[source]
decorators = ()[source]
methods = {'DELETE', 'GET', 'PATCH', 'POST'}[source]
schema[source]

alias of megaqc.rest_api.schemas.SampleSchema

view = 'rest_api.sample'[source]
class megaqc.rest_api.views.SampleData(*args, **kwargs)[source]

Bases: megaqc.rest_api.views.PermissionsMixin, flapison.resource.ResourceDetail

data_layer = {'model': <class 'megaqc.model.models.SampleData'>, 'session': <sqlalchemy.orm.scoping.scoped_session object>}[source]
decorators = ()[source]
methods = {'DELETE', 'GET', 'PATCH', 'POST'}[source]
schema[source]

alias of megaqc.rest_api.schemas.SampleDataSchema

view = 'rest_api.sampledata'[source]
view_kwargs = True[source]
class megaqc.rest_api.views.SampleDataList(*args, **kwargs)[source]

Bases: megaqc.rest_api.views.PermissionsMixin, flapison.resource.ResourceList

data_layer = {'model': <class 'megaqc.model.models.SampleData'>, 'session': <sqlalchemy.orm.scoping.scoped_session object>}[source]
decorators = ()[source]
methods = {'DELETE', 'GET', 'PATCH', 'POST'}[source]
schema[source]

alias of megaqc.rest_api.schemas.SampleDataSchema

view = 'rest_api.sample_sampledatalist'[source]
view_kwargs = True[source]
class megaqc.rest_api.views.SampleDataRelationship(*args, **kwargs)[source]

Bases: megaqc.rest_api.views.PermissionsMixin, flapison.resource.ResourceRelationship

data_layer = {'model': <class 'megaqc.model.models.SampleData'>, 'session': <sqlalchemy.orm.scoping.scoped_session object>}[source]
decorators = ()[source]
methods = {'DELETE', 'GET', 'PATCH', 'POST'}[source]
schema[source]

alias of megaqc.rest_api.schemas.SampleDataSchema

view = 'rest_api.sample_sampledata'[source]
class megaqc.rest_api.views.SampleList(*args, **kwargs)[source]

Bases: megaqc.rest_api.views.PermissionsMixin, flapison.resource.ResourceList

data_layer = {'model': <class 'megaqc.model.models.Sample'>, 'session': <sqlalchemy.orm.scoping.scoped_session object>}[source]
decorators = ()[source]
methods = {'DELETE', 'GET', 'PATCH', 'POST'}[source]
schema[source]

alias of megaqc.rest_api.schemas.SampleSchema

view = 'rest_api.report_samplelist'[source]
view_kwargs = True[source]
class megaqc.rest_api.views.SampleRelationship(*args, **kwargs)[source]

Bases: megaqc.rest_api.views.PermissionsMixin, flapison.resource.ResourceRelationship

data_layer = {'model': <class 'megaqc.model.models.Sample'>, 'session': <sqlalchemy.orm.scoping.scoped_session object>}[source]
decorators = ()[source]
methods = {'DELETE', 'GET', 'PATCH', 'POST'}[source]
schema[source]

alias of megaqc.rest_api.schemas.SampleSchema

class megaqc.rest_api.views.TrendSeries(*args, **kwargs)[source]

Bases: megaqc.rest_api.views.PermissionsMixin, flapison.resource.ResourceList

decorators = ()[source]
get(args)[source]

Retrieve a collection of objects

methods = {'DELETE', 'GET', 'PATCH', 'POST'}[source]
view = 'rest_api.trend_data'[source]
class megaqc.rest_api.views.Upload(*args, **kwargs)[source]

Bases: megaqc.rest_api.views.PermissionsMixin, flapison.resource.ResourceDetail

data_layer = {'model': <class 'megaqc.model.models.Upload'>, 'session': <sqlalchemy.orm.scoping.scoped_session object>}[source]
decorators = ()[source]
methods = {'DELETE', 'GET', 'PATCH', 'POST'}[source]
schema[source]

alias of megaqc.rest_api.schemas.UploadSchema

view = 'rest_api.upload'[source]
class megaqc.rest_api.views.UploadList(*args, **kwargs)[source]

Bases: megaqc.rest_api.views.PermissionsMixin, flapison.resource.ResourceList

data_layer = {'model': <class 'megaqc.model.models.Upload'>, 'session': <sqlalchemy.orm.scoping.scoped_session object>}[source]
decorators = ()[source]
get_schema_kwargs(args, kwargs)[source]
methods = {'DELETE', 'GET', 'PATCH', 'POST'}[source]
post(**kwargs)[source]

Upload a new report.

This is rare in that average users can do this, even though they aren’t allowed to edit arbitrary data

request_parsers = {'multipart/form-data': <function UploadList.<lambda>>}[source]
schema[source]

alias of megaqc.rest_api.schemas.UploadSchema

view = 'rest_api.user_uploadlist'[source]
view_kwargs = True[source]
class megaqc.rest_api.views.UploadRelationship(*args, **kwargs)[source]

Bases: megaqc.rest_api.views.PermissionsMixin, flapison.resource.ResourceRelationship

data_layer = {'model': <class 'megaqc.model.models.Upload'>, 'session': <sqlalchemy.orm.scoping.scoped_session object>}[source]
decorators = ()[source]
methods = {'DELETE', 'GET', 'PATCH', 'POST'}[source]
schema[source]

alias of megaqc.rest_api.schemas.UploadSchema

view = 'rest_api.userupload'[source]
class megaqc.rest_api.views.User(*args, **kwargs)[source]

Bases: megaqc.rest_api.views.PermissionsMixin, flapison.resource.ResourceDetail

data_layer = {'model': <class 'megaqc.user.models.User'>, 'session': <sqlalchemy.orm.scoping.scoped_session object>}[source]
decorators = ()[source]
methods = {'DELETE', 'GET', 'PATCH', 'POST'}[source]
schema[source]

alias of megaqc.rest_api.schemas.UserSchema

view = 'rest_api.user'[source]
class megaqc.rest_api.views.UserList(*args, **kwargs)[source]

Bases: flapison.resource.ResourceList

create_object(data, kwargs)[source]
data_layer = {'model': <class 'megaqc.user.models.User'>, 'session': <sqlalchemy.orm.scoping.scoped_session object>}[source]
decorators = ()[source]
get(**kwargs)[source]

Retrieve a collection of objects

get_schema_kwargs(args, kwargs)[source]
methods = {'GET', 'POST'}[source]
post(**kwargs)[source]

Create an object

post_schema_kwargs(args, kwargs)[source]
schema[source]

alias of megaqc.rest_api.schemas.UserSchema

view = 'rest_api.userlist'[source]
view_kwargs = True[source]
class megaqc.rest_api.views.UserRelationship(*args, **kwargs)[source]

Bases: megaqc.rest_api.views.PermissionsMixin, flapison.resource.ResourceRelationship

data_layer = {'model': <class 'megaqc.user.models.User'>, 'session': <sqlalchemy.orm.scoping.scoped_session object>}[source]
decorators = ()[source]
methods = {'DELETE', 'GET', 'PATCH', 'POST'}[source]
schema[source]

alias of megaqc.rest_api.schemas.UserSchema

view = 'rest_api.user_filters_rel'[source]

megaqc.rest_api.webarg_parser module

class megaqc.rest_api.webarg_parser.NestedQueryFlaskParser(locations=None, error_handler=None, schema_class=None)[source]

Bases: webargs.flaskparser.FlaskParser

parse_querystring(req, name, field)[source]

Pull a querystring value from the request.

Module contents