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 element: secondary reviewers #1415

Merged
merged 3 commits into from
Feb 14, 2025
Merged
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
5 changes: 5 additions & 0 deletions src/bioregistry/app/templates/resource.html
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,11 @@ <h5 style="margin: 0"><a href="{{ url_for("metaregistry_ui.resources") }}">Regis
<dd>
{{ utils.render_author(resource.reviewer, link=url_for('metaregistry_ui.contributor', orcid=resource.reviewer.orcid)) }}
</dd>
{%- for reviewer in resource.reviewer_extras or [] %}
<dd>
{{ utils.render_author(reviewer, link=url_for('metaregistry_ui.contributor', orcid=reviewer.orcid)) }}
</dd>
{%- endfor %}
{% endif %}
</dl>
</div>
Expand Down
5 changes: 5 additions & 0 deletions src/bioregistry/curation/cleanup_authors.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ def _new(orcid_: str) -> Attributable:
resource.contributor = _new(resource.contributor.orcid)
if resource.reviewer and resource.reviewer.orcid:
resource.reviewer = _new(resource.reviewer.orcid)
if resource.reviewer_extras:
resource.reviewer_extras = [
_new(reviewer.orcid) if reviewer.orcid else reviewer
for reviewer in resource.reviewer_extras
]
if resource.contact and resource.contact.orcid:
resource.contact = _new(resource.contact.orcid)
if resource.contributor_extras:
Expand Down
4 changes: 3 additions & 1 deletion src/bioregistry/curation/find_contact_groups.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
"""Find group emails."""

import click
from tabulate import tabulate

import bioregistry
from bioregistry.constants import DISALLOWED_EMAIL_PARTS


@click.command()
def main() -> None:
"""Find group mails."""
rows = []
Expand All @@ -21,7 +23,7 @@ def main() -> None:
url = ""

rows.append((resource.prefix, resource.get_name(), contact.name, contact.email, url))
print(tabulate(rows))
click.echo(tabulate(rows))


if __name__ == "__main__":
Expand Down
8 changes: 8 additions & 0 deletions src/bioregistry/data/bioregistry.json
Original file line number Diff line number Diff line change
Expand Up @@ -105289,6 +105289,14 @@
"name": "Benjamin M. Gyori",
"orcid": "0000-0001-9439-5346"
},
"reviewer_extras": [
{
"email": "[email protected]",
"github": "cthoyt",
"name": "Charles Tapley Hoyt",
"orcid": "0000-0003-4423-4370"
}
],
"uri_format": "https://pubseed.theseed.org/SubsysEditor.cgi?page=FunctionalRolePage&fr=$1"
},
"seed.subsystem": {
Expand Down
19 changes: 13 additions & 6 deletions src/bioregistry/export/rdf_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,14 +227,21 @@ def _add_resource( # noqa:C901

contact = resource.get_contact()
if contact is not None:
contact_node = contact.add_triples(graph)
graph.add((node, bioregistry_schema["0000019"], contact_node))
graph.add((node, bioregistry_schema["0000019"], contact.add_triples(graph)))
for contact in resource.contact_extras or []:
graph.add((node, bioregistry_schema["0000019"], contact.add_triples(graph)))

if resource.reviewer is not None and resource.reviewer.orcid:
reviewer_node = resource.reviewer.add_triples(graph)
graph.add((node, bioregistry_schema["0000021"], reviewer_node))
graph.add((node, bioregistry_schema["0000021"], resource.reviewer.add_triples(graph)))
for reviewer in resource.reviewer_extras or []:
if reviewer.orcid:
graph.add((node, bioregistry_schema["0000021"], reviewer.add_triples(graph)))

if resource.contributor is not None and resource.contributor.orcid:
contributor_node = resource.contributor.add_triples(graph)
graph.add((contributor_node, DCTERMS.contributor, node))
graph.add((node, DCTERMS.contributor, resource.contributor.add_triples(graph)))
for contributor in resource.contributor_extras or []:
if contributor.orcid:
graph.add((node, DCTERMS.contributor, contributor.add_triples(graph)))

mappings = resource.get_mappings()
for metaprefix, metaidentifier in (mappings or {}).items():
Expand Down
3 changes: 3 additions & 0 deletions src/bioregistry/resource_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -1663,6 +1663,9 @@ def _read_contributors(
rv[contributor.orcid] = contributor
if resource.reviewer and resource.reviewer.orcid:
rv[resource.reviewer.orcid] = resource.reviewer
for reviewer in resource.reviewer_extras or []:
if reviewer.orcid:
rv[reviewer.orcid] = reviewer
if not direct_only:
contact = resource.get_contact()
if contact and contact.orcid:
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 @@ -1561,6 +1561,22 @@
"default": null,
"description": "The reviewer of the prefix to the Bioregistry, including at a minimum their name and ORCiD and optional their email address and GitHub handle. All entries curated through the Bioregistry GitHub Workflow should contain this field pointing to the person who reviewed it on GitHub."
},
"reviewer_extras": {
"anyOf": [
{
"items": {
"$ref": "#/$defs/Author"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Additional reviewers of the prefix.",
"title": "Reviewer Extras"
},
"proprietary": {
"anyOf": [
{
Expand Down
7 changes: 6 additions & 1 deletion src/bioregistry/schema/struct.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,8 @@ class Resource(BaseModel):
)
contact_group_email: EmailStr | None = Field(
default=None,
description="A group contact email for the project. It's required to have a primary contact to have this field.",
description="A group contact email for the project. It's required to have a primary contact "
"to have this field.",
)
contact_page: str | None = Field(
default=None,
Expand Down Expand Up @@ -564,6 +565,10 @@ class Resource(BaseModel):
"""
),
)
reviewer_extras: list[Author] | None = Field(
default=None,
description="Additional reviewers of the prefix.",
)
proprietary: bool | None = Field(
default=None,
description=_dedent(
Expand Down
3 changes: 3 additions & 0 deletions src/bioregistry/schema_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,9 @@ def read_prefix_reviews(registry: Mapping[str, Resource]) -> Mapping[str, set[st
for prefix, resource in registry.items():
if resource.reviewer and resource.reviewer.orcid:
rv[resource.reviewer.orcid].add(prefix)
for reviewer in resource.reviewer_extras or []:
if reviewer.orcid:
rv[reviewer.orcid].add(prefix)
return dict(rv)


Expand Down
16 changes: 16 additions & 0 deletions tests/test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -817,6 +817,22 @@ def test_reviewers(self):
self.assertIsNotNone(resource.reviewer.github)
self.assert_contact_metadata(resource.reviewer)

def test_reviewers_extras(self) -> None:
"""Test extra reviewers."""
for prefix, resource in self.registry.items():
if not resource.reviewer_extras:
continue
with self.subTest(prefix=prefix):
self.assertIsNotNone(
resource.reviewer,
msg="If you have secondary reviewers, you must have a primary reviewer",
)
for reviewer in resource.reviewer_extras:
self.assertIsNotNone(reviewer.name)
self.assertIsNotNone(reviewer.orcid)
self.assertIsNotNone(reviewer.github)
self.assert_contact_metadata(reviewer)

def test_contacts(self):
"""Check contacts have minimal metadata."""
for prefix, resource in self.registry.items():
Expand Down