import yaml
from IPython.display import Markdown
# Load the YAML content
with open("_formalq.yml", "r", encoding="utf-8") as f:
catalogue_record = yaml.safe_load(f)["catalogue-record"]["table"]
# Keep track of footnotes
footnotes = []
footnote_counter = 1
def generate_markdown_table(record):
global footnote_counter
markdown_text = ""
for key, details in record.items():
markdown_text += f"## {key}\n\n"
markdown_text += "| Grade | Parameter | Value |\n"
markdown_text += "|-------|-----------|-------|\n"
for sub_key, sub_details in details.items():
grade = sub_details["evaluation"]
parameter = f'**{sub_key}** [^footnote{footnote_counter}]'
# Add the reference footnote for this parameter
footnotes.append(f'[^footnote{footnote_counter}]: ref.: {sub_details["ref."]}\n\n obligation: {sub_details["obligation"]}')
footnote_counter += 1
value = sub_details.get("data provided or implied", "null")
implied_txt = "found" if not sub_details.get("implied?") else "implied"
note = f'{implied_txt}; {sub_details["comment"]}'
value_with_note = f'{value} [^footnote{footnote_counter}]'
# Add the note footnote for this value
footnotes.append(f'[^footnote{footnote_counter}]: {note}')
footnote_counter += 1
# Color based on the grade, default to plain bold if the grade is not expected
color_map = {
"A": "green",
"B": "blue",
"C": "orange",
"F": "red"
}
color = color_map.get(grade, None)
# If grade is one of the expected, apply color, else just make it bold
if color:
grade_colored = f'**<span style="color:{color}">{grade}</span>**'
else:
grade_colored = f'**{grade}**'
markdown_text += f"| {grade_colored} | {parameter} | {value_with_note} |\n"
markdown_text += "\n"
return markdown_text
# Generate the markdown for the table
markdown_output = generate_markdown_table(catalogue_record)
# Add footnotes to the bottom of the markdown
markdown_output += "\n## Footnotes\n\n"
markdown_output += "\n".join(footnotes)
# Output the generated markdown
Markdown(markdown_output)Access information
| Grade | Parameter | Value |
|---|---|---|
| A | Access URL 1 | https://www.cita.lu/info_trafic/datex/situationrecord 2 |
| C | Access interface 3 | HTTP/HTTPS 4 |
| C | Communication method 5 | pull 6 |
| C | Data format - Data Model 7 | DATEX II Profile 8 |
| F | Data format - Encoding 9 | None 10 |
| C | Data format - Grammar 11 | XSD 12 |
| C | Data format - Syntax 13 | XML 14 |
| F | Data format description 15 | None 16 |
| F | Data sample 17 | None 18 |
| F | Data schema / validation 19 | None 20 |
| F | Protocol documentation 21 | None 22 |
| F | Security mechanisms 23 | None 24 |
Conditions for use
| Grade | Parameter | Value |
|---|---|---|
| A | Conditions for use 25 | Creative Commons Zero (CC0) 26 |
| C | Contract or license 27 | Free of charge 28 |
Content information
| Grade | Parameter | Value |
|---|---|---|
| F | Dataset detailed type 29 | None 30 |
| F | Dataset documentation 31 | None 32 |
| F | Dataset language 33 | None 34 |
| F | Dataset type category 35 | None 36 |
| F | Description of dataset 37 | None 38 |
| C | Georeferencing method 39 | AlertCMethod4Linear 40 |
| B | Name of the dataset 41 | Cita : Événements trafic en DATEX II 42 |
| F | Related linked data sources 43 | None 44 |
| C | Resource type 45 | Dataset 46 |
| - | Service type category 47 | None 48 |
Evaluation metadata
| Grade | Parameter | Value |
|---|---|---|
| - | content provider contact 49 | chmylonas@certh.gr 50 |
| - | evaluated dataset url 51 | https://data.public.lu/en/datasets/cita-evenements-trafic-en-datex-ii/ 52 |
| - | evaluation date 53 | 30/09/2024 54 |
| - | evaluator 55 | Chrysostomos Mylonas 56 |
Geographical coverage
| Grade | Parameter | Value |
|---|---|---|
| B | Area covered by publication 57 | Luxembourg, territorial coverage granularity 58 |
| F | Network coverage 59 | None 60 |
| F | Network coverage description 61 | None 62 |
Metadata information
| Grade | Parameter | Value |
|---|---|---|
| F | Contact point 63 | None 64 |
| A | Dataset identifier 65 | 5bb707fff176a135ced3b287 66 |
| B | Metadata date 67 | October 5, 2018 68 |
| C | Metadata language 69 | fr; eng 70 |
Quality information
| Grade | Parameter | Value |
|---|---|---|
| C | Applicable DRs 71 | SRTI; RTTI 72 |
| F | Availability 73 | None 74 |
| F | Cross verification 75 | None 76 |
| F | Data collection method 77 | None 78 |
| F | National body assessment status 79 | None 80 |
| F | Problem reporting process 81 | None 82 |
| F | Quality description 83 | None 84 |
| F | Reaction time to respond 85 | None 86 |
| A | Update frequency 87 | Real time 88 |
Responsibilities
| Grade | Parameter | Value |
|---|---|---|
| F | Data owner 89 | None 90 |
| B | Publisher 91 | Administration des Ponts et Chaussées 92 |
Temporal information
| Grade | Parameter | Value |
|---|---|---|
| - | End date of publication 93 | None 94 |
| F | Start date of publication 95 | None 96 |
Transportation system
| Grade | Parameter | Value |
|---|---|---|
| F | Transportation modes covered 97 | None 98 |