{##} {##} {{ title }} {% set utils = imp0rt('mrQA.utils') %}

Summary of non-compliance: {{ hz['compliant_ds'].name }}

{% if not skip_plots %} {% for key in plots %}
{{ plots[key].div | safe }} {{ plots[key].script | safe }}
{% endfor %} {% endif %} {% if not skip_hz_report %}

Horizontal Audit

Reference Protocol Type : {{ hz['protocol'].type.name }}

List of non-compliant modalities - {{ hz['non_compliant_ds'].get_sequence_ids()|length }}

{% for seq_id in hz['non_compliant_ds'].get_sequence_ids()|sort %} {% set ncomp_sub_ids = hz['non_compliant_ds'].get_subject_ids(seq_id) %} {% set seq_name_wo_tag = seq_id.split('_ATTR_') %} {% set total_subjects = complete_ds.get_subject_ids(seq_name_wo_tag[0]) | length %} {% set comp_subject_count = total_subjects - ncomp_sub_ids|length %} {% set non_compliant_params = hz['non_compliant_ds'].get_nc_param_ids(seq_id) %} {% if hz['non_compliant_ds'].get_subject_ids(seq_id) %}{# |length > 2 #} {% set percent_non_compliant = 100 * ncomp_sub_ids|length|float / total_subjects %} {% set percent_compliant = 100 * comp_subject_count|float / total_subjects %} {% endif %} {% endfor %}
Modality # non-compliant (%) Non-compliant subjects Parameters # compliant (%) # subjects
{{ seq_id }} {{ ncomp_sub_ids | length }} ({{ percent_non_compliant|round(2, 'floor') }} %) {% if ncomp_sub_ids|length < 50 %} {% for name in ncomp_sub_ids|sort %} {{ name }}, {% endfor %} {% else %} Too many to fit here. Click here for full list. {% endif %} {% for parameter in hz['non_compliant_ds'].get_nc_param_ids(seq_id)|sort %} {{ parameter }}, {% endfor %} {{ comp_subject_count }} ( {{ percent_compliant|round(2, 'floor') }} %) {{ total_subjects }}
{% set comp_sequences = hz['compliant_ds'].get_sequence_ids() %}

Fully compliant modalities : {{ comp_sequences | length }}

{% if comp_sequences|length > 0 %} {% set cols = 4 %} {% set rows = (comp_sequences |length // cols) + 1 %} {% for i in range(rows) %} {% for j in range(cols) %} {% set index = i * cols + j %} {% if index < comp_sequences |length %} {% endif %} {% endfor %} {% endfor %}
{{ comp_sequences[index] }}
{% endif %} {% set und_sequences = hz['undetermined_ds'].get_sequence_ids() %} {% if und_sequences|length > 0 %}

Modalities for which compliance could not be determined : {{ und_sequences | length }}

{% set cols = 4 %} {% set rows = (und_sequences |length // cols) + 1 %} {% for i in range(rows) %} {% for j in range(cols) %} {% set index = i * cols + j %} {% if index < und_sequences |length %} {% endif %} {% endfor %} {% endfor %}
{{ und_sequences[index] }}
{% endif %} {% for seq_id in hz['non_compliant_ds'].get_sequence_ids()|sort %}

Sequence : {{ seq_id }}

{% set ref = hz['protocol'][seq_id] %}

Reference

{% for param in ref|sort %} {% endfor %} {% for param in ref|sort %} {% endfor %}
{{ param }}
{{ ref[param].get_value() }}
{% set non_compliant_params = hz['non_compliant_ds'].get_nc_param_ids(seq_id) %} {% if non_compliant_params|length %} {% for parameter in non_compliant_params|sort %} {% set nc_data = hz['non_compliant_ds'].get_nc_param_values(seq_id, parameter)|list %} {% set nc_dict = utils.tuples2dict(nc_data) %} {% for nc_param, tuples in nc_dict.items() %} {% endfor %} {% endfor %}
Parameter Ref. Value Found Subject
{{ parameter }} {{ ref[parameter].get_value() }}
{{ nc_param.get_value() }}, {% for sub, path in tuples %} {{ sub }}, {% endfor %}
{% endif %} {% endfor %} {% for seq_id in hz['compliant_ds'].get_sequence_ids()|sort %}

Sequence : {{ seq_id }}

{% set ref = hz['protocol'][seq_id] %} {% for param in ref|sort %} {% endfor %} {% for param in ref|sort %} {% endfor %}
{{ param }}
{{ ref[param].get_value() }}
{% endfor %} {% endif %} {% if not skip_vt_report %}

Vertical Audit

{% for pair in vt['sequence_pairs'] %} {% endfor %} {% for param in vt['parameters'] %} {% for pair in vt['sequence_pairs'] %} {% endfor %} {% endfor %} {% for pair in vt['sequence_pairs'] %} {% endfor %}
Parameters # non-compliant (%){{ pair[0] }},
{{ pair[1] }}
{{ param }} {% set total_subjects = vt['complete_ds'].subjects() | length | float %} {% set nc_subjects = vt['non_compliant_ds'].total_nc_subjects_by_parameter(param) | float %} {% set percent_non_comp = 100 * nc_subjects/total_subjects %} {{ nc_subjects }}
({{ percent_non_comp| round(2, 'floor') }} %)
{% if param in vt['non_compliant_ds'].get_nc_param_ids(pair[0]) %} {% set val = vt['non_compliant_ds'].get_nc_subject_ids(pair[0], param, pair[1]) %} {% for sub in val %} {{ sub }},
{% endfor %} {% endif %}
# non-compliant (%) {# {% if param in vt['nc_ds'].get_nc_param_ids(pair[0]) %}#} {% set nc_subjects = vt['non_compliant_ds'].total_nc_subjects_by_sequence(pair[0], ref_seq=pair[1]) %} {% set original_seq_name = vt['non_compliant_ds'].get_original_seq_name(pair[0]) %} {% set total_subjects = vt['complete_ds'].get_subject_ids(original_seq_name) | length | float %} {% set percent_non_comp = 100 * nc_subjects/total_subjects %} {{ nc_subjects }}
({{ percent_non_comp| round(2, 'floor') }} %) {# {% endif %}#}
{% endif %}