Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PurchaseAssistant

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

Requirements

  • 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.

Install

From the project root:

Rscript -e 'remotes::install_local(upgrade = "never", force = TRUE)'

Or using the Make target:

make install

Run The App Locally

Option 1: Development mode (from source)

This loads the package with pkgload and starts the app:

Rscript app.R

Option 2: Installed package

Rscript -e 'PurchaseAssistant::run_app(options = list(port = 3838))'

Or with Make:

make run_app

Then open http://127.0.0.1:3838 in your browser.

Authentication And Local User

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

Typical User Flow

  1. Start on the home page and choose one of the four workflows.
  2. Open My Herd to review your latest test results and overall health status.
  3. If buying animals, use Animal Market to filter seller herds and shortlist candidates.
  4. Use Buy Animals when you already know herd IDs and want to verify health status before purchase.
  5. If selling animals, use Sell Animals to publish animals with relevant herd details.
  6. Optionally switch language using the globe button (Swedish/English) at any time.

Data And Translations

Bundled app data is stored under inst/:

  • inst/datasets/: county metadata, disease datasets, and seller mock data
  • inst/i18n/: translation CSV files
  • inst/users.csv: demo/user mapping used by get_user()

Development Workflow

Useful Make targets:

  • make install: install local package
  • make run_app: run app from installed package on port 3838
  • make install_run: install and run
  • make build_imports: regenerate import declarations
  • make roxygen: regenerate documentation in man/
  • make check: run devtools::check()
  • make lintr: run lintr checks

Package API

Exported functions:

  • PurchaseAssistant::run_app()
  • PurchaseAssistant::app()
  • PurchaseAssistant::build_package_imports()

Repository Layout

  • R/: Shiny modules, app UI/server composition, and helper functions
  • inst/: runtime assets included in the package
  • app.R: local development launcher
  • Makefile: common developer commands

License

GPL (>= 3). See DESCRIPTION for package metadata.

Authors

Author metadata is maintained in DESCRIPTION.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages