From 0e2d7101a97555ca82ecdfd6d8ed24cfadb73183 Mon Sep 17 00:00:00 2001 From: James B Date: Tue, 11 Mar 2025 16:00:58 +0000 Subject: [PATCH 1/8] Move common code to a included template to avoid reptition --- .../frontend/templates/results-list.html | 43 ++++++ prefix_finder/frontend/templates/results.html | 132 +----------------- 2 files changed, 46 insertions(+), 129 deletions(-) create mode 100644 prefix_finder/frontend/templates/results-list.html diff --git a/prefix_finder/frontend/templates/results-list.html b/prefix_finder/frontend/templates/results-list.html new file mode 100644 index 0000000..a41b5bc --- /dev/null +++ b/prefix_finder/frontend/templates/results-list.html @@ -0,0 +1,43 @@ +
+
+
+
+
+
+

{{ result.name.en }}

+

{{ result.code }}

+
+ +
+
+

{{ result.description.en|truncatewords_html:50 }}

+
+ +
+ {% if result.coverage %} +
    +

    Countries

    + {% for coverage in result.coverage %} +
  • {{ coverage }}
  • + {% endfor %} +
+ {% endif %} + + {% if result.sector %} +
    +

    Sectors

    + {% for sector in result.sector %} +
  • {{ sector }}
  • + {% endfor %} +
+ {% endif %} +
+
+ + +
+
\ No newline at end of file diff --git a/prefix_finder/frontend/templates/results.html b/prefix_finder/frontend/templates/results.html index 306da14..2efe1dc 100644 --- a/prefix_finder/frontend/templates/results.html +++ b/prefix_finder/frontend/templates/results.html @@ -19,49 +19,7 @@

Suggested Lists

{% for result in all_results.suggested %} -
-
-
-
-
-
-

{{ result.name.en }}

-

{{ result.code }}

-
- -
-
-

{{ result.description.en|truncatewords_html:50 }}

-
- -
- {% if result.coverage %} -
    -

    Countries

    - {% for coverage in result.coverage %} -
  • {{ coverage }}
  • - {% endfor %} -
- {% endif %} - - {% if result.sector %} -
    -

    Sectors

    - {% for sector in result.sector %} -
  • {{ sector }}
  • - {% endfor %} -
- {% endif %} -
-
- - -
-
+ {% include "results-list.html" with result_class="suggested" %} {% endfor %}
@@ -80,49 +38,7 @@

Possible Lists

{% for result in all_results.recommended %} -
-
-
-
-
-
-

{{ result.name.en }}

-

{{ result.code }}

-
- -
-
-

{{ result.description.en|truncatewords_html:50 }}

-
- -
- {% if result.coverage %} -
    -

    Countries

    - {% for coverage in result.coverage %} -
  • {{ coverage }}
  • - {% endfor %} -
- {% endif %} - - {% if result.sector %} -
    -

    Sectors

    - {% for sector in result.sector %} -
  • {{ sector }}
  • - {% endfor %} -
- {% endif %} -
-
- - -
-
+ {% include "results-list.html" with result_class="possible" %} {% endfor %}
@@ -139,49 +55,7 @@

Fall back identifier sources

{% for result in all_results.other %} -
-
-
-
-
-
-

{{ result.name.en }}

-

{{ result.code }}

-
- -
-
-

{{ result.description.en|truncatewords_html:50 }}

-
- -
- {% if result.coverage %} -
    -

    Countries

    - {% for coverage in result.coverage %} -
  • {{ coverage }}
  • - {% endfor %} -
- {% endif %} - - {% if result.sector %} -
    -

    Sectors

    - {% for sector in result.sector %} -
  • {{ sector }}
  • - {% endfor %} -
- {% endif %} -
-
- - -
-
+ {% include "results-list.html" with result_class="fallback" %} {% endfor %}
From 2a2444243c0787e85b9426d5bbc4d4430bfcb0db Mon Sep 17 00:00:00 2001 From: James B Date: Tue, 11 Mar 2025 16:06:00 +0000 Subject: [PATCH 2/8] Search results page - remove direct link to site URL, always send user to list info page --- prefix_finder/frontend/templates/results-list.html | 1 - 1 file changed, 1 deletion(-) diff --git a/prefix_finder/frontend/templates/results-list.html b/prefix_finder/frontend/templates/results-list.html index a41b5bc..947fe37 100644 --- a/prefix_finder/frontend/templates/results-list.html +++ b/prefix_finder/frontend/templates/results-list.html @@ -35,7 +35,6 @@

Sectors

From 22e218f6b7f97b3cf9421ba6374938970461b46b Mon Sep 17 00:00:00 2001 From: James B Date: Tue, 11 Mar 2025 16:11:37 +0000 Subject: [PATCH 3/8] sidebar - sometimes don't show links Don't show download links on list or results page because user probably expects a filtered download and instead they get a download of everything. Don't show about button on about page ... because you are already there. --- prefix_finder/frontend/templates/about.html | 2 +- prefix_finder/frontend/templates/list.html | 2 +- prefix_finder/frontend/templates/results.html | 2 +- prefix_finder/frontend/templates/sidebar.html | 4 ++++ 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/prefix_finder/frontend/templates/about.html b/prefix_finder/frontend/templates/about.html index 72916ab..389bbaa 100644 --- a/prefix_finder/frontend/templates/about.html +++ b/prefix_finder/frontend/templates/about.html @@ -2,7 +2,7 @@ {% load i18n %} {% block main %}
- {% include "sidebar.html" %} + {% include "sidebar.html" with sidebar_show_about_link=False %}

{% trans "About" %}

diff --git a/prefix_finder/frontend/templates/list.html b/prefix_finder/frontend/templates/list.html index 906bdf6..274a8b2 100644 --- a/prefix_finder/frontend/templates/list.html +++ b/prefix_finder/frontend/templates/list.html @@ -5,7 +5,7 @@ {% block main %}
- {% include "sidebar.html" %} + {% include "sidebar.html" with sidebar_show_download_links=False %}
diff --git a/prefix_finder/frontend/templates/results.html b/prefix_finder/frontend/templates/results.html index 2efe1dc..aef0547 100644 --- a/prefix_finder/frontend/templates/results.html +++ b/prefix_finder/frontend/templates/results.html @@ -3,7 +3,7 @@ {% block main %}
- {% include "sidebar.html" %} + {% include "sidebar.html" with sidebar_show_download_links=False %}
diff --git a/prefix_finder/frontend/templates/sidebar.html b/prefix_finder/frontend/templates/sidebar.html index 4b11671..d2b2230 100644 --- a/prefix_finder/frontend/templates/sidebar.html +++ b/prefix_finder/frontend/templates/sidebar.html @@ -84,11 +84,15 @@
+ {% if sidebar_show_about_link is None or sidebar_show_about_link is True %} About + {% endif %} + {% if sidebar_show_download_links is None or sidebar_show_download_links is True %}
Download
JSON CSV XML + {% endif %}
From c085b95af634b9ae8643465c2b135ce2e1f72a3a Mon Sep 17 00:00:00 2001 From: James B Date: Thu, 24 Apr 2025 09:14:23 +0100 Subject: [PATCH 4/8] Depreciated lists - quality score 0 and in special section in results https://github.com/OpenDataServices/org-ids/pull/277 --- prefix_finder/frontend/static/css/main.css | 7 +++ prefix_finder/frontend/templates/results.html | 18 ++++++++ prefix_finder/frontend/views.py | 45 +++++++++++-------- 3 files changed, 51 insertions(+), 19 deletions(-) diff --git a/prefix_finder/frontend/static/css/main.css b/prefix_finder/frontend/static/css/main.css index c410626..06565e1 100644 --- a/prefix_finder/frontend/static/css/main.css +++ b/prefix_finder/frontend/static/css/main.css @@ -538,6 +538,10 @@ fieldset { background-color: #C02942; } +.card--depreciated header { + background-color: rgba(0, 0, 0, 0.7);; +} + .topbar { position: relative; background-color: rgba(0, 0, 0, 0.05); @@ -876,6 +880,9 @@ fieldset { .list-group--fallback h1 { background-color: #C02942; } +.list-group--depreciated h1 { + background-color:rgba(0, 0, 0, 0.7); +} .single-content { margin-left: auto; diff --git a/prefix_finder/frontend/templates/results.html b/prefix_finder/frontend/templates/results.html index aef0547..8f662cf 100644 --- a/prefix_finder/frontend/templates/results.html +++ b/prefix_finder/frontend/templates/results.html @@ -59,6 +59,24 @@

Fall back identifier sources

{% endfor %}
+ +
+
+

Deprecated lists

+ {% if all_results.depreciated %} +

The following lists are for reference only. You may see them used in old data.

+ {% else %} +

No deprecated lists meet the search criteria.

+ {% endif %} +
+ +
+ {% for result in all_results.depreciated %} + {% include "results-list.html" with result_class="depreciated" %} + {% endfor %} +
+
+
{% endblock %} diff --git a/prefix_finder/frontend/views.py b/prefix_finder/frontend/views.py index 0474aa6..7b5cc52 100644 --- a/prefix_finder/frontend/views.py +++ b/prefix_finder/frontend/views.py @@ -119,25 +119,29 @@ def augment_quality(schemas, org_id_lists): for prefix in org_id_lists: quality = 0 quality_explained = {} - for item in (prefix.get('data', {}).get('availability') or []): - value = availabilty_score.get(item) - if value: - quality += value - quality_explained["Availability: " + availabilty_names[item]] = value - else: - print('No availiablity type {}. Found in code {}'.format(item, prefix['code'])) - if prefix['data'].get('licenseStatus'): - quality += license_score[prefix['data']['licenseStatus']] - quality_explained["License: " + license_names[prefix['data']['licenseStatus']]] = license_score[prefix['data']['licenseStatus']] + if prefix.get("deprecated"): + quality_explained["Deprecated"] = 0 + else: + for item in (prefix.get('data', {}).get('availability') or []): + value = availabilty_score.get(item) + if value: + quality += value + quality_explained["Availability: " + availabilty_names[item]] = value + else: + print('No availiablity type {}. Found in code {}'.format(item, prefix['code'])) + + if prefix['data'].get('licenseStatus'): + quality += license_score[prefix['data']['licenseStatus']] + quality_explained["License: " + license_names[prefix['data']['licenseStatus']]] = license_score[prefix['data']['licenseStatus']] - if prefix.get('listType'): - value = listtype_score.get(prefix['listType']) - if value: - quality += value - quality_explained["List type: " + listtype_names[prefix['listType']]] = value - else: - print('No licenseStatus for {}. Found in code {}'.format(prefix['listType'], prefix['code'])) + if prefix.get('listType'): + value = listtype_score.get(prefix['listType']) + if value: + quality += value + quality_explained["List type: " + listtype_names[prefix['listType']]] = value + else: + print('No licenseStatus for {}. Found in code {}'.format(prefix['listType'], prefix['code'])) prefix['quality_explained'] = quality_explained prefix['quality'] = min(quality, 100) @@ -316,7 +320,8 @@ def filter_and_score_results(query,use_branch="main"): all_results = {"suggested": [], "recommended": [], - "other": []} + "other": [], + "depreciated": [],} if not indexed: return all_results @@ -324,7 +329,9 @@ def filter_and_score_results(query,use_branch="main"): for num, value in enumerate(sorted(indexed.values(), key=lambda k: -(k['relevance'] * 100 + k['quality']))): add_titles(value) - if (value['relevance'] >= RELEVANCE["SUGGESTED_RELEVANCE_THRESHOLD"] + if (value.get("deprecated")): + all_results['depreciated'].append(value) + elif (value['relevance'] >= RELEVANCE["SUGGESTED_RELEVANCE_THRESHOLD"] and value['quality'] > RELEVANCE["SUGGESTED_QUALITY_THRESHOLD"] and not all_results['suggested'] or (all_results['suggested'] and value['relevance'] == all_results['suggested'][0]['relevance'])): all_results['suggested'].append(value) From aa41409cf74a226414df7a9817c3a6d532044289 Mon Sep 17 00:00:00 2001 From: James B Date: Wed, 17 Sep 2025 16:44:29 +0100 Subject: [PATCH 5/8] Rename Back button on list pages https://github.com/OpenDataServices/org-ids/pull/278 --- prefix_finder/frontend/templates/sidebar.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/prefix_finder/frontend/templates/sidebar.html b/prefix_finder/frontend/templates/sidebar.html index d2b2230..08c55a9 100644 --- a/prefix_finder/frontend/templates/sidebar.html +++ b/prefix_finder/frontend/templates/sidebar.html @@ -6,9 +6,9 @@