From dad8aa704b5da2b60212b8c93cf6ef829b2d137e Mon Sep 17 00:00:00 2001 From: Charles Tapley Hoyt Date: Wed, 29 Jan 2025 14:54:40 +0100 Subject: [PATCH 01/10] Add secondary contacts to data model --- src/bioregistry/data/bioregistry.json | 24 ++++++++++++++++++------ src/bioregistry/schema/struct.py | 5 +++++ tests/test_data.py | 12 ++++++++++++ 3 files changed, 35 insertions(+), 6 deletions(-) diff --git a/src/bioregistry/data/bioregistry.json b/src/bioregistry/data/bioregistry.json index 040ce3ac8..8f55bc8ac 100644 --- a/src/bioregistry/data/bioregistry.json +++ b/src/bioregistry/data/bioregistry.json @@ -116926,9 +116926,10 @@ "prefix": "UNIPARC" }, "contact": { - "email": "apweiler@ebi.ac.uk", - "name": "Rolf Apweiler", - "orcid": "0000-0001-7078-200X" + "email": "agb@ebi.ac.uk", + "github": "bateman-research", + "name": "Alex Bateman", + "orcid": "0000-0002-6982-4660" }, "edam": { "description": "Accession number of a UniParc (protein sequence) database entry.", @@ -117094,10 +117095,21 @@ "uri_format": "https://www.uniprot.org/uniprotkb/$1/entry" }, "contact": { - "email": "apweiler@ebi.ac.uk", - "name": "Rolf Apweiler", - "orcid": "0000-0001-7078-200X" + "email": "agb@ebi.ac.uk", + "github": "bateman-research", + "name": "Alex Bateman", + "orcid": "0000-0002-6982-4660" }, + "contact_extras": [ + { + "email": "alan.bridge@sib.swiss", + "name": "Alan Bridge" + }, + { + "email": "wuc@udel.edu", + "name": "Cathy Wu" + } + ], "contributor_extras": [ { "email": "m.naguthana@hotmail.com", diff --git a/src/bioregistry/schema/struct.py b/src/bioregistry/schema/struct.py index 469234210..1083a193f 100644 --- a/src/bioregistry/schema/struct.py +++ b/src/bioregistry/schema/struct.py @@ -359,6 +359,11 @@ class Resource(BaseModel): "person and not be a listserve nor a shared email account." ), ) + contact_extras: Optional[List[Attributable]] = Field( + default=None, + description="Secondary contacts. It's required to have a primary contact to have this field.", + ) + owners: Optional[List[Organization]] = Field( default=None, description="The owner of the corresponding identifier space. See also https://github.com/biopragmatics/" diff --git a/tests/test_data.py b/tests/test_data.py index 09d1267b3..c63a0f2da 100644 --- a/tests/test_data.py +++ b/tests/test_data.py @@ -830,6 +830,9 @@ def test_reviewers(self): def test_contacts(self): """Check contacts have minimal metadata.""" for prefix, resource in self.registry.items(): + with self.subTest(prefix=prefix): + if resource.contact_extras: + self.assertIsNotNone(resource.contact) if not resource.contact: continue with self.subTest(prefix=prefix): @@ -841,6 +844,15 @@ def test_contacts(self): ) self.assert_contact_metadata(resource.contact) + def test_secondary_contacts(self): + """Check secondary contacts.""" + for prefix, resource in self.registry.items(): + if not resource.contact_extras: + continue + self.assertIsNotNone(resource.contact) + for contact in resource.contact_extras: + self.assert_contact_metadata(contact) + def test_wikidata_wrong_place(self): """Test that wikidata annotations aren't accidentally placed in the wrong place.""" registry_raw = json.loads(BIOREGISTRY_PATH.read_text(encoding="utf8")) From 21456892e1b510b55d1391e467e94f3801736afe Mon Sep 17 00:00:00 2001 From: Charles Tapley Hoyt Date: Wed, 29 Jan 2025 15:36:13 +0100 Subject: [PATCH 02/10] Update schema_utils.py --- src/bioregistry/schema_utils.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/bioregistry/schema_utils.py b/src/bioregistry/schema_utils.py index acff9595e..a7f6f8bff 100644 --- a/src/bioregistry/schema_utils.py +++ b/src/bioregistry/schema_utils.py @@ -203,6 +203,12 @@ def read_prefix_contacts(registry: Mapping[str, Resource]) -> Mapping[str, Set[s contact_orcid = resource.get_contact_orcid() if contact_orcid: rv[contact_orcid].add(prefix) + + # Add all secondary contacts' ORCIDs + for secondary_contact in resource.contact_extras: + if secondary_contact.orcid: + rv[secondary_contact.orcid].add(prefix) + return dict(rv) From 5cf4f8c5aeb2a330d3b1b78783c19e4069a27182 Mon Sep 17 00:00:00 2001 From: Charles Tapley Hoyt Date: Wed, 29 Jan 2025 15:36:30 +0100 Subject: [PATCH 03/10] Update bioregistry.json --- src/bioregistry/data/bioregistry.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/bioregistry/data/bioregistry.json b/src/bioregistry/data/bioregistry.json index 8f55bc8ac..b1c27f055 100644 --- a/src/bioregistry/data/bioregistry.json +++ b/src/bioregistry/data/bioregistry.json @@ -117103,11 +117103,13 @@ "contact_extras": [ { "email": "alan.bridge@sib.swiss", - "name": "Alan Bridge" + "name": "Alan Bridge", + "orcid": "0000-0003-2148-9135" }, { "email": "wuc@udel.edu", - "name": "Cathy Wu" + "name": "Cathy Wu", + "orcid": "0000-0001-6379-8601" } ], "contributor_extras": [ From fea19219efc964d3dc57120c2ea7d16633e9071b Mon Sep 17 00:00:00 2001 From: Charles Tapley Hoyt Date: Thu, 30 Jan 2025 10:48:32 +0100 Subject: [PATCH 04/10] Update schema --- src/bioregistry/schema/schema.json | 16 ++++++++++++++++ src/bioregistry/schema/struct.py | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/bioregistry/schema/schema.json b/src/bioregistry/schema/schema.json index 6713b3041..0af52d2fc 100644 --- a/src/bioregistry/schema/schema.json +++ b/src/bioregistry/schema/schema.json @@ -1123,6 +1123,22 @@ "default": null, "description": "The contact email address for the resource. This must correspond to a specific person and not be a listserve nor a shared email account." }, + "contact_extras": { + "anyOf": [ + { + "items": { + "$ref": "#/$defs/Attributable" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Secondary contacts. It's required to have a primary contact to have this field.", + "title": "Contact Extras" + }, "owners": { "anyOf": [ { diff --git a/src/bioregistry/schema/struct.py b/src/bioregistry/schema/struct.py index 73f0e370d..4073d7fde 100644 --- a/src/bioregistry/schema/struct.py +++ b/src/bioregistry/schema/struct.py @@ -342,7 +342,7 @@ class Resource(BaseModel): "person and not be a listserve nor a shared email account." ), ) - contact_extras: List[Attributable] | None = Field( + contact_extras: list[Attributable] | None = Field( default=None, description="Secondary contacts. It's required to have a primary contact to have this field.", ) From d1a92a55795ef2c8039f3cf12dbf5f43995d58fc Mon Sep 17 00:00:00 2001 From: Charles Tapley Hoyt Date: Tue, 11 Feb 2025 14:23:22 +0100 Subject: [PATCH 05/10] Update test_data.py --- tests/test_data.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/test_data.py b/tests/test_data.py index 101ac6d98..1f877418b 100644 --- a/tests/test_data.py +++ b/tests/test_data.py @@ -850,6 +850,9 @@ def test_secondary_contacts(self) -> None: self.assertIsNotNone(resource.contact) for contact in resource.contact_extras: self.assert_contact_metadata(contact) + self.assertNotEqual( + resource.contact.orcid, contact.orcid, msg="duplicate secondary contact" + ) def test_contact_page(self) -> None: """Test curation of contact page.""" From f4b88b3b5a03cc9a0a2bbabdd751d804fb940050 Mon Sep 17 00:00:00 2001 From: Charles Tapley Hoyt Date: Tue, 11 Feb 2025 14:25:36 +0100 Subject: [PATCH 06/10] Update test_data.py --- tests/test_data.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tests/test_data.py b/tests/test_data.py index 1f877418b..eea94ab07 100644 --- a/tests/test_data.py +++ b/tests/test_data.py @@ -847,12 +847,13 @@ def test_secondary_contacts(self) -> None: for prefix, resource in self.registry.items(): if not resource.contact_extras: continue - self.assertIsNotNone(resource.contact) - for contact in resource.contact_extras: - self.assert_contact_metadata(contact) - self.assertNotEqual( - resource.contact.orcid, contact.orcid, msg="duplicate secondary contact" - ) + with self.subTest(prefix=prefix): + self.assertIsNotNone(resource.contact) + for contact in resource.contact_extras: + self.assert_contact_metadata(contact) + self.assertNotEqual( + resource.contact.orcid, contact.orcid, msg="duplicate secondary contact" + ) def test_contact_page(self) -> None: """Test curation of contact page.""" From fc043f5212e48233a58244fccac9efdd91b4ecbf Mon Sep 17 00:00:00 2001 From: Charles Tapley Hoyt Date: Tue, 11 Feb 2025 14:25:38 +0100 Subject: [PATCH 07/10] Update resource.html --- src/bioregistry/app/templates/resource.html | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/bioregistry/app/templates/resource.html b/src/bioregistry/app/templates/resource.html index 56c336d02..82c78960a 100644 --- a/src/bioregistry/app/templates/resource.html +++ b/src/bioregistry/app/templates/resource.html @@ -236,6 +236,11 @@
Regis Missing Contact {% endif %} + {%- for secondary_contact in resource.contact_extras %} +
+ {{ utils.render_author(secondary_contact, link=none) }} +
+ {%- endfor %} {% if resource.owners %}
Identifier Space Owner{% if resource.owners | length > 1 %}s{% endif %}
{% for owner in resource.owners %} From 7540d4eb4a7a29ac3fc38ca81c6a2519affb8423 Mon Sep 17 00:00:00 2001 From: Charles Tapley Hoyt Date: Tue, 11 Feb 2025 14:26:32 +0100 Subject: [PATCH 08/10] Update CONTRIBUTING.md --- docs/CONTRIBUTING.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index 7c95afeb9..35cdea4aa 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -257,6 +257,7 @@ not be abused to represent any non-individual. In addition to the primary responsible contact person, the Bioregistry has structured fields for additional contact methods, such as: +- `contact_extras` for annotating secondary contact people - `contact_page` for annotating the URL of a web page that has contact information, e.g., containing a contact form. Only curate this field if a direct email is not available, as this is the least transparent option for From ac8a3b7f3aaf2688d8dfde9ed8bcdb7a4ed69c4e Mon Sep 17 00:00:00 2001 From: Charles Tapley Hoyt Date: Tue, 11 Feb 2025 14:28:05 +0100 Subject: [PATCH 09/10] Update schema_utils.py --- src/bioregistry/schema_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bioregistry/schema_utils.py b/src/bioregistry/schema_utils.py index 04207871c..2f5700b40 100644 --- a/src/bioregistry/schema_utils.py +++ b/src/bioregistry/schema_utils.py @@ -203,7 +203,7 @@ def read_prefix_contacts(registry: Mapping[str, Resource]) -> Mapping[str, set[s rv[contact_orcid].add(prefix) # Add all secondary contacts' ORCIDs - for secondary_contact in resource.contact_extras: + for secondary_contact in resource.contact_extras or []: if secondary_contact.orcid: rv[secondary_contact.orcid].add(prefix) From 6a8c13c1f4a54aca80a23011a34f4db6084c43de Mon Sep 17 00:00:00 2001 From: Charles Tapley Hoyt Date: Tue, 11 Feb 2025 14:42:25 +0100 Subject: [PATCH 10/10] Update resource.html --- src/bioregistry/app/templates/resource.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bioregistry/app/templates/resource.html b/src/bioregistry/app/templates/resource.html index 82c78960a..5c1f504d6 100644 --- a/src/bioregistry/app/templates/resource.html +++ b/src/bioregistry/app/templates/resource.html @@ -236,7 +236,7 @@
Regis Missing Contact {% endif %} - {%- for secondary_contact in resource.contact_extras %} + {%- for secondary_contact in resource.contact_extras or [] %}
{{ utils.render_author(secondary_contact, link=none) }}