PubMed Screening Audit #4
This file contains hidden or 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
| name: PubMed Screening Audit | |
| on: | |
| schedule: | |
| # Avoid the top of the hour, where scheduled workflows are more likely to queue. | |
| - cron: "17 21 * * *" | |
| workflow_dispatch: | |
| inputs: | |
| retmax: | |
| description: "PubMed records per topic" | |
| required: false | |
| default: "25" | |
| lookback_days: | |
| description: "PubMed publication-date lookback window in days; use 0 for full search" | |
| required: false | |
| default: "14" | |
| permissions: | |
| contents: read | |
| jobs: | |
| pubmed-screen-audit: | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: hypertension | |
| strategy: | |
| fail-fast: false | |
| max-parallel: 1 | |
| matrix: | |
| include: | |
| - domain: hypertension | |
| label: hypertension | |
| topics: config/pubmed_screen_topics.json | |
| - domain: nasal | |
| label: nasal | |
| topics: config/pubmed_screen_topics_nasal.json | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install package | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install -e . | |
| - name: Run PubMed screening and predownload | |
| env: | |
| NCBI_API_KEY: ${{ secrets.NCBI_API_KEY }} | |
| NCBI_EMAIL: ${{ secrets.NCBI_EMAIL }} | |
| RETMAX: ${{ github.event.inputs.retmax || '25' }} | |
| LOOKBACK_DAYS: ${{ github.event.inputs.lookback_days || '14' }} | |
| REQUEST_PAUSE_SECONDS: "0.4" | |
| DOMAIN: ${{ matrix.domain }} | |
| TOPICS: ${{ matrix.topics }} | |
| run: | | |
| set -euo pipefail | |
| AUDIT_DATE="$(date -u +%F)" | |
| DAILY_DIR="audits/daily/${AUDIT_DATE}/${DOMAIN}" | |
| PMC_DIR="staging/pmc_xml/${AUDIT_DATE}/${DOMAIN}" | |
| REPORT_DIR="reports/daily/${AUDIT_DATE}/${DOMAIN}" | |
| mkdir -p "${DAILY_DIR}" "${PMC_DIR}" "${REPORT_DIR}" | |
| python scripts/auto_pubmed_screen.py \ | |
| --topics "${TOPICS}" \ | |
| --output "${DAILY_DIR}/pubmed-screen-${DOMAIN}.jsonl" \ | |
| --retmax "${RETMAX}" \ | |
| --lookback-days "${LOOKBACK_DAYS}" \ | |
| --request-pause-seconds "${REQUEST_PAUSE_SECONDS}" | |
| python scripts/download_from_audit.py \ | |
| --audit "${DAILY_DIR}/pubmed-screen-${DOMAIN}.jsonl" \ | |
| --decisions "${DAILY_DIR}/pubmed-download-decisions-${DOMAIN}.jsonl" \ | |
| --citation-shells "${DAILY_DIR}/pubmed-citation-shells-${DOMAIN}.jsonl" \ | |
| --output-dir "${PMC_DIR}" \ | |
| --evidence-root evidence | |
| python scripts/render_audit_report.py \ | |
| --domain "${DOMAIN}" \ | |
| --date "${AUDIT_DATE}" \ | |
| --audit "${DAILY_DIR}/pubmed-screen-${DOMAIN}.jsonl" \ | |
| --decisions "${DAILY_DIR}/pubmed-download-decisions-${DOMAIN}.jsonl" \ | |
| --output-dir "${REPORT_DIR}" | |
| - name: Upload audit artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: pubmed-screen-audit-${{ matrix.label }} | |
| path: | | |
| hypertension/audits/daily/**/*.jsonl | |
| hypertension/staging/pmc_xml/**/*.xml | |
| hypertension/reports/daily/**/*.html | |
| hypertension/reports/daily/**/*.md | |
| if-no-files-found: error |