flexmeasures.api.v3_0.sources
Functions
- flexmeasures.api.v3_0.sources.source_search_term_filter(term: str)
Match a search term against what identifies a source: its name, its model and its id.
Classes
- class flexmeasures.api.v3_0.sources.SourceAPI
- get(id: int)
Get one data source, including its attributes.
— get:
summary: Get one data source. description: |
Returns the full record of one data source, including the attributes in which data generators (such as forecasters, schedulers and reporters) store their configuration.
A source is readable when it belongs to an organisation the user may read, when an automation they may read computes under it, or when it has recorded data on a sensor they may read, so that they can ask what computed a number they see.
The
attributes, which hold the configuration a data generator was set up with, are only included for the first two: a configuration names the sensors it runs on, which can be sensors the user cannot see at all.- security:
ApiKeyAuth: []
- parameters:
in: path name: id required: true description: ID of the data source. schema:
type: integer
- responses:
- 200:
description: PROCESSED content:
- application/json:
- example:
id: 6 name: Seita type: forecaster model: TrainPredictPipeline version: “1” description: “Seita’s TrainPredictPipeline model v1” account_id: 2 user_id: null attributes:
- data_generator:
- config:
model: CustomLGBM
- 401:
description: UNAUTHORIZED
- 403:
description: INVALID_SENDER
- 404:
description: NOT_FOUND
- tags:
Sources
- index(only_latest: bool = True, filter: list[str] | None = None, type: str | None = None, limit: int | None = None)
List accessible data sources and defined source types.
— get:
summary: List accessible data sources and defined source types. description: |
Returns the list of data sources accessible to the current user and the defined source types.
The
filterparameter searches the sources by name, by model and by id prefix, thetypeparameter narrows the list to one source type, such asforecaster, and thelimitparameter returns only the most recently created ones.The
typesin the response are those of every source this listing can hold, rather than only those of the sources this call returns, so that one call can both search the sources and offer the types to search by.Access rules:
This lists the sources which are the user’s to work with, which is what a source has to be to be reused. That is a stricter rule than the one for reading one source with
GET /api/v3_0/sources/<id>, which also covers a source that recorded data on a sensor the user may read.Admins see all data sources.
Everyone else sees the sources of their own organisation, of any organisation they consult for, and the sources an automation they may read computes under.
A source which belongs to no organisation is not listed for that reason alone.
- security:
ApiKeyAuth: []
- parameters:
in: query schema: SourceQuerySchema
- responses:
- 200:
description: PROCESSED content:
- application/json:
- example:
- types:
user
scheduler
forecaster
reporter
demo script
gateway
market
- sources:
id: 1 name: Seita type: scheduler model: StorageScheduler version: “1.0” description: “Seita’s StorageScheduler model v1.0” account_id: 2
- 401:
description: UNAUTHORIZED
- 403:
description: INVALID_SENDER
- tags:
Sources
- class flexmeasures.api.v3_0.sources.SourceQuerySchema(*, only: Sequence[str] | AbstractSet[str] | None = None, exclude: Sequence[str] | AbstractSet[str] = (), many: bool | None = None, load_only: Sequence[str] | AbstractSet[str] = (), dump_only: Sequence[str] | AbstractSet[str] = (), partial: bool | Sequence[str] | AbstractSet[str] | None = None, unknown: Literal['exclude', 'include', 'raise'] | None = None)