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

{{name}}: {{value}}  {% endif %}{% endmacro %}{% macro render_list(list) %}{% if list %}{% for item in list %}
* {{ item }}
{% endfor %}{% endif %}
{% endmacro %}{% macro render_uri_list(list) %}{% if list %}{% for item in list %}
* [{{ item }}]({{ item }})
{% endfor %}{% endif %}{% endmacro %}{% macro render_graphics(graphics) %}{% if graphics %}  {% for graph in graphics.collection %}

{{ graph.name }}

<img src="data:image/jpeg;base64,{{ graph.image }}">

{% endfor %}
{% 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.license %}
### License

{{ model_details.license }}
{% endif %}{% if model_details.references %}
### References
{{ render_uri_list(model_details.references) }}{% endif %}
{% if model_details.citation %}### Citation

{{ model_details.citation }}{% 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.output_format %}
### Output Format

{{ model_parameters.output_format }}{% 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_list(considerations.users) }}{% endif %}{% if considerations.use_cases %}
### Use Cases
{{ render_list(considerations.use_cases) }}{% endif %}{% if considerations.limitations %}
### Limitations
{{ render_list(considerations.limitations) }}{% endif %}{% if considerations.tradeoffs %}
### Tradeoffs
{{ render_list(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 %}{% endif %}
{% if (model_parameters.data.train and model_parameters.data.train.graphics) or (model_parameters.data.eval and model_parameters.data.eval.graphics) or (quantitative_analysis and quantitative_analysis.graphics) %}## Graphics
{% if model_parameters.data.train and (model_parameters.data.train.graphics.description or model_parameters.data.train.graphics.collection) %}
### Train Set{% if model_parameters.data.train.graphics.description %}

{{ model_parameters.data.train.graphics.description }}{% endif %}{% if model_parameters.data.train.graphics.collection %}
{{ render_graphics(model_parameters.data.train.graphics) }}{% endif %}{% endif %}
{% if model_parameters.data.eval and (model_parameters.data.eval.graphics.description or model_parameters.data.eval.graphics.collection) %}
### Eval Set{% if model_parameters.data.eval.graphics.description %}

{{ model_parameters.data.eval.graphics.description }}{% endif %}{% if model_parameters.data.eval.graphics.collection %}
{{ render_graphics(model_parameters.data.eval.graphics) }}{% endif %}{% endif %}{% if quantitative_analysis and (quantitative_analysis.graphics.description or quantitative_analysis.graphics.collection) %}
### Quantitative Analysis{% if quantitative_analysis.graphics.description %}

{{ quantitative_analysis.graphics.description }}{% endif %}{% if quantitative_analysis.graphics.collection %}
{{ render_graphics(quantitative_analysis.graphics) }}{% endif %}{% if quantitative_analysis.performance_metrics %}{{ render_metrics_table(quantitative_analysis.performance_metrics) }}{% endif %}
{% endif %}
{% endif %}
