{% macro render_if_exist(name, value) %}{% if value %}

{{name}}: {{value}}  {% endif %}{% endmacro %}{% macro render_considerations(list) %}{% if list %}{% for item in list %}
* {{ item.description }}
{% endfor %}{% endif %}
{% endmacro %}{% macro render_uri_list(list) %}{% if list %}{% for item in list %}
* [{{ item }}]({{ item }})
{% endfor %}{% endif %}{% endmacro %}
{% macro render_all_graphics(model_parameters, quantitative_analysis) %}## Graphics
{% for dataset in model_parameters.data %}{% if dataset.graphics.collection %}{{ render_graphics(dataset.graphics) }}{% endif %}{% endfor %}
{% if quantitative_analysis.graphics.collection %}
{{ render_graphics(quantitative_analysis.graphics) }}{% endif %}
{% endmacro %}{% macro render_graphics(graphics) %}{% if graphics %}  {% for graph in graphics.collection %}{% if graph.name %}
### {{ graph.name }}{% endif %}{% if graph.description %}

{{ graph.description }}{% endif %}
<img src="data:image/jpeg;base64,{{ graph.image }}">
{% endfor %}{% endif %}{% endmacro %}
{% macro render_license(license) %}
* {% if license.identifier %}{{ license.identifier }}{% endif %}{% if license.custom_text %}{{ license.custom_text }}{% endif %}{% endmacro %}
{% macro metric_name(metric) %}{{ metric.type }}{% if metric.threshold %}@{{ metric.threshold }}{% endif %}{% if metric.slice %}, {{ metric.slice }}{% endif %}{% endmacro %}
{% macro metric_value(metric) %}{{ metric.value }}{% if metric.confidence_interval %} ({{ metric.confidence_interval.lower_bound }}, {{ metric.confidence_interval.upper_bound }}){% endif %}{% endmacro %}
{% macro render_metrics_table(metrics) %}## Metrics

|Name|Value|
-----|------{% for metric in metrics %}
|{{ metric_name(metric) }}|{{ metric_value(metric) }}|{% endfor %}{% endmacro %}
# Model Card for {{ model_details.name }}

## Model Details{% if model_details.overview %}

### Overview
{{ model_details.overview }} {% endif %}{% if model_details.version %}

### Version{{ render_if_exist('name', model_details.version.name) }}{{ render_if_exist('date', model_details.version.date) }}{{ render_if_exist('diff', model_details.version.diff) }}
{% endif %}{% if model_details.owners %}
### Owners
{% for owner in model_details.owners %}
* {{ owner.name }}, {{ owner.contact }}
{% endfor %}
{% endif %}{% if model_details.licenses %}
### Licenses
{% for license in model_details.licenses %}{{ render_license(license) }}{% endfor %}
{% endif %}{% if model_details.references %}
### References
{% for reference in model_details.references %}
* [{{ reference.reference }}]({{ reference.reference }}){% endfor %}
{% endif %}{% if model_details.citations %}

### Citations
{% for citation in model_details.citations %}
* {{ citation.citation }}{% endfor %}
{% endif %}{% if model_parameters.model_architecture or model_parameters.input_format or model_parameters.output_format %}

## Model Parameters
{% if model_parameters.model_architecture %}
### Model Architecture

{{ model_parameters.model_architecture }}{% endif %}
{% if model_parameters.input_format %}
### Input Format

{{ model_parameters.input_format }}{% endif %}
{% if model_parameters.input_format_map %}
### Input

| Key | Value |
| --- | --- |
{% for kv in model_parameters.input_format_map %}| {{ kv.key }} | {{ kv.value }} |
{% endfor %}{% endif %}
{% if model_parameters.output_format %}
### Output Format

{{ model_parameters.output_format }}{% endif %}
{% if model_parameters.output_format_map %}
### Output

| Key | Value |
| --- | --- |
{% for kv in model_parameters.output_format_map %}| {{ kv.key }} | {{ kv.value }} |
{% endfor %}{% endif %}{% endif %}


{% if considerations.users or considerations.use_cases or considerations.limitations or considerations.tradeoffs or considerations.ethical_considerations %}## Considerations
{% if considerations.users %}
### Users
{{ render_considerations(considerations.users) }}{% endif %}{% if considerations.use_cases %}
### Use Cases
{{ render_considerations(considerations.use_cases) }}{% endif %}{% if considerations.limitations %}
### Limitations
{{ render_considerations(considerations.limitations) }}{% endif %}{% if considerations.tradeoffs %}
### Tradeoffs
{{ render_considerations(considerations.tradeoffs) }}{% endif %}{% if considerations.ethical_considerations %}
### Ethical Considerations
{% for risk in considerations.ethical_considerations %}
* Risk: {{ risk.name }}
  * Mitigation Strategy: {{ risk.mitigation_strategy }}
{% endfor %}{% endif %}{% if model_parameters.data or quantitative_analysis.graphics.collection %}
{{ render_all_graphics(model_parameters, quantitative_analysis ) }}
{% endif %}{% if quantitative_analysis and quantitative_analysis.performance_metrics %}{{ render_metrics_table(quantitative_analysis.performance_metrics) }}
{% endif %}
{% endif %}
