{#- Macros shared by the column pages of the report and of Tabalyst Insights. -#} {% from 'report_parts.html' import acc with context %} {% macro type_name_text() -%} {% set type_name = column.type_label %}{% if page.type_name %}{% set type_name = page.type_name %}{% elif column.classification.family == 'identifier' and column.distinct.kind == 'exact' and column.field.values.count %}{% set uniq = 100 * column.distinct.value / column.field.values.count %}{% if uniq >= 100 %}{% set type_name = 'Unique ID' %}{% elif uniq >= 99 %}{% set type_name = 'Probable unique ID' %}{% else %}{% set type_name = 'ID' %}{% endif %}{% endif %}{{ type_name }} {%- endmacro %} {#- ``kind`` names the page in its eyebrow; ``findings`` says the page has a Findings section the flags link to. -#} {% macro column_header(back_href, back_label, kind='Column report', findings=true) -%} {% set n_err = page.errors %} {% set n_iss = page.issues %} {% set n_rem = page.remarks | length %}

{{ kind }} · {{ report.source.name }}

{{ column.name or '(unnamed)' }}

  • Column {{ column.position }} of {{ ds.summary.column_count }}
  • {{ column.path }}
  • {{ ds.summary.row_count | count }} rows
{% if page.previous %}{% endif %} {% if page.next %}{% endif %} {{ back_label }} {% for title, href in charts %}{{ title }} chart{% endfor %}

{{ family_labels[column.classification.family] }}{{ type_name_text() }}

{{ page.sentence }}

{% set tag = 'a' if findings else 'span' %}{% if n_err %}<{{ tag }} class="cst cst-error"{% if findings %} href="#findings"{% endif %}>{{ n_err }} {{ 'kind' if n_err == 1 else 'kinds' }} of error{% else %}No error detected{% endif %} {% if n_iss %}<{{ tag }} class="cst cst-issue"{% if findings %} href="#findings"{% endif %}>{{ n_iss }} {{ 'kind' if n_iss == 1 else 'kinds' }} of issue{% endif %} {% if column.exposure in ('mask', 'hide') %}Values {{ 'masked' if column.exposure == 'mask' else 'hidden' }}{% endif %}

{%- endmacro %} {% macro column_summary() -%} {% set sm = column.summary %} {% set n_err = page.errors %} {% set n_iss = page.issues %} {% set n_rem = page.remarks | length %}

01 / Summary

What this column holds

The figures of the column, and how Tabalyst reads its type.

Analyzable values
{{ column.field.values.count | count }}in {{ ds.summary.row_count | count }} rows
Missing
{{ column.missing_percent }}%{{ column.missing_count | count }} values{% set parts = sm.findings.missing.components.model_dump().items() | selectattr(1) | list %}{% if parts %}
{% for name, n in parts %}{{ name }} {{ n | count }}{% if not loop.last %} · {% endif %}{% endfor %}{% endif %}
{% set d = column.distinct %}
Distinct
{% if d.kind == 'exact' %}{{ d.value | count }}{% elif d.kind == 'at_least' %}≥ {{ d.value | count }}{% else %}limited{% endif %}{% if d.kind == 'exact' %}{{ acc('exact') }}{% if column.field.values.count %} {{ ((100 * d.value / column.field.values.count) | round(2)) }}% of values{% endif %}{% elif d.kind == 'at_least' %}{{ acc('at_least') }}{% if d.estimate is not none %} {{ acc('estimated') }} ≈ {{ d.estimate | round | int | count }}{% endif %}{% else %}{{ acc('not_computed') }}{% endif %}
{% if column.numeric and column.numeric.median is not none %}
Median
{{ column.numeric.median | number }}from {{ column.numeric.minimum | number }} to {{ column.numeric.maximum | number }}
{% endif %}
Findings
{{ n_err + n_iss }}{{ n_err }} {{ 'error' if n_err == 1 else 'errors' }} · {{ n_iss }} {{ 'issue' if n_iss == 1 else 'issues' }}{% if n_rem %} · {{ n_rem }} {{ 'remark' if n_rem == 1 else 'remarks' }}{% endif %}

{{ type_name_text() }} {{ column.classification.state }} · {{ column.classification.basis }}{% if column.exposure in ('mask', 'hide') %} {{ 'Masked' if column.exposure == 'mask' else 'Hidden' }}{% endif %}

{{ page.sentence }}

{% if column.classification.traits %}Traits{% for t in column.classification.traits %}{{ t | replace('_',' ') }}{% endfor %}{% endif %}{% if column.classification.alternatives %}Could also be{% for alt in column.classification.alternatives %}{{ type_labels.get(alt.family ~ '/' ~ alt.type, alt.type | replace('_',' ')) }}{% endfor %}{% endif %}

{% set uq = page.uniqueness %}{% if uq %}

Identifier uniqueness {{ uq.status_word }}

{{ uq.title }}

{{ uq.text }}

{% if uq.caveat %}

{{ uq.caveat }}

{% endif %} {% if uq.rows %}
{% for r in uq.rows %}
{{ r.label }}{% if r.figure is none %}not established{% else %}{{ r.figure | count }}{% endif %}
{% endfor %}
{% endif %} {% if uq.near %}

{{ uq.near.title }}. {{ uq.near.text }}{% if uq.near.caveat %} {{ uq.near.caveat }}{% endif %}

{% endif %} {% if uq.evidence or uq.rejected %}
    {% for line in uq.evidence %}
  • {{ line }}
  • {% endfor %}{% for line in uq.rejected %}
  • {{ line }}
  • {% endfor %}
{% endif %}
{% endif %}
{%- endmacro %}