Note
This is a public alpha release, and therefore features and functionality may change and the software and documentation may contain technical bugs or other issues. If you discover any issues please consider registering a GitHub issue.
api.views.datasources module¶
This module contains the API endpoint viewset defining the PEDASI Application API.
-
class
api.views.datasources.DataSourceApiViewset(**kwargs)[source]¶ Bases:
rest_framework.viewsets.ReadOnlyModelViewSetProvides views for:
- /api/datasources/
- List all
datasources.models.DataSources. - /api/datasources/<int>/
- Retrieve a single
datasources.models.DataSource. - /api/datasources/<int>/prov/
- Retrieve PROV records related to a
datasources.models.DataSource. - /api/datasources/<int>/metadata/
- Retrieve
datasources.models.DataSourcemetadata via API call to data source URL. - /api/datasources/<int>/data/
- Retrieve
datasources.models.DataSourcedata via API call to data source URL. - /api/datasources/<int>/datasets/
- Retrieve
datasources.models.DataSourcelist of data sets via API call to data source URL. - /api/datasources/<int>/datasets/<href>/metadata/
- Retrieve
datasources.models.DataSourcemetadata for a single dataset via API call to data source URL. - /api/datasources/<int>/datasets/<href>/metadata/
- Retrieve
datasources.models.DataSourcedata for a single dataset via API call to data source URL.
-
data(request, pk=None)[source]¶ View for /api/datasources/<int>/data/
Retrieve
DataSourcedata via API call to data source URL.
-
dataset_data(request, pk=None, **kwargs)[source]¶ View for /api/datasources/<int>/datasets/<href>/data/
Retrieve
DataSourcedata for a single dataset via API call to data source URL.
-
dataset_metadata(request, pk=None, **kwargs)[source]¶ View for /api/datasources/<int>/datasets/<href>/metadata/
Retrieve
DataSourcemetadata for a single dataset via API call to data source URL.
-
datasets(request, pk=None)[source]¶ View for /api/datasources/<int>/datasets/
Retrieve
DataSourcelist of data sets via API call to data source URL.
-
list(request, *args, **kwargs)[source]¶ List the queryset after filtering by request query parameters for data source metadata.
-
metadata(request, pk=None)[source]¶ View for /api/datasources/<int>/metadata/
Retrieve
DataSourcemetadata via API call to data source URL.
-
permission_classes= [<class 'api.permissions.ViewPermission'>]¶
-
post_data(request: rest_framework.request.Request, pk=None)[source]¶ Add data to this data source. Only applicable to internal data sources.
Data can be added either as JSON body text or as a POSTed CSV file.
-
prov(request, pk=None)[source]¶ View for /api/datasources/<int>/prov/
Retrieve PROV records related to a
DataSource.
-
queryset¶
-
serializer_class¶
-
try_passthrough_response(map_response: Callable[[...], django.http.response.HttpResponse], error_message: str, dataset: str = None) → django.http.response.HttpResponse[source]¶ Attempt to pass a response from the data connector using the function map_response.
If the data connectors raises an error (AttributeError, DatasetNotFoundError or NotImplementedError) then return an error response.
Parameters: - map_response – Function to get response from data connector - must return HttpResponse
- error_message – Error message in case data connector raises an error
- dataset – Dataset to access within data source
Returns: HttpResponse from data connector or error response