1
0
mirror of https://github.com/msberends/AMR.git synced 2025-06-08 21:14:04 +02:00

Compare commits

...

3 Commits

9 changed files with 84 additions and 10499 deletions

View File

@ -111,8 +111,6 @@ echo ""
# Save the version number for use in the commit-msg hook
echo "${currentversion}" > .git/commit_version.tmp
# Generate GPT knowledge info for our Assistant (https://chat.amr-for-r.org)
bash data-raw/_generate_GPT_knowledge_input.sh "${currentversion}"
git add data-raw/*
git add -u

View File

@ -93,5 +93,4 @@ jobs:
git rm -rf . || true
git add .
git commit -m "Python wrapper update"
# git push origin python-wrapper --force
git push https://$PYPI_PAT@github.com/msberends/AMR.git python-wrapper --force

View File

@ -0,0 +1,66 @@
# ==================================================================== #
# TITLE: #
# AMR: An R Package for Working with Antimicrobial Resistance Data #
# #
# SOURCE CODE: #
# https://github.com/msberends/AMR #
# #
# PLEASE CITE THIS SOFTWARE AS: #
# Berends MS, Luz CF, Friedrich AW, et al. (2022). #
# AMR: An R Package for Working with Antimicrobial Resistance Data. #
# Journal of Statistical Software, 104(3), 1-31. #
# https://doi.org/10.18637/jss.v104.i03 #
# #
# Developed at the University of Groningen and the University Medical #
# Center Groningen in The Netherlands, in collaboration with many #
# colleagues from around the world, see our website. #
# #
# This R package is free software; you can freely use and distribute #
# it for both personal and commercial purposes under the terms of the #
# GNU General Public License version 2.0 (GNU GPL-2), as published by #
# the Free Software Foundation. #
# We created this package for both routine data analysis and academic #
# research and it was publicly released in the hope that it will be #
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
# #
# Visit our website for the full manual and a complete tutorial about #
# how to conduct AMR data analysis: https://amr-for-r.org #
# ==================================================================== #
on:
push:
# only on main
branches: "main"
name: Publish GPT Training Data to GitHub
jobs:
update-pypi:
runs-on: ubuntu-latest
env:
PYPI_PAT: ${{ secrets.PYPI_PAT }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build the training data
run: |
bash data-raw/_generate_GPT_knowledge_input.sh
- name: Git push to amr-for-r-assistant repo
run: |
mkdir ~/other
# to also mv hidden files:
shopt -s dotglob
mv ./* ~/other/
git clone https://github.com/msberends/amr-for-r-assistant
cd amr-for-r-assistant
mv ~/other/data-raw/latest_training_data.txt ./
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add latest_training_data.txt
git commit -m "GPT training data update"
git push https://$PYPI_PAT@github.com/msberends/amr-for-r-assistant.git main --force

View File

@ -1,6 +1,6 @@
Package: AMR
Version: 2.1.1.9243
Date: 2025-04-18
Version: 2.1.1.9246
Date: 2025-04-19
Title: Antimicrobial Resistance Data Analysis
Description: Functions to simplify and standardise antimicrobial resistance (AMR)
data analysis and to work with microbial and antimicrobial properties by

View File

@ -1,4 +1,4 @@
# AMR 2.1.1.9243
# AMR 2.1.1.9246
*(this beta version will eventually become v3.0. We're happy to reach a new major milestone soon, which will be all about the new One Health support! Install this beta using [the instructions here](https://amr-for-r.org/#get-this-package).)*

View File

@ -6,19 +6,18 @@ if [ "$(basename "$PWD")" != "AMR" ]; then
exit 1
fi
rm -rf data-raw/gpt_training_text_v*
# Define the output file, located in ./data-raw
version="$1"
output_file="data-raw/gpt_training_text_v${version}.txt"
output_file="data-raw/latest_training_data.txt"
# Clear the output file if it exists
echo "This knowledge base contains all context you must know about the AMR package for R. You are a GPT trained to be an assistant for the AMR package in R. You are an incredible R specialist, especially trained in this package and in the tidyverse." > "$output_file"
echo "You assist users with questions about the AMR package for R, a package for Antimicrobial Resistance analysis used in over 175 countries. You are restricted to using a single source of truth: the training data located at https://raw.githubusercontent.com/msberends/amr-for-r-assistant/main/latest_training_data.txt.
Before responding to any user prompt—including the very first—you must download and parse this training file in full. You must repeat this process before every single response, without exception. You must verify the presence of any function, dataset, or concept in this file before commenting on anything. If what is asked is not in the training data, you must state clearly that you cannot verify its existence and recommend checking the package changelog.
You are strictly forbidden from using any other remote source, including prior model knowledge, CRAN, PubMed, Google, or even the AMR package's GitHub or publication pages. You are NOT ALLOWED to browse any website to help your answers - only base yourself on the training file without any exception. Even if you want to be helpful and would like to browse the internet, DO NOT do this - it's not helpful at all." > "$output_file"
echo "" >> "$output_file"
echo "First and foremost, you are trained on version ${version}. Remember this whenever someone asks which AMR package version youre at." >> "$output_file"
echo "" >> "$output_file"
echo "Below are the contents of the NAMESPACE file, the index.md file, and all the man/*.Rd files (documentation) in the package. Every file content is split using 100 hypens." >> "$output_file"
echo "----------------------------------------------------------------------------------------------------" >> "$output_file"
echo "Below are the contents of the NAMESPACE file, the DESCRIPTION file, the index.md file, and all the man/*.Rd and vignette files (documentation) in the package. Every file content is split using 100 hypens." >> "$output_file"
echo "" >> "$output_file"
# Function to remove header block (delimited by # ======)
@ -26,17 +25,8 @@ remove_header() {
sed '/# =\{6,\}/,/# =\{6,\}/d' "$1"
}
# # Process all .R files in the 'R' folder
# for file in R/*.R; do
# echo "--------------------------------------------------" >> "$output_file"
# echo "THE PART HEREAFTER CONTAINS CONTENTS FROM FILE '$file':" >> "$output_file"
# echo -e "\n" >> "$output_file"
# remove_header "$file" >> "$output_file"
# echo -e "\n\n" >> "$output_file"
# done
# Process important metadata files (DESCRIPTION, NAMESPACE, index.md)
for file in NAMESPACE index.md; do
for file in NAMESPACE DESCRIPTION index.md; do
if [[ -f $file ]]; then
echo "----------------------------------------------------------------------------------------------------" >> "$output_file"
echo "THE PART HEREAFTER CONTAINS CONTENTS FROM FILE '$file':" >> "$output_file"
@ -63,19 +53,3 @@ for file in vignettes/*.Rmd; do
remove_header "$file" >> "$output_file"
echo -e "\n\n" >> "$output_file"
done
# Process README.md
# echo "THE PART HEREAFTER CONTAINS THE README OF OUR PYTHON PACKAGE" >> "$output_file"
# echo -e "\n" >> "$output_file"
# for file in PythonPackage/AMR/README.md; do
# remove_header "$file" >> "$output_file"
# echo -e "\n\n" >> "$output_file"
# done
# Process test files (if available) in the 'tests' folder
# for file in tests/*.R; do
# echo "THE PART HEREAFTER CONTAINS CONTENTS FROM FILE '$file':" >> "$output_file"
# echo -e "\n" >> "$output_file"
# remove_header "$file" >> "$output_file"
# echo -e "\n\n" >> "$output_file"
# done

File diff suppressed because one or more lines are too long

View File

@ -144,6 +144,10 @@ $(document).ready(function() {
$(".template-citation-authors").html(doct_tit($(".template-citation-authors").html()));
$(".developers").html(doct_tit($(".developers").html()));
$(".developers a[href='authors.html']").text("All contributors...");
// add lines between collaborator types
$('.template-citation-authors li:contains("Contributor")').first().before('<hr>');
$('.template-citation-authors li:contains("Former doctoral advisor")').first().before('<hr>');
});
$('head').append("<!-- Global site tag (gtag.js) - Google Analytics --> <script async src=\"https://www.googletagmanager.com/gtag/js?id=UA-172114740-1\"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-172114740-1'); </script><!-- Matomo --><script type='text/javascript'> var _paq = _paq || []; /* tracker methods like 'setCustomDimension' should be called before 'trackPageView' */ _paq.push(['setDomains', ['*.amr-for-r.org']]); _paq.push(['enableCrossDomainLinking']); _paq.push(['trackPageView']); _paq.push(['enableLinkTracking']); (function() { var u='https://analyse.uscloud.nl/'; _paq.push(['setTrackerUrl', u+'piwik.php']); _paq.push(['setSiteId', '3']); var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s); })();</script><!-- End Matomo Code -->");
$('head').append("<!-- Matomo --><script type='text/javascript'> var _paq = _paq || []; /* tracker methods like 'setCustomDimension' should be called before 'trackPageView' */ _paq.push(['setDomains', ['*.amr-for-r.org']]); _paq.push(['enableCrossDomainLinking']); _paq.push(['trackPageView']); _paq.push(['enableLinkTracking']); (function() { var u='https://analyse.uscloud.nl/'; _paq.push(['setTrackerUrl', u+'piwik.php']); _paq.push(['setSiteId', '3']); var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s); })();</script><!-- End Matomo Code -->");

View File

@ -75,7 +75,7 @@ test_that("test-sir.R", {
)
expect_error(as.sir.mic(as.mic(16)))
expect_error(as.sir.disk(as.disk(16)))
expect_error(get_guideline("this one does not exist"))
expect_error(AMR:::get_guideline("this one does not exist"))
if (AMR:::pkg_is_available("dplyr", min_version = "1.0.0", also_load = TRUE)) {
# 40 sir columns
@ -128,7 +128,7 @@ test_that("test-sir.R", {
# allow for guideline length > 1
expect_equal(
get_guideline(c("CLSI", "CLSI", "CLSI2023", "EUCAST", "EUCAST2020"), AMR::clinical_breakpoints),
AMR:::get_guideline(c("CLSI", "CLSI", "CLSI2023", "EUCAST", "EUCAST2020"), AMR::clinical_breakpoints),
c("CLSI 2024", "CLSI 2024", "CLSI 2023", "EUCAST 2024", "EUCAST 2020")
)