Skip to content

Repository files navigation

Fenton growth curves - shiny app

A Shiny app that plots the Fenton 2013 preterm growth curves (weight, length, head circumference) for an infant and overlays measured values, plus a percentile table.

The interface is bilingual (Dutch by default, English) — switch with the small language toggle in the top-right corner.

Usage

The purpose of this app is not to be a fully customizable growth chart plotter, this already exists at https://peditools.org/peditools_universal/.

Values can be entered in two ways:

  • Excel upload (default): upload a workbook following example_excel.xlsx in this repository.
  • Manual / HTTP GET request (the "manual entry (advanced)" input method): see below.

For the HTTP GET request are the following parameters required:

  • Gestational age (in weeks): &PML_GET=23.14,23.28. 23.142 equals 23 weeks + 1 day (=23+1/7).
  • weight (in grams): &weight_GET=400,500,600
  • length (in cm): &length_GET=34,33,NA
  • head circumference (in cm): &HC_GET=23,NA,25
  • Sex (M or F): &sex_GET=M

The number of comma separated values in each field needs to be equal, and needs to contain either a value > 0 or "NA".

In addition, an Excel file can be used to input and upload measurements (see example_excel.xlsx) in this Github repository.

Example URL

Background and setup

The raw data (L,M,S values) was kindly shared by dr. Tanis Fenton (tfenton@ucalgary.ca). If you want to selfhost this app you'll also have to request access to this data.

After obtaining the data, the Excel sheet need to be reworked so that it follows the format of the csv files in the data folder in this github repository (I have included the first 2 lines of my reworked csv files as example). After obtaining these csv files, reworked datafiles (containing P03 > P97 threshold) can be obtained with growthcurves_*.R.

Installation

The app can be used at rubenvp.shinyapps.io/fenton or self-hosted through Docker.

The reference data (L/M/S values) is not bundled in the image — you must volume-mount your own data/ directory (see Background and setup above).

docker run -dp 0.0.0.0:3838:3838 \
  -v /path/to/data:/srv/shiny-server/data \
  --platform linux/amd64 \
  rmvpaeme/fenton:v1.0.4-beta

The mounted data/ folder must contain:

boys_HC.csv
boys_length.csv
boys_weight.csv
boys_all.csv          # output from growthcurves_boys.R
boys_all_spread.csv   # output from growthcurves_boys.R
girls_HC.csv
girls_length.csv
girls_weight.csv
girls_all.csv         # output from growthcurves_girls.R
girls_all_spread.csv  # output from growthcurves_girls.R

You'll have to generate these CSV files yourself after requesting the raw data from dr. Fenton (see above).

The app is then available at http://localhost:3838 or http://server-ip:3838.

Docker image details

Value
Image rmvpaeme/fenton
Tags v1.0.4-beta, latest
Base rocker/shiny:4.4.2 (R 4.4.2, Ubuntu 24.04 jammy)
R packages shiny, tidyverse, readxl, bslib, shiny.i18n, shinycssloaders, scales, DT
Architecture linux/amd64

Changelog

v1.0.4-beta (2026-05-30)

Percentile table polish + plot tooltip

  • Percentile computation extracted to a shared pct_data reactive — computed once, used by both the table and plot hover tooltips
  • Plot hover tooltips now include the percentile (e.g. GA: 34+4/7 wk / gram: 1860 / Percentiel: 12.3%)
  • Table: GA formatted as week+day/7 (e.g. 29+1/7) instead of decimal; units added to values (g, cm); measurement type names translated (Gewicht/Weight, Lengte/Length, Schedelomtrek/Head circumference); column headers translated (NL/EN)
  • Empty-state message when no data is entered ("Voer meetgegevens in…" / "Enter measurement data…")

v1.0.3-beta (2026-05-30)

Interactive plots (plotly)

  • Replaced static ggplot plots with interactive plotly plots (zoom, pan, hover)
  • growth_plot() still returns a ggplot object, wrapped with ggplotly() for display
  • Clean tooltips via custom text aesthetic: percentile + GA for curves, GA + value for measurements
  • Legend cleaned up: trace names stripped of (P03,1) format → P03; measurement points use a separate labelled color scale to avoid the double "annotation" header; added group = annotation to restore line continuity
  • Added Download PDF button in sidebar: 3-page PDF of the ggplot figures (weight, length, head circumference)

v1.0.2-beta (2026-05-29)

Theme

  • Reverted to original shinythemes flatly theme; removed Nord Light custom CSS
  • Removed bslib, Nord colour constants, and custom header div
  • Language toggle button repositioned with a single inline style (no external CSS)
  • Plot colours restored to ggplot2 defaults

v1.0.1-beta (2026-05-29)

Gebruik / Usage tab

  • Replaced the single-line GET example with full bilingual instructions (NL/EN)
  • Covers Excel upload, manual entry, percentile table, language toggle, and URL parameters
  • Content re-renders on language switch via renderUI driven by lang()

v1.0.0-beta (2026-05-29)

Code refactor

  • Replaced three near-identical renderPlot blocks with a single growth_plot() helper
  • Reference CSVs (Fenton L/M/S percentile curves) now loaded once at startup instead of on every reactive call
  • Excel workbook now read once per upload (was 4 separate read_excel calls)
  • URL query-param handling collapsed from 7 repeated if blocks to a single loop
  • Replaced eval(parse(text = x)) PML parser (arbitrary code execution risk) with a safe fraction parser; verified bit-for-bit identical output for all documented formats (23+1/7, decimals, integers)
  • Removed all dead/commented-out code

Bilingual interface (NL/EN)

  • Dutch by default; English available via a small toggle button fixed in the top-right corner
  • All UI labels, sidebar inputs, tab titles, disclaimer, usage text, and plot axis labels/subtitles are translated
  • Language switch is client-side (preserves uploaded file and active tab)
  • Strings managed in www/translations.json

UI/UX improvements

  • Confusing "Show advanced settings" yes/no dropdown replaced with clearly labelled radio buttons (input id and values preserved for full URL GET backwards-compatibility)
  • Loading spinner added to each plot panel
  • Flat header with app title and subtitle

Head circumference formatting

  • HC displayed as XX.X (one decimal) everywhere: plot y-axis labels and percentile table

Infrastructure

  • Dockerfile updated: added bslib, shiny.i18n, shinycssloaders, scales; removed unused shinythemes, shinyTime
  • .DS_Store added to .gitignore

Disclaimer

This application is not associated with dr. Fenton or University of Calgary.

References

Fenton TR, Kim JH. A systematic review and meta-analysis to revise the Fenton growth chart for preterm infants. BMC Pediatr. 2013;13:59.

About

a shiny app with GET support for visualising Fenton growth curves

Resources

Stars

1 star

Watchers

2 watching

Forks

Contributors

Languages