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

Fix/12832 pubmed url import #12839

Merged
merged 16 commits into from
Apr 9, 2025

Conversation

DenizAltunkapan
Copy link
Contributor

Closes #12832

Description

This PR ensures that when importing from PubMed, the PubMed URL is automatically added to the URL field if it is missing.

  • Extracts the PubMed ID (PMID) from the article metadata.
  • If no URL field is found, constructs a PubMed URL using https://pubmed.ncbi.nlm.nih.gov/{PMID}/.
  • Ensures that an existing URL entry is not overwritten.
  • Improves performance by iterating over the articleIdList only once.

image
image

Before:
image

After:
image

Mandatory checks

  • I own the copyright of the code submitted and I license it under the MIT license
  • Change in CHANGELOG.md described in a way that is understandable for the average user (if change is visible to the user)
  • Tests created for changes (if applicable)
  • Manually tested changed features in running JabRef (always required)
  • Screenshots added in PR description (if change is visible to the user)
  • Checked developer's documentation: Is the information available and up to date? If not, I outlined it in this pull request.
  • Checked documentation: Is the information available and up to date? If not, I created an issue at https://github.com/JabRef/user-documentation/issues or, even better, I submitted a pull request to the documentation repository.

@DenizAltunkapan
Copy link
Contributor Author

DenizAltunkapan commented Mar 27, 2025

i'll adjust the needed files for the tests tmrw.

@DenizAltunkapan
Copy link
Contributor Author

I don't understand the failing OpenRewrite test. Can you help me out? @koppor

@koppor
Copy link
Member

koppor commented Mar 28, 2025

I don't understand the failing OpenRewrite test. Can you help me out? @koppor

Execute

./gradlew rewriteRun

and check the diff.

Does that work in your side?

@@ -1,4 +1,5 @@
@TechReport{,
doi = {10.1016/j.cpr.2005.02.002},
pmid = {22664220},
location-id = {https://pubmed.ncbi.nlm.nih.gov/22664220/ [pii]},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should that get the URL maybe?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simply using 'url' doesn't work because of the 'LID' in the corresponding .txt file. I couldn't find a better solution for this, so maybe it could have just been left out, but this also works.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should i remove it? @koppor

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like the suffix can be stripped somehow?
Maybe @ryan-carpenter has an idea for this

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there might be some misunderstanding. We want the URL of the PubMed record, which is not included in the AID or LID field and does not belong there. Those contain identifiers and locations from the publisher.

Valid URLs can be formed from the PMID and/or PMCID fields (two different URLs), regardless of the data in AID and LID. I'm not sure what the best standard bibtex field is for this. Other databases use the url field, which I think is non-standard.

The suffix [pii] is not important to keep after the PII data is parsed into the correct fields. It's the same as DOI. You don't need to keep [DOI] after moving the data into the doi field.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about now? @koppor @Siedlerchr

Copy link

trag-bot bot commented Apr 9, 2025

@trag-bot didn't find any issues in the code! ✅✨

@Siedlerchr Siedlerchr added this pull request to the merge queue Apr 9, 2025
Merged via the queue into JabRef:main with commit 8ce0753 Apr 9, 2025
38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Include PubMed URL in the "URL" Field When Importing from PubMed
4 participants