qa4sm_api package
Submodules
qa4sm_api.cli module
qa4sm_api.client_api module
- class qa4sm_api.client_api.Access(access)[source]
Bases:
object- classmethod from_dotrcfile(path=PosixPath('/home/runner/.qa4smapirc'))[source]
Load access from dotrc file.
- Parameters:
path (str) – Path to the dotrc file
- class qa4sm_api.client_api.Connection(instance: str = 'qa4sm.eu', token='auto', protocol='https')[source]
Bases:
objectCommunication with QA4SM.
- download_configuration(run_id, out_dir=None)[source]
Download validation configuration used for a specific run.
- Parameters:
- Returns:
config – Downloaded Configuration object
- Return type:
- download_results(run_id, out_dir, force_download=False)[source]
Download all results for a run
- Parameters:
- filter_info(filter_id)[source]
Get information about a data filter.
- Parameters:
filter_id (int) – The ID of the data filter to get information for
- Returns:
ds – Information about the data filter
- Return type:
pd.Series
- get_period(vers_id: int) -> (<class 'str'>, <class 'str'>)[source]
Get start and end date of selected dataset directly from the service
- run_config_validation(config_path, override=None)[source]
Trigger validation run based on the passed config.
- run_validation(config)[source]
Trigger validation run based on the passed config.
- Parameters:
config (ValidationConfiguration) – Validation configuration to send to the service
- Returns:
response – Response from validation run
- Return type:
pd.Series
- validation_duration(validation_id: str) -> (<class 'int'>, <class 'str'>)[source]
Get the duration of a validation run in seconds and formatted string. This works for finished OR running validations
- validation_exists(validation_id: str) bool[source]
Check if a validation run exists online (running or finished, not deleted).
- validation_status(validation_id)[source]
Check if the passed validation run is still running, completed or is not found.
- Parameters:
validation_id (str) – Hash of the remote validation run to check.
- Returns:
status (str) –
- Status of the validation run. Can be one of:
’NOT FOUND’: The validation id was not found
’SCHEDULED’: The validation is queued
’RUNNING’: The validation is still running
’DONE’: The validation is completed
’CANCELLED’: The validation was cancelled
’ERROR’: The validation failed with an error
progress (int) – Progress of the validation run in percent (0-100).
- validation_time(validation_id: str)[source]
Get start and end time when a validation run was processing. This works for finished OR running validations.
- Returns:
start_time – None means that the validation was not started
- Return type:
datetime or None
- variable_info(var_id) Series[source]
Get information about a dataset variable.
- Parameters:
var_id (int) – The ID of the dataset variable to get information for
- Returns:
ds – Information about the dataset variable
- Return type:
pd.Series
- class qa4sm_api.client_api.Session(instance='qa4sm.eu', token='auto', protocol='https')[source]
Bases:
objectWrapper to send API request to QA4SM after authentication.
- login_with_credentials(username=None, password=None, quiet=False)[source]
Authenticate with username and password to receive a token for subsequent requests.
- class qa4sm_api.client_api.ValidationConfiguration(config_data: dict)[source]
Bases:
object- dump(path)[source]
Dump the configuration to a new json file.
- Parameters:
path (str or Path) – Path to json file to create
- property empty
- classmethod from_file(path)[source]
Load a configuration from a json file.
- Parameters:
path (str or Path) – Path to the json file to load
qa4sm_api.globals module
- exception qa4sm_api.globals.AuthenticationError(message='No API token is available for this user. Please generate one.')[source]
Bases:
ValueError
- exception qa4sm_api.globals.ValidationInstanceError(message='Unknown validation instance')[source]
Bases:
KeyError
- exception qa4sm_api.globals.ValidationRunError(message='Validation run failed')[source]
Bases:
Exception
- exception qa4sm_api.globals.ValidationRunNotFoundError(id)[source]
Bases:
ValueError