-
-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into provenance-poc
- Loading branch information
Showing
305 changed files
with
630,305 additions
and
220,513 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: Deploy | ||
on: | ||
workflow_dispatch: | ||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Run SSH command | ||
env: | ||
SSH_PRIVATE_KEY: ${{ secrets.AWS_PEM }} | ||
HOST: ${{ secrets.AWS_HOST }} | ||
run: | | ||
echo $SSH_PRIVATE_KEY | ssh -i /dev/stdin -o StrictHostKeyChecking=no "$HOST" "sh /data/services/restart_bioregistry.sh" | ||
mkdir -p ~/.ssh | ||
echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa | ||
chmod 600 ~/.ssh/id_rsa | ||
ssh -i ~/.ssh/id_rsa -o StrictHostKeyChecking=no "$HOST" "sh /data/services/restart_bioregistry.sh" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
name: Run Paper Ranking Script and Update Issue | ||
|
||
on: | ||
schedule: | ||
- cron: '0 0 1 * *' # runs on the first day of every month | ||
workflow_dispatch: | ||
|
||
jobs: | ||
paper-ranking: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: "3.12" | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r src/bioregistry/analysis/paper_ranking_requirements.txt | ||
- name: Set Date Variables | ||
id: set-date-variables | ||
run: | | ||
end_date=$(date +'%Y-%m-%d') | ||
start_date=$(date -d "$end_date - 30 days" +'%Y-%m-%d') | ||
echo "START_DATE=$start_date" >> $GITHUB_ENV | ||
echo "END_DATE=$end_date" >> $GITHUB_ENV | ||
- name: Set PYTHONPATH | ||
run: | | ||
echo "PYTHONPATH=$PWD/src" >> $GITHUB_ENV | ||
- name: Run Paper Ranking Script | ||
id: run-ranking-script | ||
run: | | ||
echo "PYTHONPATH=$PYTHONPATH" # Verify PYTHONPATH | ||
python src/bioregistry/analysis/paper_ranking.py --start-date ${{ env.START_DATE }} --end-date ${{ env.END_DATE }} | ||
- name: Upload Full List as Artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: full-predictions-list-${{ env.START_DATE }}-to-${{ env.END_DATE }} | ||
path: exports/analyses/paper_ranking/predictions_${{ env.START_DATE }}_to_${{ env.END_DATE }}.tsv | ||
|
||
- name: Find Existing Issue | ||
id: find-issue | ||
uses: actions/github-script@v6 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
const { data: issues } = await github.rest.issues.listForRepo({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
state: 'open', | ||
labels: 'paper-ranking-results' | ||
}); | ||
const issue = issues.find(issue => issue.title === 'Potentially relevant papers ranked for curation'); | ||
return issue ? issue.number : null; | ||
- name: Create or Update Issue with Comment | ||
id: create-or-update-issue | ||
uses: actions/github-script@v6 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
const fs = require('fs'); | ||
const issueNumber = ${{ steps.find-issue.outputs.result }}; | ||
const startDate = process.env.START_DATE; | ||
const endDate = process.env.END_DATE; | ||
const content = fs.readFileSync(`exports/analyses/paper_ranking/predictions_${startDate}_to_${endDate}.tsv`, 'utf8'); | ||
const lines = content.split('\n').slice(1, 21); | ||
const rows = lines.map(line => { | ||
const [pubmed, title] = line.split('\t'); | ||
const link = `https://bioregistry.io/pubmed:${pubmed}`; | ||
return `| [${pubmed}](${link}) | ${title} |`; | ||
}); | ||
const tableHeader = '| PubMed ID | Title |\n| --- | --- |\n'; | ||
const commentBody = `This issue contains monthly updates to an automatically ranked list of PubMed papers as candidates for curation in the Bioregistry. Papers may be relevant in at least three ways: \n(1) as a new prefix for a resource that can be added to the Bioregistry,\n(2) as a provider for an existing prefix, or\n(3) as a new publication for an existing prefix already in the Bioregistry.\n\nThese curations can happen in separate issues and pull requests. The full list of ranked papers can be found [here](https://github.com/${{ github.repository }}/blob/main/exports/analyses/paper_ranking/predictions_${startDate}_to_${endDate}.tsv). If you review any of these papers for relevance, you should edit the curated papers file [here](https://github.com/${{ github.repository }}/blob/main/src/bioregistry/data/curated_papers.tsv); these curations are taken into account when retraining the ranking model.\n\n**New entries for ${startDate} to ${endDate}:**\n\n${tableHeader}${rows.join('\n')}`; | ||
if (issueNumber) { | ||
await github.rest.issues.createComment({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
issue_number: issueNumber, | ||
body: commentBody, | ||
}); | ||
} else { | ||
const response = await github.rest.issues.create({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
title: 'Potentially relevant papers ranked for curation', | ||
body: `${commentBody}`, | ||
labels: ['paper-ranking-results'], | ||
}); | ||
core.setOutput('issue-number', response.data.number); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.