Skip to content

Commit

Permalink
Separate columns for data
Browse files Browse the repository at this point in the history
  • Loading branch information
psd committed Jan 20, 2025
1 parent 78fa3a9 commit fa294ee
Show file tree
Hide file tree
Showing 2 changed files with 2,643 additions and 344 deletions.
52 changes: 35 additions & 17 deletions bin/render.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,28 @@
ddaggar = "‡"
bullet = "●"

odp_datasets = [
"article-4-direction",
"article-4-direction-area",
"conservation-area",
"conservation-area-document",
"listed-building-outline",
"tree-preservation-order",
"tree",
"tree-preservation-zone",
]
odp_cols = {
"CA": [
"conservation-area",
"conservation-area-document",
],
"A4": [
"article-4-direction",
"article-4-direction-area",
],
"LBO": [
"listed-building-outline",
],
"TPO": [
"tree-preservation-order",
"tree",
"tree-preservation-zone",
]
}
odp_datasets = {}
for col, datasets in odp_cols.items():
for dataset in datasets:
odp_datasets[dataset] = col

rows = {}
sets = {}
Expand Down Expand Up @@ -209,6 +221,9 @@ def overlaps(one, two):
text-align: center;
font-family: fixed;
}
th.odp-col {
text-align: center;
}
td.dots {
valign: center;
text-align: right;
Expand Down Expand Up @@ -427,8 +442,12 @@ def overlaps(one, two):
print(f'<th scope="col" align="left">Drupal</th>')
print(f'<th scope="col" align="left">LLC</th>')
print(f'<th scope="col" align="left">PropTech</th>')
print(f'<th scope="col" align="left">ODP Membership</th>')
print(f'<th scope="col" align="left">Datasets</th>')
print(f'<th scope="col" align="left">ODP</th>')

for col, datasets in odp_cols.items():
colspan = len(datasets)
print(f'<th class="odp-col" scope="col" align="left" colspan={colspan}>{col}</th>')

print(f'<th scope="col" align="left">Data ready</th>')
print(f'<th scope="col" align="left">PlanX</th>')
print("</thead>")
Expand Down Expand Up @@ -485,9 +504,9 @@ def overlaps(one, two):

# datasets
dots = ""
if organisation in quality:
for dataset in odp_datasets:
q = quality[organisation][dataset]
for col, datasets in odp_cols.items():
for dataset in datasets:
q = quality.get(organisation, {}).get(dataset, "")
status = {
"": "&nbsp;",
"0. no data": "&nbsp;",
Expand All @@ -496,8 +515,7 @@ def overlaps(one, two):
"3. data that is good for ODP": "●",
"4. data that is trustworthy": "◉",
}[q]
dots += f'<a href="{data_url}" title="{dataset} : {q}">{status}</a>'
print(f'<td class="dot dots">{dots}</td>')
print(f'<td class="dot"><a href="{data_url}" title="{dataset} : {q}">{status}</a></td>')

# data
dot = f'<a href="{data_url}">●</a>' if organisation in sets["data-ready"] else ""
Expand Down
Loading

0 comments on commit fa294ee

Please sign in to comment.