Skip to content

Commit

Permalink
Merge pull request #289 from digital-land/add-origin-label
Browse files Browse the repository at this point in the history
Add origin label to dataset pages
  • Loading branch information
colmjude authored Aug 20, 2024
2 parents 2e4ff04 + dc07926 commit 9598075
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
23 changes: 20 additions & 3 deletions application/routers/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,22 @@
logger = logging.getLogger(__name__)


def get_origin_label(dataset):
labels = {
"alpha": (
"Data created by MHCLG. We will replace this with data from authoritative sources "
"when it is available."
),
"beta": (
"Contains some data created by MHCLG. We are working to replace it with data "
"from authoritative sources"
),
"live": "All data from authoritative sources",
"live+": "All data from authoritative sources with additional supporting data.",
}
return labels.get(dataset.phase, "Unknown")


def get_datasets_by_typology(datasets):
typologies = {}
for ds in (d for d in datasets if d.typology):
Expand Down Expand Up @@ -109,11 +125,12 @@ def get_dataset(
"current": publisher_coverage.publisher_count,
},
"latest_resource": latest_resource,
"last_collection_attempt": latest_resource.last_collection_attempt
if latest_resource
else None,
"last_collection_attempt": (
latest_resource.last_collection_attempt if latest_resource else None
),
"categories": categories,
"data_file_url": data_file_url,
"dataset_origin_label": get_origin_label(_dataset),
},
)

Expand Down
8 changes: 8 additions & 0 deletions application/templates/dataset.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@ <h1 class="govuk-heading-xl">{{ dataset["name"] }}</h1>
{
'html': latest_resource.last_updated if latest_resource.last_updated else 'N/A'
},
],
[
{
'html': '<b>Origin</b>'
},
{
'html': dataset_origin_label
}
]
]
%}
Expand Down

0 comments on commit 9598075

Please sign in to comment.