Skip to content

ARTEMIS pattern library update #15

ARTEMIS pattern library update

ARTEMIS pattern library update #15

name: ARTEMIS pattern library update
# Phase 3 Plan 7 Section B (T-024-carryover). Replaces the multi-stage
# Docker R-build approach. Runs the HemOnc R-package extractor on a
# Darkstar-class CI runner (r-base:4.4 + ohdsi r-universe deps) on a
# schedule + workflow_dispatch, materializes the v0.2.0 patterns.json,
# and auto-commits to main.
#
# Why this lives in CI rather than in the customer Dockerfile:
# - Customer ``docker build`` should NOT pay the ~5-15 min HemOnc
# install cost on every build.
# - HemOnc updates are infrequent (~quarterly); a centralized job +
# git-tracked JSON is faster + audit-friendly.
# - The committed patterns.json gives clinicians a reviewable diff
# when the regimen list changes.
#
# Pin the HemOnc commit via ``templates/runtime/oncology/artemis/ohdsi_pin.txt``
# (single line, either a SHA or a branch/tag name).
on:
schedule:
# 04:00 UTC every Monday — early enough that a regenerated JSON
# lands before the rest of the team's week begins.
- cron: "0 4 * * 1"
workflow_dispatch:
permissions:
contents: write # required for git push to main
jobs:
extract:
name: Extract ARTEMIS regimen library
runs-on: ubuntu-22.04
timeout-minutes: 60
container:
# r-base publishes only patch-pinned tags (4.4.0–4.4.3); the rolling
# `4.4` tag does not exist and 404s with "manifest unknown".
image: r-base:4.4.3
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Install system deps for HemOnc R-package
run: |
apt-get update
apt-get install -y --no-install-recommends \
libxml2-dev \
libssl-dev \
libcurl4-openssl-dev \
libfontconfig1-dev \
libfreetype6-dev \
ca-certificates \
curl \
git \
jq
- name: Read pinned HemOnc reference
id: pin
run: |
PIN_FILE=templates/runtime/oncology/artemis/ohdsi_pin.txt
if [ ! -s "$PIN_FILE" ]; then
echo "::error::pin file missing or empty: $PIN_FILE"
exit 1
fi
PIN=$(head -n 1 "$PIN_FILE" | tr -d '[:space:]')
echo "ref=$PIN" >> "$GITHUB_OUTPUT"
echo "Pinned HemOnc ref: $PIN"
- name: Check HemOnc source availability
id: hemonc
run: |
# HemOnc is license-gated and the public HemOnc-org/HemOnc repo is not
# resolvable anonymously. Probe it first; if unreachable, skip the
# extraction gracefully (job stays green) instead of failing the
# scheduled run red. Supply a reachable repo path or a PAT-authenticated
# remote in the steps below to re-enable extraction. Use curl (not
# git ls-remote) so a private/404 repo returns a status code instead
# of hanging on a credential prompt.
CODE=$(curl -s -o /dev/null -w '%{http_code}' \
"https://api.github.com/repos/HemOnc-org/HemOnc")
if [ "$CODE" = "200" ]; then
echo "available=true" >> "$GITHUB_OUTPUT"
echo "HemOnc source reachable — proceeding with extraction."
else
echo "available=false" >> "$GITHUB_OUTPUT"
echo "::warning title=ARTEMIS extraction skipped::HemOnc source (HemOnc-org/HemOnc) returned HTTP ${CODE} — skipping pattern extraction until a reachable source or PAT is supplied."
fi
- name: Install HemOnc R-package
if: steps.hemonc.outputs.available == 'true'
run: |
R -e "install.packages('remotes', repos='https://cloud.r-project.org')"
R -e "remotes::install_github('HemOnc-org/HemOnc@${{ steps.pin.outputs.ref }}', upgrade='never')"
- name: Run extractor
if: steps.hemonc.outputs.available == 'true'
run: |
mkdir -p templates/runtime/oncology/artemis/v0.2.0
Rscript templates/tools/extract_artemis_regimens.R \
--output templates/runtime/oncology/artemis/v0.2.0/patterns.json
- name: Validate generated JSON shape
if: steps.hemonc.outputs.available == 'true'
run: |
jq -e '.version == "v0.2.0"' \
templates/runtime/oncology/artemis/v0.2.0/patterns.json
jq -e '.regimens | length >= 100' \
templates/runtime/oncology/artemis/v0.2.0/patterns.json
# Spot-check that v0.1.0 regimens are still present.
for name in FOLFIRINOX FOLFOX R-CHOP AC-T 'Carboplatin+Paclitaxel'; do
jq -e --arg n "$name" '.regimens[] | select(.regimen_name == $n) | .regimen_name' \
templates/runtime/oncology/artemis/v0.2.0/patterns.json
done
- name: Auto-commit if changed
if: steps.hemonc.outputs.available == 'true'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config user.name "parthenon-bot"
git config user.email "bot@acumenus.net"
ARTIFACT=templates/runtime/oncology/artemis/v0.2.0/patterns.json
if git diff --quiet "$ARTIFACT"; then
echo "::notice::No regimen-list delta vs main; nothing to commit."
exit 0
fi
REGIMEN_COUNT=$(jq -r '.regimens | length' "$ARTIFACT")
HEMONC_REF="${{ steps.pin.outputs.ref }}"
git add "$ARTIFACT"
git commit -m "chore(artemis): auto-update v0.2.0 pattern library (${REGIMEN_COUNT} regimens, HemOnc@${HEMONC_REF})
Generated by .github/workflows/artemis-pattern-update.yml.
Source: HemOnc R-package @ ${HEMONC_REF}
Regimens: ${REGIMEN_COUNT}
Phase 3 Plan 7 Section B (T-024-carryover) — ARTEMIS pattern
library is regenerated on cron and committed to main directly,
so customer Docker builds stay pure-Python."
git push origin HEAD:main