Openverse is a search engine for openly-licensed media. This monorepo includes all application code.
Add SuggestedSubProvider type (#1040)
Staci Mullinsb8dee5c0bf62
diff --git a/openverse_catalog/dags/maintenance/flickr_audit_sub_provider_workflow.py b/openverse_catalog/dags/maintenance/flickr_audit_sub_provider_workflow.pyindex 3f6d906b0..f23ecf520 100644--- a/openverse_catalog/dags/maintenance/flickr_audit_sub_provider_workflow.py+++ b/openverse_catalog/dags/maintenance/flickr_audit_sub_provider_workflow.py@@ -7,6 +7,7 @@ DAG. Report suggestions for new sub-providers to Slack."""import logging+from typing import NamedTuplefrom airflow import DAGfrom airflow.exceptions import AirflowSkipException@@ -25,6 +26,21 @@ DAG_ID = "flickr_audit_sub_provider_workflow"MAX_ACTIVE = 1+class SuggestedSubProvider(NamedTuple):+ """+ A Flickr Commons institution which should be considered for addition as a+ Flickr sub-provider.++ name: The name of the institution+ nsid: The unique id of the institution+ cc_count: The number of CC-licensed images for this institution+ """++ name: str+ nsid: str+ cc_count: int++class FlickrSubProviderAuditor:endpoint = "https://www.flickr.com/services/rest"@@ -101,7 +117,7 @@ class FlickrSubProviderAuditor:return countdef get_new_institutions_with_cc_licensed_images(self):- new_institutions_with_cc_images = []+ new_institutions_with_cc_images: list[SuggestedSubProvider] = []# Get the full list of Flickr commons institutions from the APIinstitutions = self.get_institutions()@@ -130,7 +146,9 @@ class FlickrSubProviderAuditor:# Otherwise, consider this institution for addition as a# sub-provider.- new_institutions_with_cc_images.append((name, nsid, cc_count))+ new_institutions_with_cc_images.append(+ SuggestedSubProvider(name, nsid, cc_count)+ )return new_institutions_with_cc_images