Records

ACRO: Output storage and serialization.

class acro.record.Record(uid: str, status: str, output_type: str, properties: dict, sdc: dict, command: str, summary: str, outcome: DataFrame, output: list[str] | list[DataFrame], comments: list[str] | None = None)[source]

Stores data related to a single output record.

Attributes:
uidstr

Unique identifier.

statusstr

SDC status: {“pass”, “fail”, “review”}

output_typestr

Type of output, e.g., “regression”

propertiesdict

Dictionary containing structured output data.

sdcdict

Dictionary containing SDC results.

commandstr

String representation of the operation performed.

summarystr

String summarising the ACRO checks.

outcomeDataFrame

DataFrame describing the details of ACRO checks.

outputAny

List of output DataFrames.

commentslist[str]

List of strings entered by the user to add comments to the output.

exceptionstr

Description of why an exception to fail/review should be granted.

timestampstr

Time the record was created in ISO format.

Methods

serialize_output([path])

Serialize outputs.

serialize_output(path: str = 'outputs') list[str][source]

Serialize outputs.

Parameters:
pathstr, default ‘outputs’

Name of the folder that outputs are to be written.

Returns:
list[str]

List of filepaths of the written outputs.

class acro.record.Records[source]

Stores data related to a collection of output records.

Methods

add(status, output_type, properties, sdc, ...)

Add an output to the results.

add_comments(output, comment)

Add a comment to an output.

add_custom(filename[, comment])

Add an unsupported output to the results dictionary.

add_exception(output, reason)

Add an exception request to an output.

finalise(path, ext)

Create a results file for checking.

finalise_excel(path)

Write outputs to an excel spreadsheet.

finalise_json(path)

Write outputs to a JSON file.

get(key)

Return a specified output from the results.

get_index(index)

Return the output at the specified position.

get_keys()

Return the list of available output keys.

print()

Print the current results.

remove(key)

Remove an output from the results.

rename(old, new)

Rename an output.

validate_outputs()

Prompt researcher to complete any required fields.

write_checksums(path)

Write checksums for each file to checksums folder.

add(status: str, output_type: str, properties: dict, sdc: dict, command: str, summary: str, outcome: DataFrame, output: list[str] | list[DataFrame], comments: list[str] | None = None) None[source]

Add an output to the results.

Parameters:
statusstr

SDC status: {“pass”, “fail”, “review”}

output_typestr

Type of output, e.g., “regression”

propertiesdict

Dictionary containing structured output data.

sdcdict

Dictionary containing SDC results.

commandstr

String representation of the operation performed.

summarystr

String summarising the ACRO checks.

outcomeDataFrame

DataFrame describing the details of ACRO checks.

outputlist[str | list[DataFrame]

List of output DataFrames.

commentslist[str] | None, default None

List of strings entered by the user to add comments to the output.

add_comments(output: str, comment: str) None[source]

Add a comment to an output.

Parameters:
outputstr

The name of the output.

commentstr

The comment.

add_custom(filename: str, comment: str | None = None) None[source]

Add an unsupported output to the results dictionary.

Parameters:
filenamestr

The name of the file that will be added to the list of the outputs.

commentstr | None, default None

An optional comment.

add_exception(output: str, reason: str) None[source]

Add an exception request to an output.

Parameters:
outputstr

The name of the output.

reasonstr

The reason the output should be released.

finalise(path: str, ext: str) None[source]

Create a results file for checking.

Parameters:
pathstr

Name of a folder to save outputs.

extstr

Extension of the results file. Valid extensions: {json, xlsx}.

finalise_excel(path: str) None[source]

Write outputs to an excel spreadsheet.

Parameters:
pathstr

Name of a folder to save outputs.

finalise_json(path: str) None[source]

Write outputs to a JSON file.

Parameters:
pathstr

Name of a folder to save outputs.

get(key: str) Record[source]

Return a specified output from the results.

Parameters:
keystr

Key specifying which output to return, e.g., ‘output_0’.

Returns:
Record

The requested output.

get_index(index: int) Record[source]

Return the output at the specified position.

Parameters:
indexint

Position of the output to return.

Returns:
Record

The requested output.

get_keys() list[str][source]

Return the list of available output keys.

Returns:
list[str]

List of output names.

print() str[source]

Print the current results.

Returns:
str

String representation of all outputs.

remove(key: str) None[source]

Remove an output from the results.

Parameters:
keystr

Key specifying which output to remove, e.g., ‘output_0’.

rename(old: str, new: str) None[source]

Rename an output.

Parameters:
oldstr

The old name of the output.

newstr

The new name of the output.

validate_outputs() None[source]

Prompt researcher to complete any required fields.

write_checksums(path: str) None[source]

Write checksums for each file to checksums folder.

Parameters:
pathstr

Name of a folder to save outputs.

acro.record.load_outcome(outcome: dict) DataFrame[source]

Return a DataFrame from an outcome dictionary.

Parameters:
outcomedict

The outcome to load as a DataFrame.

acro.record.load_output(path: str, output: list[str]) list[str] | list[DataFrame][source]

Return a loaded output.

Parameters:
pathstr

The path to the output folder (with results.json).

outputlist[str]

The output to load.

Returns:
list[str] | list[DataFrame]

The loaded output field.

acro.record.load_records(path: str) Records[source]

Load outputs from a JSON file.

Parameters:
pathstr

Name of an output folder containing results.json.

Returns:
Records

The loaded records.