From c3c42a606afcb7c22d1e9689bebdb4860fa4146c Mon Sep 17 00:00:00 2001 From: Charles Tapley Hoyt Date: Mon, 27 Nov 2023 11:59:02 +0100 Subject: [PATCH 1/5] Update new-prefix.yml --- .github/ISSUE_TEMPLATE/new-prefix.yml | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/new-prefix.yml b/.github/ISSUE_TEMPLATE/new-prefix.yml index 87eb01a5e..2e1612ea7 100644 --- a/.github/ISSUE_TEMPLATE/new-prefix.yml +++ b/.github/ISSUE_TEMPLATE/new-prefix.yml @@ -42,7 +42,7 @@ body: - type: input id: repository attributes: - label: Repository + label: GitHub Repository description: | What is the version control repository associated with this prefix? @@ -64,6 +64,14 @@ body: description: | What is the repository's license? Write with a SPDX identifier, if possible. placeholder: ex. CC0 + - type: input + id: publications + attributes: + label: Publications + description: | + If you have a PubMed identifier, PMC identifier, or DOI with an article associated with this resource, please put it here. Please write publications using CURIE syntax. Please delimit multiple entries with a pipe "|" character + placeholder: ex. doi:10.1101/2022.07.08.499378 | pubmed:36402838 | pmc:PMC9675740 + - type: input id: example attributes: @@ -129,7 +137,13 @@ body: placeholder: ex. 0000-0003-4423-4370 validations: required: true - + - type: input + id: contributor_email + attributes: + label: Contributor Email + description: Please provide your email address (optional) so others can contact you regarding your contribution + placeholder: ex. cthoyt@gmail.com + - type: input id: contact_name attributes: From 8d527e71edf4ab467cd16a6914225502825dc9f2 Mon Sep 17 00:00:00 2001 From: Charles Tapley Hoyt Date: Mon, 27 Nov 2023 12:11:24 +0100 Subject: [PATCH 2/5] Update workflow --- .github/ISSUE_TEMPLATE/new-prefix.yml | 4 ++-- src/bioregistry/gh/new_prefix.py | 21 +++++++++++++++++++-- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/new-prefix.yml b/.github/ISSUE_TEMPLATE/new-prefix.yml index 2e1612ea7..29477d101 100644 --- a/.github/ISSUE_TEMPLATE/new-prefix.yml +++ b/.github/ISSUE_TEMPLATE/new-prefix.yml @@ -69,8 +69,8 @@ body: attributes: label: Publications description: | - If you have a PubMed identifier, PMC identifier, or DOI with an article associated with this resource, please put it here. Please write publications using CURIE syntax. Please delimit multiple entries with a pipe "|" character - placeholder: ex. doi:10.1101/2022.07.08.499378 | pubmed:36402838 | pmc:PMC9675740 + If you have a PubMed identifier, PMC identifier, or DOI with an article associated with this resource, please put it here. Please write publications using CURIE syntax. Please delimit multiple unique publications with a pipe "|" character. You only need one CURIE for each publication. + placeholder: ex. doi:10.1101/2022.07.08.499378 | pubmed:33290552 | pmc:PMC4383985 - type: input id: example diff --git a/src/bioregistry/gh/new_prefix.py b/src/bioregistry/gh/new_prefix.py index fce4bdbec..8f6616437 100644 --- a/src/bioregistry/gh/new_prefix.py +++ b/src/bioregistry/gh/new_prefix.py @@ -12,13 +12,14 @@ from uuid import uuid4 import click +from curies import Reference from more_click import force_option, verbose_option import bioregistry from bioregistry.constants import BIOREGISTRY_PATH, URI_FORMAT_KEY from bioregistry.gh import github_client from bioregistry.license_standardizer import standardize_license -from bioregistry.schema import Author, Resource +from bioregistry.schema import Author, Publication, Resource from bioregistry.schema_utils import add_resource from bioregistry.utils import removeprefix @@ -41,7 +42,7 @@ "Contributor ORCiD": "contributor_orcid", "Contributor Name": "contributor_name", "Contributor GitHub": "contributor_github", - "Contributor Email": "contributor_email", + "Contributor Email": "contributor_email", # enabled in https://github.com/biopragmatics/bioregistry/pull/1000 "Contact ORCiD": "contact_orcid", "Contact Name": "contact_name", "Contact Email": "contact_email", @@ -119,6 +120,8 @@ def get_new_prefix_issues(token: Optional[str] = None) -> Mapping[int, Resource] if data_license: resource_data["license"] = standardize_license(data_license) or data_license + publications = list(_yield_publications(resource_data)) + if bioregistry.get_resource(prefix) is not None: # TODO close issue logger.warning( @@ -134,11 +137,25 @@ def get_new_prefix_issues(token: Optional[str] = None) -> Mapping[int, Resource] github_request_issue=issue_id, wikidata=wikidata, mappings=mappings, + publications=publications, **resource_data, # type:ignore ) return rv +def _yield_publications(data) -> List[Publication]: + for curie in data.pop("publications", "").split("|"): + curie = curie.strip().lower() + try: + prefix, luid = curie.split(":", 1) + except ValueError: + click.echo(f"invalid CURIE: {curie}") + continue + if prefix == "pmid": + prefix = "pubmed" + yield Publication(**{prefix: luid}) + + def _pop_orcid(data: Dict[str, str]) -> str: orcid = data.pop("contributor_orcid") return _trim_orcid(orcid) From ed2cf325db3e31b68e3354c38ab16fb9521dd49a Mon Sep 17 00:00:00 2001 From: Charles Tapley Hoyt Date: Mon, 27 Nov 2023 12:14:07 +0100 Subject: [PATCH 3/5] rename --- .github/ISSUE_TEMPLATE/new-prefix.yml | 2 +- src/bioregistry/gh/new_prefix.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/new-prefix.yml b/.github/ISSUE_TEMPLATE/new-prefix.yml index 29477d101..877a4bf2a 100644 --- a/.github/ISSUE_TEMPLATE/new-prefix.yml +++ b/.github/ISSUE_TEMPLATE/new-prefix.yml @@ -42,7 +42,7 @@ body: - type: input id: repository attributes: - label: GitHub Repository + label: Source Code Repository description: | What is the version control repository associated with this prefix? diff --git a/src/bioregistry/gh/new_prefix.py b/src/bioregistry/gh/new_prefix.py index 8f6616437..c2bb3b2fc 100644 --- a/src/bioregistry/gh/new_prefix.py +++ b/src/bioregistry/gh/new_prefix.py @@ -49,7 +49,7 @@ "Contact GitHub": "contact_github", "Wikidata Property": "wikidata_prefix", "License": "license", - "Repository": "repository", + "Source Code Repository": "repository", } ORCID_HTTP_PREFIX = "http://orcid.org/" From 6b60c18a9ff93ea3ce1f09a7a2eedda55fea824d Mon Sep 17 00:00:00 2001 From: Charles Tapley Hoyt Date: Mon, 27 Nov 2023 12:24:06 +0100 Subject: [PATCH 4/5] Update new_prefix.py --- src/bioregistry/gh/new_prefix.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/bioregistry/gh/new_prefix.py b/src/bioregistry/gh/new_prefix.py index c2bb3b2fc..2dcce7375 100644 --- a/src/bioregistry/gh/new_prefix.py +++ b/src/bioregistry/gh/new_prefix.py @@ -12,7 +12,6 @@ from uuid import uuid4 import click -from curies import Reference from more_click import force_option, verbose_option import bioregistry @@ -143,7 +142,7 @@ def get_new_prefix_issues(token: Optional[str] = None) -> Mapping[int, Resource] return rv -def _yield_publications(data) -> List[Publication]: +def _yield_publications(data) -> Iterable[Publication]: for curie in data.pop("publications", "").split("|"): curie = curie.strip().lower() try: From 0974a0216049dfb0dc93e4f325a935f74fd1a324 Mon Sep 17 00:00:00 2001 From: Charles Tapley Hoyt Date: Mon, 27 Nov 2023 12:24:37 +0100 Subject: [PATCH 5/5] Update new_prefix.py --- src/bioregistry/gh/new_prefix.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/bioregistry/gh/new_prefix.py b/src/bioregistry/gh/new_prefix.py index 2dcce7375..8de6e0421 100644 --- a/src/bioregistry/gh/new_prefix.py +++ b/src/bioregistry/gh/new_prefix.py @@ -48,6 +48,7 @@ "Contact GitHub": "contact_github", "Wikidata Property": "wikidata_prefix", "License": "license", + "Repository": "repository", # old "Source Code Repository": "repository", }