Skip to content

Commit a4152b3

Browse files
switch to endpoint dataset summary table (#49)
1 parent 10d8c49 commit a4152b3

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

application/data_access/odp_summaries/conformance.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,12 @@ def get_column_field_summary(dataset_clause, offset):
5555
SELECT endpoint, licence
5656
FROM reporting_latest_endpoints
5757
) AS rle ON edrs.endpoint = rle.endpoint
58+
LEFT JOIN (
59+
SELECT endpoint, end_date as endpoint_end_date
60+
FROM endpoint_dataset_summary
61+
) as eds on edrs.endpoint = eds.endpoint
5862
WHERE edrs.resource != ''
59-
and edrs.endpoint_end_date=''
63+
and eds.endpoint_end_date=''
6064
and ({dataset_clause})
6165
limit 1000 offset {offset}
6266
"""
@@ -67,7 +71,7 @@ def get_column_field_summary(dataset_clause, offset):
6771

6872
def get_issue_summary(dataset_clause, offset):
6973
sql = f"""
70-
select * from endpoint_dataset_issue_type_summary
74+
select * from endpoint_dataset_issue_type_summary edrs
7175
where ({dataset_clause})
7276
limit 1000 offset {offset}
7377
"""
@@ -89,7 +93,7 @@ def get_odp_conformance_summary(dataset_types, cohorts):
8993
else:
9094
datasets = ALL_DATASETS
9195
dataset_clause = " or ".join(
92-
("pipeline = '" + str(dataset) + "'" for dataset in datasets)
96+
("edrs.pipeline = '" + str(dataset) + "'" for dataset in datasets)
9397
)
9498

9599
provision_df = get_provisions(cohorts, COHORTS)

application/data_access/odp_summaries/issue.py

+10-5
Original file line numberDiff line numberDiff line change
@@ -280,9 +280,14 @@ def get_issue_summary_by_issue_type(dataset_clause, offset):
280280
SELECT
281281
*
282282
FROM
283-
endpoint_dataset_issue_type_summary
283+
endpoint_dataset_issue_type_summary edits
284+
LEFT JOIN (
285+
SELECT endpoint, end_date as endpoint_end_date, latest_status,
286+
latest_exception, entry_date as endpoint_entry_date
287+
FROM endpoint_dataset_summary
288+
) as eds on edits.endpoint = eds.endpoint
284289
{dataset_clause}
285-
and endpoint_end_date = ''
290+
and eds.endpoint_end_date = ''
286291
limit 1000 offset {offset}
287292
"""
288293
return get_datasette_query("performance", sql)
@@ -299,7 +304,7 @@ def get_odp_issues_by_issue_type(dataset_types, cohorts):
299304
datasets = ALL_DATASETS
300305

301306
dataset_clause = "WHERE " + " or ".join(
302-
("dataset = '" + str(dataset) + "'" for dataset in datasets)
307+
("edits.dataset = '" + str(dataset) + "'" for dataset in datasets)
303308
)
304309

305310
pagination_incomplete = True
@@ -329,8 +334,8 @@ def get_odp_issues_by_issue_type(dataset_types, cohorts):
329334
"collection",
330335
"endpoint",
331336
"endpoint_url",
332-
"status",
333-
"exception",
337+
"latest_status",
338+
"latest_exception",
334339
"resource",
335340
"latest_log_entry_date",
336341
"endpoint_entry_date",

0 commit comments

Comments
 (0)