The template has specialized logic to forego data that is not available in the csv. There is probably a more simplified and concise way to implement this using jinja, for example with a for loop that adds all available data to the table.
Also, we can add generating titles to the template.