Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New schema field - secondary contact list #1388

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 20 additions & 6 deletions src/bioregistry/data/bioregistry.json
Original file line number Diff line number Diff line change
Expand Up @@ -116926,9 +116926,10 @@
"prefix": "UNIPARC"
},
"contact": {
"email": "[email protected]",
"name": "Rolf Apweiler",
"orcid": "0000-0001-7078-200X"
"email": "[email protected]",
"github": "bateman-research",
"name": "Alex Bateman",
"orcid": "0000-0002-6982-4660"
},
"edam": {
"description": "Accession number of a UniParc (protein sequence) database entry.",
Expand Down Expand Up @@ -117094,10 +117095,23 @@
"uri_format": "https://www.uniprot.org/uniprotkb/$1/entry"
},
"contact": {
"email": "[email protected]",
"name": "Rolf Apweiler",
"orcid": "0000-0001-7078-200X"
"email": "[email protected]",
"github": "bateman-research",
"name": "Alex Bateman",
"orcid": "0000-0002-6982-4660"
},
"contact_extras": [
{
"email": "[email protected]",
"name": "Alan Bridge",
"orcid": "0000-0003-2148-9135"
},
{
"email": "[email protected]",
"name": "Cathy Wu",
"orcid": "0000-0001-6379-8601"
}
],
"contributor_extras": [
{
"email": "[email protected]",
Expand Down
16 changes: 16 additions & 0 deletions src/bioregistry/schema/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
{
Expand Down
4 changes: 4 additions & 0 deletions src/bioregistry/schema/struct.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,10 @@ class Resource(BaseModel):
"person and not be a listserve nor a shared email account."
),
)
contact_extras: list[Attributable] | None = Field(
default=None,
description="Secondary contacts. It's required to have a primary contact to have this field.",
)
owners: list[Organization] | None = Field(
default=None,
description="The owner of the corresponding identifier space. See also https://github.com/biopragmatics/"
Expand Down
6 changes: 6 additions & 0 deletions src/bioregistry/schema_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,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)


Expand Down
12 changes: 12 additions & 0 deletions tests/test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -828,6 +828,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):
Expand All @@ -839,6 +842,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"))
Expand Down
Loading