PurchaseAssistant is an R package containing a Shiny app for herd trading risk evaluation. The app supports decisions when buying and selling cattle by combining herd metadata with disease test results and green-list status. The app was developed within the DECIDE project.
The current app includes:
- Herd status overview for the logged-in user
- Disease result views (Salmonella and Mycoplasma bovis)
- Buyer workflows for searching and evaluating sellers
- Seller workflows for publishing animals for sale
- Swedish and English UI translations
- R >= 4.1.0
- System libraries required by your R setup to compile package dependencies
- Internet access for DataTables language assets and external help links
Main R package dependencies are declared in DESCRIPTION, including shiny, golem, data.table, DT, shinyWidgets, shiny.i18n, and shiny.router.
From the project root:
Rscript -e 'remotes::install_local(upgrade = "never", force = TRUE)'Or using the Make target:
make installThis loads the package with pkgload and starts the app:
Rscript app.RRscript -e 'PurchaseAssistant::run_app(options = list(port = 3838))'Or with Make:
make run_appThen open http://127.0.0.1:3838 in your browser.
The app is primed to work in a ShinyProxy hosting environment and thus reads SHINYPROXY_USERNAME to identify the current user. If the
variable is missing or not found in inst/users.csv, it falls back to
test.user.
Example:
SHINYPROXY_USERNAME=test.user Rscript app.R- Start on the home page and choose one of the four workflows.
- Open My Herd to review your latest test results and overall health status.
- If buying animals, use Animal Market to filter seller herds and shortlist candidates.
- Use Buy Animals when you already know herd IDs and want to verify health status before purchase.
- If selling animals, use Sell Animals to publish animals with relevant herd details.
- Optionally switch language using the globe button (Swedish/English) at any time.
Bundled app data is stored under inst/:
inst/datasets/: county metadata, disease datasets, and seller mock datainst/i18n/: translation CSV filesinst/users.csv: demo/user mapping used byget_user()
Useful Make targets:
make install: install local packagemake run_app: run app from installed package on port 3838make install_run: install and runmake build_imports: regenerate import declarationsmake roxygen: regenerate documentation inman/make check: rundevtools::check()make lintr: run lintr checks
Exported functions:
PurchaseAssistant::run_app()PurchaseAssistant::app()PurchaseAssistant::build_package_imports()
R/: Shiny modules, app UI/server composition, and helper functionsinst/: runtime assets included in the packageapp.R: local development launcherMakefile: common developer commands
GPL (>= 3). See DESCRIPTION for package metadata.
Author metadata is maintained in DESCRIPTION.