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

Generate BibTeX from DOIs #10

Merged
merged 23 commits into from
Jun 1, 2023
Merged

Conversation

stefanbringuier
Copy link
Contributor

I'm using this repo list extensively for my references, but want to be able to continuously update my Zotero library from this list using a .bib file. This is my approach, but I'm sure better and more streamlined implementations can be devised. Maybe it's useful for others, but if you think it clutters the tree up, feel free to reject.

Changes Made

Introduces the bibtex/generate_bibtex.py script to the repository. This script serves to create a BibTeX bibliography from the DOI's in the readme.md file.

Description of the generate_bibtex.py script

The generate_bibtex.py script performs the following functions:

  1. Reads DOI's from readme.md and request BibTeX entry from server.
  2. Writes BibTeX entries into bibtex/references.bib file.

GitHub Action Integration

Introduced job run-script in .github/workflow/references.yml which is set to execute upon a push to the main branch. The job includes the GitHub action Add & Commit for the file bibtex/references.bib. This requires workflow read and write permissions.

Limitations

  • Duplicate citation keys not checked or handled (TODO).
  • Server request must support returning BibTeX entry, otherwise ignored.

bibtex/generate_bibtex.py Outdated Show resolved Hide resolved
.github/workflows/references.yml Outdated Show resolved Hide resolved
.github/workflows/references.yml Outdated Show resolved Hide resolved
.github/workflows/references.yml Show resolved Hide resolved
.github/workflows/references.yml Outdated Show resolved Hide resolved
@sgbaird
Copy link
Member

sgbaird commented May 31, 2023

I'm using this repo list extensively for my references

So glad to hear this! 😄

but want to be able to continuously update my Zotero library from this list using a .bib file.

This is very timely! I was thinking about this just recently. I pulled most of these references from one of my Zotero group folders for a community review of low-cost SDLs. I changed this to "Public Closed" just now, so you should be able to view it.

This is my approach, but I'm sure better and more streamlined implementations can be devised. Maybe it's useful for others, but if you think it clutters the tree up, feel free to reject.

I was thinking about the following (with some of the pieces that were missing inspired by your PR):

  • create a "Public Open" Zotero group folder that mirrors the headings structure of this repo and contains only the references shown in the repo
  • auto-export the .bib file to a Google Drive file
  • Create a GitHub actions cron that regularly downloads the GDrive file and commits it to the repo for others to download

It looks like the Zotero API can access group folders ("User and Group Library URLs" section) and also initiate write requests. This could be done manually by adding the reference to the Zotero folder via the Zotero desktop app or programmatically via a GitHub action that uses the Zotero API to add new entries after a PR is merged.

I like your approach. It's already working and runs autonomously like SDLs 😉. Maybe in the future, we can do something with the Zotero group folder option.

I don't think the bibtex folder clutters the tree. If you think it would be better, I would be okay with the files being at the top level to make references.bib directly visible. Current organization is fine by me, too. Updating the README to mention the references.bib file is easy enough.

Also, thank you for the clear summary of this PR!

Lmk what you think of my requested changes.

@sgbaird
Copy link
Member

sgbaird commented May 31, 2023

For later, I took a quick stab at making a Zotero group folder that mirrors the structure: https://www.zotero.org/groups/5078606/awesome-self-driving-labs

stefanbringuier and others added 2 commits May 31, 2023 10:47
Co-authored-by: Sterling G. Baird <sterling.baird@utah.edu>
handle `dx.doi` prefix
@stefanbringuier
Copy link
Contributor Author

stefanbringuier commented May 31, 2023

For later, I took a quick stab at making a Zotero group folder that mirrors the structure: https://www.zotero.org/groups/5078606/awesome-self-driving-labs

This is great for me!

auto-export the .bib file to a Google Drive file

Does the Zotero API let you export .bib for group folders? If so, then might not need this step.

@sgbaird
Copy link
Member

sgbaird commented May 31, 2023

Does the Zotero API let you export .bib for group folders? If so, then might not need this step.

Good point! I'll check.

@sgbaird
Copy link
Member

sgbaird commented May 31, 2023

Looks like it's supported (read requests section):

https://www.zotero.org/support/dev/web_api/v3/basics#export_format

@stefanbringuier stefanbringuier requested a review from sgbaird May 31, 2023 22:43
@sgbaird sgbaird merged commit 1d10cc3 into AccelerationConsortium:main Jun 1, 2023
@sgbaird
Copy link
Member

sgbaird commented Jun 1, 2023

Thanks for the great contribution!

@stefanbringuier
Copy link
Contributor Author

Sure no problem. It looks like the git action for add and commit may be failing, this requires change the read and write permissions for the repo to enable. ad-m/github-push-action#96 (comment).

I'm seeing your issue #13 now.

@sgbaird
Copy link
Member

sgbaird commented Jun 1, 2023

@stefanbringuier thanks for linking that! Adjusting settings per the image in the linked comment was straightforward.

@sgbaird
Copy link
Member

sgbaird commented Jun 1, 2023

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.

2 participants