API Reference

Table of Contents

Validation

rios.core.validation.validate_instrument(instrument)

Validates the input against the RIOS Instrument Definition specification.

Parameters:instrument (JSON string, dict, or file-like object) – The Instrument Definition to validate
Raises ValidationError:
 If the input fails any part of the specification
rios.core.validation.validate_assessment(assessment, instrument=None)

Validates the input against the RIOS Assessment Document specification.

Parameters:
  • assessment (JSON string, dict, or file-like object) – The Assessment Document to validate
  • instrument (JSON string, dict, or file-like object) – The Instrument Definition to validate the Assessment against. If not specified, this defaults to None, which means that only the basic structure of the Assessment will be validated – not its conformance to the Instrument.
Raises ValidationError:
 

If the input fails any part of the specification

rios.core.validation.validate_calculationset(calculationset, instrument=None)

Validates the input against the RIOS Calculation Set Definition specification.

Parameters:
  • form (JSON string, dict, or file-like object) – The Calculation Set Definition to validate
  • instrument (JSON string, dict, or file-like object) – The Instrument Definition to validate the Calculation Set against. If not specified, this defaults to None, which means that only the basic structure of the Calculation Set will be validated – not its conformance to the Instrument.
Raises ValidationError:
 

If the input fails any part of the specification

rios.core.validation.validate_form(form, instrument=None)

Validates the input against the RIOS Web Form Configuration specification.

Parameters:
  • form (JSON string, dict, or file-like object) – The Web Form Configuration to validate
  • instrument (JSON string, dict, or file-like object) – The Instrument Definition to validate the Form against. If not specified, this defaults to None, which means that only the basic structure of the Form will be validated – not its conformance to the Instrument.
Raises ValidationError:
 

If the input fails any part of the specification

rios.core.validation.validate_interaction(interaction, instrument=None)

Validates the input against the RIOS SMS Interaction Configuration specification.

Parameters:
  • interaction (JSON string, dict, or file-like object) – The SMS Interaction Configuration to validate
  • instrument (JSON string, dict, or file-like object) – The Instrument Definition to validate the Interaction against. If not specified, this defaults to None, which means that only the basic structure of the Interaction will be validated – not its conformance to the Instrument.
Raises ValidationError:
 

If the input fails any part of the specification

rios.core.validation.get_full_type_definition(instrument, type_def)

Returns a fully merged version of an Instrument Type Object that includes all constraints inherited from parent data types.

The base property of this object will always reflect the base RIOS data type that the specified type definition is an implementation of.

Parameters:
  • instrument (dict) – the full Instrument definition that the Field in question is a part of
  • type_def (dict or str) – the contents of the type property from an Instrument Field definition
Return type:

dict

exception rios.core.validation.ValidationError

The exception thrown by the validation functions when the given input does not meet the RIOS specifications.

asdict()

Returns a dictionary containing a summary of the problems found by the validator. The keys of the dictionary indiciate where in the structure the problem was found, and the values of the dictionary are a message explaining the issue.

Return type:dict

Output

rios.core.output.get_instrument_json(instrument, pretty=True, **kwargs)

Generates a JSON-formatted string containing the specified Instrument Definition.

Parameters:
  • instrument (JSON string, dict, or file-like object) – The Instrument Definition generate the JSON for
  • pretty (bool) – Whether or not to format the JSON in a human-friendly way. If not specified, defaults to True.
  • kwargs – Any extra keyword arguments are passed to the underlying json.dumps function.
Returns:

The JSON-formatted string representing the Instrument

Return type:

string

rios.core.output.get_instrument_yaml(instrument, pretty=True, **kwargs)

Generates a YAML-formatted string containing the specified Instrument Definition.

Parameters:
  • instrument (JSON string, dict, or file-like object) – The Instrument Definition generate the YAML for
  • pretty (bool) – Whether or not to format the YAML in a human-friendly way. If not specified, defaults to True.
  • kwargs – Any extra keyword arguments are passed to the underlying yaml.dump function.
Returns:

The YAML-formatted string representing the Instrument

Return type:

string

rios.core.output.get_assessment_json(assessment, pretty=True, **kwargs)

Generates a JSON-formatted string containing the specified Assessment Document.

Parameters:
  • instrument (JSON string, dict, or file-like object) – The Assessment Document generate the JSON for
  • pretty (bool) – Whether or not to format the JSON in a human-friendly way. If not specified, defaults to True.
  • kwargs – Any extra keyword arguments are passed to the underlying json.dumps function.
Returns:

The JSON-formatted string representing the Assessment

Return type:

string

rios.core.output.get_assessment_yaml(assessment, pretty=True, **kwargs)

Generates a YAML-formatted string containing the specified Assessment Document.

Parameters:
  • instrument (JSON string, dict, or file-like object) – The Assessment Document generate the YAML for
  • pretty (bool) – Whether or not to format the YAML in a human-friendly way. If not specified, defaults to True.
  • kwargs – Any extra keyword arguments are passed to the underlying yaml.dump function.
Returns:

The YAML-formatted string representing the Assessment

Return type:

string

rios.core.output.get_form_json(form, pretty=True, **kwargs)

Generates a JSON-formatted string containing the specified Web Form Configuration.

Parameters:
  • instrument (JSON string, dict, or file-like object) – The Web Form Configuration generate the JSON for
  • pretty (bool) – Whether or not to format the JSON in a human-friendly way. If not specified, defaults to True.
  • kwargs – Any extra keyword arguments are passed to the underlying json.dumps function.
Returns:

The JSON-formatted string representing the Form

Return type:

string

rios.core.output.get_form_yaml(form, pretty=True, **kwargs)

Generates a YAML-formatted string containing the specified Web Form Configuration.

Parameters:
  • instrument (JSON string, dict, or file-like object) – The Web Form Configuration generate the YAML for
  • pretty (bool) – Whether or not to format the YAML in a human-friendly way. If not specified, defaults to True.
  • kwargs – Any extra keyword arguments are passed to the underlying yaml.dump function.
Returns:

The YAML-formatted string representing the Form

Return type:

string

rios.core.output.get_calculationset_json(calculationset, pretty=True, **kwargs)

Generates a JSON-formatted string containing the specified Calculation Set Definition.

Parameters:
  • instrument (JSON string, dict, or file-like object) – The Calculation Set Definition generate the JSON for
  • pretty (bool) – Whether or not to format the JSON in a human-friendly way. If not specified, defaults to True.
  • kwargs – Any extra keyword arguments are passed to the underlying json.dumps function.
Returns:

The JSON-formatted string representing the Calculation Set

Return type:

string

rios.core.output.get_calculationset_yaml(calculationset, pretty=True, **kwargs)

Generates a YAML-formatted string containing the specified Calculation Set Definition.

Parameters:
  • instrument (JSON string, dict, or file-like object) – The Calculation Set Definition generate the YAML for
  • pretty (bool) – Whether or not to format the YAML in a human-friendly way. If not specified, defaults to True.
  • kwargs – Any extra keyword arguments are passed to the underlying yaml.dump function.
Returns:

The YAML-formatted string representing the Calculation Set

Return type:

string

rios.core.output.get_interaction_json(interaction, pretty=True, **kwargs)

Generates a JSON-formatted string containing the specified SMS Interaction Configuration.

Parameters:
  • instrument (JSON string, dict, or file-like object) – The SMS Interaction Configuration generate the JSON for
  • pretty (bool) – Whether or not to format the JSON in a human-friendly way. If not specified, defaults to True.
  • kwargs – Any extra keyword arguments are passed to the underlying json.dumps function.
Returns:

The JSON-formatted string representing the Form

Return type:

string

rios.core.output.get_interaction_yaml(interaction, pretty=True, **kwargs)

Generates a YAML-formatted string containing the specified SMS Interaction Configuration.

Parameters:
  • instrument (JSON string, dict, or file-like object) – The SMS Interaction Configuration generate the YAML for
  • pretty (bool) – Whether or not to format the YAML in a human-friendly way. If not specified, defaults to True.
  • kwargs – Any extra keyword arguments are passed to the underlying yaml.dump function.
Returns:

The YAML-formatted string representing the Form

Return type:

string