Skip to content

Commit

Permalink
New schema field - contact page (#1392)
Browse files Browse the repository at this point in the history
Motivated by #1383, this PR adds a new schema element for web-based
contact forms. In order to promote transparency, we'll still require a
primary contact person to be set in order to use this field.

- [x] add new schema element
- [x] add example of using schema element (uniprot)
- [x] add component to web UI
- [x] add curation guide
- [x] add unit tests for data integrity
  • Loading branch information
cthoyt authored Feb 11, 2025
1 parent 60c44c3 commit c0f9641
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 0 deletions.
8 changes: 8 additions & 0 deletions docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,14 @@ For the ORCID field, it understood that an ORCID record should correspond to an
individual in the same spirit as this policy, and that the ORCID service should
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_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
contact

#### Review of New Prefix Requests

Review of new prefix requests is handled by the Bioregistry Review Team, whose
Expand Down
4 changes: 4 additions & 0 deletions src/bioregistry/app/templates/resource.html
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,10 @@ <h5 style="margin: 0"><a href="{{ url_for("metaregistry_ui.resources") }}">Regis
Repository <i class="fab fa-github"></i>
</a>
{% endif %}
{%- if resource.contact_page %}
<a class="badge badge-pill badge-light" href="{{ resource.contact_page }}">
Contact Page <i class="fas fa-address-book"></i></i></a>
{%- endif %}
{% if obo_download %}
<a class="badge badge-pill badge-light" href="{{ obo_download }}">
OBO <i class="fas fa-download"></i>
Expand Down
1 change: 1 addition & 0 deletions src/bioregistry/data/bioregistry.json
Original file line number Diff line number Diff line change
Expand Up @@ -117233,6 +117233,7 @@
"name": "Rolf Apweiler",
"orcid": "0000-0001-7078-200X"
},
"contact_page": "https://www.uniprot.org/contact",
"contributor_extras": [
{
"email": "[email protected]",
Expand Down
13 changes: 13 additions & 0 deletions src/bioregistry/schema/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1123,6 +1123,19 @@
"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_page": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "A URL for a web page that has contact information, e.g., containing a contact form. It's required to have a primary contact to have this field, even if the primary contact isn't the preferred mechanism for contact. Only curate this field if a direct email is not available, as this is the least transparent option for contact.",
"title": "Contact Page"
},
"owners": {
"anyOf": [
{
Expand Down
7 changes: 7 additions & 0 deletions src/bioregistry/schema/struct.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,13 @@ class Resource(BaseModel):
"person and not be a listserve nor a shared email account."
),
)
contact_page: str | None = Field(
default=None,
description="A URL for a web page that has contact information, e.g., containing a contact form. "
"It's required to have a primary contact to have this field, even if the primary contact isn't the "
"preferred mechanism for contact. Only curate this field if a direct email is not available, as this "
"is the least transparent option for contact.",
)
owners: list[Organization] | None = Field(
default=None,
description="The owner of the corresponding identifier space. See also https://github.com/biopragmatics/"
Expand Down
19 changes: 19 additions & 0 deletions tests/test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -839,6 +839,25 @@ def test_contacts(self):
)
self.assert_contact_metadata(resource.contact)

def test_contact_page(self) -> None:
"""Test curation of contact page."""
for prefix, resource in self.registry.items():
if not resource.contact_page:
continue
with self.subTest(prefix=prefix):
self.assertIsNotNone(
resource.get_contact(),
msg="Any Bioregistry entry that curates a contact page also requires a primary "
"contact to promote transparency and openness",
)
self.assertTrue(
any(
resource.contact_page.startswith(protocol)
for protocol in ("https://", "http://")
),
msg="Contact page should be a valid URL",
)

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

0 comments on commit c0f9641

Please sign in to comment.