HedValidationSummary

class HedValidationSummary(sum_op)[source]

Manager for summary of validation issues.

Methods

HedValidationSummary.__init__(sum_op)

Constructor for validation issue manager.

HedValidationSummary.dump_summary(filename, ...)

HedValidationSummary.get_details_dict(...)

Return the summary details from the summary_info.

HedValidationSummary.get_empty_results()

Return an empty results dictionary to use as a template.

HedValidationSummary.get_error_list(error_dict)

Convert errors produced by the HED validation into a list which includes filenames.

HedValidationSummary.get_individual(...[, ...])

Return a dictionary of the individual file summaries.

HedValidationSummary.get_summary([...])

Return a summary dictionary with the information.

HedValidationSummary.get_summary_details([...])

Return a dictionary with the details for individual files and the overall dataset.

HedValidationSummary.get_text_summary([...])

Return a complete text summary by assembling the individual pieces.

HedValidationSummary.get_text_summary_details([...])

Return a text summary of the information represented by this summary.

HedValidationSummary.merge_all_info()

Create a dictionary containing all the errors in the dataset.

HedValidationSummary.save(save_dir[, ...])

Save the summaries using the format indicated.

HedValidationSummary.save_visualizations(...)

Save summary visualizations, if any, using the format indicated.

HedValidationSummary.update_error_location(...)

Updates error information about where an error occurred in sidecar or columnar file.

HedValidationSummary.update_summary(new_info)

Update the summary for a given tabular input file.

Attributes

HedValidationSummary.DISPLAY_INDENT

HedValidationSummary.INDIVIDUAL_SUMMARIES_PATH

HedValidationSummary.__init__(sum_op)[source]

Constructor for validation issue manager.

Parameters:

sum_op (BaseOp) – Operation associated with this summary.

static HedValidationSummary.dump_summary(filename, summary)
HedValidationSummary.get_details_dict(summary_info)[source]

Return the summary details from the summary_info.

Parameters:

summary_info (dict) – Dictionary of issues

Returns:

Same summary_info as was passed in.

Return type:

dict

static HedValidationSummary.get_empty_results()[source]

Return an empty results dictionary to use as a template.

Returns:

Dictionary template of results info for the validation summary to fill in

Return type:

dict

static HedValidationSummary.get_error_list(error_dict, count_only=False)[source]

Convert errors produced by the HED validation into a list which includes filenames.

Parameters:
  • error_dict (dict) – Dictionary {filename: error_list} from validation.

  • count_only (bool) – If False (the default), a full list of errors is included otherwise only error counts.

Returns:

Error list of form [filenameA, issueA1, issueA2, …, filenameB, issueB1, …].

Return type:

list

HedValidationSummary.get_individual(summary_details, separately=True)

Return a dictionary of the individual file summaries.

Parameters:
  • summary_details (dict) – Dictionary of the individual file summaries.

  • separately (bool) – If True (the default), each individual summary has a header for separate output.

HedValidationSummary.get_summary(individual_summaries='separate')

Return a summary dictionary with the information.

Parameters:

individual_summaries (str) – “separate”, “consolidated”, or “none”

Returns:

dict - dictionary with “Dataset” and “Individual files” keys.

Notes: The individual_summaries value is processed as follows:
  • “separate” individual summaries are to be in separate files.

  • “consolidated” means that the individual summaries are in same file as overall summary.

  • “none” means that only the overall summary is produced.

HedValidationSummary.get_summary_details(include_individual=True)

Return a dictionary with the details for individual files and the overall dataset.

Parameters:

include_individual (bool) – If True, summaries for individual files are included.

Returns:

dict - a dictionary with ‘Dataset’ and ‘Individual files’ keys.

Notes

  • The ‘Dataset’ value is either a string or a dictionary with the overall summary.

  • The ‘Individual files’ value is dictionary whose keys are file names and values are

    their corresponding summaries.

Users are expected to provide merge_all_info and get_details_dict functions to support this.

HedValidationSummary.get_text_summary(individual_summaries='separate')

Return a complete text summary by assembling the individual pieces.

Parameters:

individual_summaries (str) – One of the values “separate”, “consolidated”, or “none”.

Returns:

Complete text summary.

Return type:

str

Notes: The options are:
  • “none”: Just has “Dataset” key.

  • “consolidated” Has “Dataset” and “Individual files” keys with the values of each is a string.

  • “separate” Has “Dataset” and “Individual files” keys. The values of “Individual files” is a dict.

HedValidationSummary.get_text_summary_details(include_individual=True)

Return a text summary of the information represented by this summary.

Parameters:

include_individual (bool) – If True (the default), individual summaries are in “Individual files”.

HedValidationSummary.merge_all_info()[source]

Create a dictionary containing all the errors in the dataset.

Returns:

dict - dictionary of issues organized into sidecar_issues and event_issues.

HedValidationSummary.save(save_dir, file_formats=['.txt'], individual_summaries='separate', task_name='')

Save the summaries using the format indicated.

Parameters:
  • save_dir (str) – Name of the directory to save the summaries in.

  • file_formats (list) – List of file formats to use for saving.

  • individual_summaries (str) – Save one file or multiple files based on setting.

  • task_name (str) – If this summary corresponds to files from a task, the task_name is used in filename.

HedValidationSummary.save_visualizations(save_dir, file_formats=['.svg'], individual_summaries='separate', task_name='')

Save summary visualizations, if any, using the format indicated.

Parameters:
  • save_dir (str) – Name of the directory to save the summaries in.

  • file_formats (list) – List of file formats to use for saving.

  • individual_summaries (str) – Save one file or multiple files based on setting.

  • task_name (str) – If this summary corresponds to files from a task, the task_name is used in filename.

static HedValidationSummary.update_error_location(error_locations, location_name, location_key, error)[source]

Updates error information about where an error occurred in sidecar or columnar file.

Parameters:
  • error_locations (list) – List of error locations detected so far is this error.

  • location_name (str) – Error location name, for example ‘row’, ‘column’, or ‘sidecar column’.

  • location_key (str) – Standard key name for this location in the dictionary for an error.

  • error (dict) – Dictionary containing the information about this error.

HedValidationSummary.update_summary(new_info)[source]

Update the summary for a given tabular input file.

Parameters:

new_info (dict) – A dictionary with the parameters needed to update a summary.

Notes

  • The summary needs a “name” str, a schema, a “df”, and a “Sidecar”.

HedValidationSummary.DISPLAY_INDENT = '   '
HedValidationSummary.INDIVIDUAL_SUMMARIES_PATH = 'individual_summaries'