Giter Club home page Giter Club logo

lmsgrowth2's Introduction

Build Status

LMSgrowth2

Running the app

In R, install the package from Github using devtools. Run the following commands:

install.packages('devtools')
library(devtools)
install_github('statist7/LMSgrowth2', dependencies=TRUE)

Then run LMSgrowth2::run_app() to start the Shiny app.

Deploying server

There are several ways to deploy the LMSgrowth2 Shiny app. Here are three:

  1. Deploy to shinyapps.io. Clone this repository, open the app.R file in RStudio & click the Publish button. See shinyapps.io getting started documentation for more information.

  2. Using Docker. Run on the command line (specifying uploads directory on host):

git clone https://github.com/statist7/LMSgrowth2.git
cd LMSgrowth2
docker build --tag lmsgrowth2 .
docker run --publish 3838:3838 -v /uploads/dir/on/host:/srv/shiny-server/LMSgrowth2/inst/uploads lmsgrowth2

Then open your browser http://localhost:3838/

  1. Using Vagrant. Run on the command line.
git clone https://github.com/statist7/LMSgrowth2.git
cd LMSgrowth2/vagrant
vagrant up

Then open your browser http://localhost:3001/

Development setup

Prerequisites

Following packages are used during development and must be installed in the R user library

install.packages(c('devtools', 'usethis', 'testthat'))

Setup

  • Clone the LMSgrowth2 repository

  • Open the project in RStudio

  • Install the project package dependencies:

    • packrat::restore()
  • Test:

    • Build > Test Package

Run

  • To run the app devtools::load_all(); LMSgrowth2::run_app()

Updating Packrat dependencies

  1. List all packages where updates are available using old.packages().
  2. Either, update a specific package using, for example, install.packages('plotly') or all packages using update.packages().
  3. Run LMSgrowth2 in the usual way and check everything is working.
  4. Once confirmed, save the updates to Packrat using packrat::snapshot(snapshot.sources=F).

lmsgrowth2's People

Contributors

dpshelio avatar giordano avatar statist7 avatar tamuri avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

tamuri

lmsgrowth2's Issues

Test LMSgrowth2 as typical R package in Travis build

At the moment, the Travis build installs LMSgrowth2 with the packrat environment, which is intended for development. It's probably better now to install LMSgrowth2 as a typical R package (i.e. using devtools::install('./LMSgrowth2') (or however one should do it...I haven't looked into it yet).

Centiles in LMSgrowth Excel add-in fails if no sheet open

Longstanding bug in Centiles: it assumes a new sheet is open to write to. If no sheet is open it fails with the error Invalid conversion number.. So if no sheet is open it needs to open one first.

Note that if a sheet is open, it writes to the first empty column.

Calculate Z-scores for multiple individuals

  • measurement-to-sds and sds-to-measurement

  • given table of input data

    • set sex or select column
    • set gestation or select column
    • specify which rows to use as input (start row and number of rows)
      • auto-determinate based on filled rows
    • select columns age
      • by date - birth and measurement column
      • age column in days, weeks, months or years
    • select measurement column and SDS columns for input/output
      • auto-selection of columns based on column names in header
  • measurements determined by what's available in reference

    • height, weight, BMI, head, sitting height, leg length
    • currently maximum 6
    • calculate Z-scores for multiple measurements
      • SDS,
      • centile,
      • % predicted (of mean value [M]),
      • predicted (the mean value [M]),
      • % CV ([S] * 100),
      • skewness ([L] value),
      • LLN5 (5th centile of distribution at this age)
  • units of measurements are fixed (metric)

Warnings when using WHO06 data

When using WHO06 data I see a lot of warnings in the calculator and centiles (PR #26) tab:

Warning in regularize.values(x, y, ties, missing(ties)) :
  collapsing to unique 'x' values

With @tamuri we found out that this is due to duplicate rows for years == 2 in the data, for both sexes

Excel prompting to save growth references unnecessarily

For issue #1

After starting Excel with the growth reference spreadsheets in the startup path, when you close Excel it prompts the user to save the spreadsheets despite no changes having been made.

I think this is because the growth references are saved in an older version of Excel and newer versions of Excel update the spreadsheet.

Possible solution is to update the growth reference spreadsheets that are packaged with the add-in for 64-bit versions.

Recover from malformed/invalid input data

It is preferred that LSMgrowth2 gracefully handles errors in input data (i.e. prefer warning rather than error)
The application should calculate measurements and statistics for as much of the input data as possible and produce warnings/errors for data that did not conform to the right format e.g. calculate Z-scores for all rows where possible and display "NA" where not.
It is believed that bad input data is self-evident given strange outputs.

Allow user to select growth reference for calculations

  • select the growth reference

  • selection is preserved for the next run of the application by user

  • currently each growth reference is a different xls file stored in a specific directory

  • select six measurements to display on forms (this is limitation of excel add-in; do not replicate!)

Use stylesheet

We may want to use stylesheet to better control the rendering of the page.

For example, in the centile tab can be used to put some space between tables and plots, and to style the headers

Implement functionality of LMSgrowth in webapp

Given difficulties maintaining the current Excel add-in, LMSgrowth2 seeks to implement (and expand upon) the functionality currently available in LMSgrowth in a web-based application.

LMSgrowth2 will make use of the SITAR CRAN package, which provides functions to work with LMS growth data.

This requirement issue is a container for specific sub-requirements.

Calculate Z-scores for single individual

  • measurement-to-sds

  • age for gestation

    • see vba code for exact algorithm for adjustment
  • input age as

    • date of birth + date of measurement
    • age in days + weeks + months + years
  • note interaction between input boxes

    • e.g. height+weight automatically calculated BMI
    • but adjusting BMI doesn't adjust height, weight (can be inconsistent)
  • available measurements:

    • determined by what's available in reference
    • current LMSgrowth allow for max 6, selected by user
      • default from british1990 growth reference
        • height, weight, BMI, head, sitting height, leg length
    • calculate Z-scores for multiple measurements:
      • SDS,
      • centile,
      • % predicted (of mean value),
      • predicted (the mean value),
      • % CV ([S] * 100),
      • skewness ([L] value),
      • LLN5 (5th centile of distribution at this age
  • input unit of measurement are fixed by the application (metric)

Target web-browsers on multiple platforms

LMSgrowth2 will be a web-based application. It will be built on the R platform using Shiny.

Primary target: recent Windows, Mac, Linux browsers on the desktop
Secondary target: tablet and mobile devices (iOS, Android)

Use existing cross-platform widgets/frameworks to avoid incompatibilities and allow for responsive web design.

Setup Travis for statist7 account

@statist7 - we need to setup Travis to continue to test builds of LMSgrowth2. It's simply a matter of logging into Travis using your Github credentials and adding LMSgrowth2 as a repository you want to use with Travis. Instructions are here - you only have to setup Travis+Github repo because we already have travis.yml in this repo.

Handle uploading and input of user data

Currently LMSgrowth add-in works directly on user's spreadsheets.

  • allow users to upload input in xls, xlsx and csv formats
    • allow users to input data for single or multiple children
    • allow users to input data for single or multiple measurements
  • allow users to directly enter data via entry forms

Usage of deprecated tidyverse functions

With the release of dplyr 1.0 and R 4.0, some of the functions we're using need to be updated. I see these messages when running the app. Add any others to this issue.

Warning: `tbl_df()` is deprecated as of dplyr 1.0.0.
Please use `tibble::as_tibble()` instead.
This warning is displayed once every 8 hours.
Call `lifecycle::last_warnings()` to see where this warning was generated.
Warning: `funs()` is deprecated as of dplyr 0.8.0.
Please use a list of either functions or lambdas: 

  # Simple named list: 
  list(mean = mean, median = median)

  # Auto named with `tibble::lst()`: 
  tibble::lst(mean, median)

  # Using lambdas
  list(~ mean(., trim = .2), ~ median(., na.rm = TRUE))
This warning is displayed once every 8 hours.
Call `lifecycle::last_warnings()` to see where this warning was generated.
Warning: `arrange_()` is deprecated as of dplyr 0.7.0.
Please use `arrange()` instead.
See vignette('programming') for more help
This warning is displayed once every 8 hours.
Call `lifecycle::last_warnings()` to see where this warning was generated.

Set up Travis for CI

We don't have unit tests but we can use Travis CI for building the package at least (see here). At least that will check the dependencies & packrat config.

Allow upload of user-defined growth reference data

allow users to upload their own growth reference
requires defining standard format of growth reference data

  • one column for age
  • each measurement has
    • l[ambda] - power transform to deal with skewness (i.e. $y^\lambda$)
    • m[u] - median
    • s[igma] - measure of dispersion (sd/mean i.e. coefficient of variation)

Is this output of LMSchartmaker? Ensure that we handle at least that format.

Support other methods e.g. gamlss

Output centiles from growth reference for a given measurement

  • summary: generates table of numbers to allow user to plot growth chart
  • user-defined centiles set by number or space between centiles
    • equal and unequal centile space
  • for each sex
  • select age unit and frequency
    • by default, use ages defined in the growth reference
  • select growth measurement (height, weight etc) to output
  • min and max range is determined by the growth reference

Calculate weight gain to SDS

  • for one or multiple children
  • select two ages and corresponding weight at those ages
    • calculate weight gain sds and centile

Preserve user-preferences without user accounts

Some selected options should be preserved across runs without needing user-accounts (i.e. using cookies)

  • Selected growth reference
  • Previously selected options for measurements (limitated to 6 by current LMSgrowth add-in)

Requirement to discuss in light of data handling law etc:
- preserve access to previously uploaded and analysed data

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.