rcpch / digital-growth-charts-react-component-library Goto Github PK
View Code? Open in Web Editor NEWA typescript React library for displaying RCPCH Digital Growth Charts from API data
Home Page: https://growth.rcpch.ac.uk
License: MIT License
A typescript React library for displaying RCPCH Digital Growth Charts from API data
Home Page: https://growth.rcpch.ac.uk
License: MIT License
We have had a clinician point out that it would be helpful to see the 'gestational age' when hovering over a point on the chart for a pre-term baby (< 37 weeks).
For example, DOB=10/01/23, Measurement Date = 10/01/23. Gestation = 36 weeks 0 day. The chart shows the 'adjusted' plot point as a cross and when you hover it says 'Corrected Age: undefined'. This was confusing to the clinician as they thought it was showing a 'corrected age'. Adding another measurement for same DOB and Measurement Date 28/02/23 does show 'Corrected Age: 3 weeks' which makes sense.
We have tested this in your Demo Chart site and it does the same, but unsure if this is by design.
Looks like the component library doesn't have a development branch, like our other RCPCH projects. While not absolutely necessary, I think it would be good to have to standardise our workflows across projects. @pacharanero if you're happy to add it, we can branch off of the current live.
When adding a measurement with gestation weeks exactly 40, and regardless of gestation days, the chart does not show the adjusted/unadjusted/Both toggle buttons.
For example:
Weeks = 39, Days = 6 then they show OK
Weeks = 40, Days = 0 to 6 then they do NOT show
Weeks = 41, Days = 1 then they show OK
I found a line in defaultToggles.ts (line 19) which is checking the gestation weeks and setting showToggle to false.
I have recently upgraded the version we are using to 6.1.7 but we saw this issue in 6.1.4 also.
The charts look really good. I particularly like the way the centile disjunctions are plotted so clearly, and the BMI units are correctly rendered!
Because they're really good I'm encouraged to be really picky about the design elements. So here's a list of points that strike me:
That's probably enough for now...
A suggestion from Mars Skae, endocrinologist is for more SDS lines on the centile charts for children of high BMI
She cites the CDC
This is likely related to my other issue #40 but it is a different problem.
When I enter a measurement with gestation weeks exactly 40 (regardless of days), and when I click the full screen toggle on the bottom left, the full screen button disappears. I can't then toggle back to 'zoom in'.
I have tested this on your Online Chart Demo but am unable to replicate it there.
By default we have set the 'enableExport' chart property to false, but as a test we set it to true, and interestingly the full screen button shows and works as expected. So this might explain why your demo works OK.
Looking at the code, this implies that the check on line 704 in CentileChart.tsx finds showToggle, allowZooming and enableExport all = false when the full screen button is clicked. The fullScreenPressed function is clearing out the storedChildMeasurements array which in turn could have an effect on the re-evaluation of allowZooming on line 119 in CentileChart.tsx.
Hi Team,
Have noticed that specifying the measurementFill property on measurementStyle doesn't show the colour change for the chronological age or corrected age measurement points on the Centile chart.
Looking at the source code (src/CentileChart/CentileChart.tsx), it seems that the colour is hardcoded to black for corrected age measurement (Line 683) and that the measurementFill doesn't filter through to either the chronological age measurement point or the corrected age measurement point.
Using version 6.1.4.
Thanks in advance,
Daniel
We plan to have one or more themes for the growth charts. We need to agree the fonts and colours for each.
Fonts (all chart themes)
Colours (each chart theme) - on these elements:
There is a gap between the two datasets, instead of an overlap
We have a set of measurements in our test data which don't appear to be rendering properly on the chart.
I have reproduced this on your on line demo chart site. I'm not sure whether this behaviour is by design or that it's a rare combination of measurements.
For example:
Patient Date of birth = 28/02/2020
Gestation 40w 0d
Sex = Male
Weight Measurements:
28/02/2023 14 kg
28/02/2022 12.1 kg
28/02/2021 10.3 kg
01/03/2020 3.5 kg
28/02/2020 3.5 kg
So there is a measurement on the child's birth date and another 2 days later. Then 3 subsequent measurements a year apart.
The problem is that it shows the later 3 - albeit as very small points, and doesn't show the first two at all. I can zoom in by scrolling with the mouse wheel but can't see the points.
Given that our users are a mixture of Neonatal, Paediatricians and Dieticians, between them they cover the full range of child ages. So they may, over time, want to see the full history on a chart.
Thanks
Apologies if this is not the correct place to ask this kind of question, but not sure where else to post. This isn't an issue as such with the Chart Component, but a question about implementation.
I wondered if any integrators/implementers of the Growth Charts API and/or Growth Charts component have taken account for Turner's patients? I note from your Demo application that you don't allow the submission of Turners measurements for weight, BMI or head circumference.
I'd be interested to know how others might have implemented this use case where a user wants to record height measurements by calling the Turners API end point, and plotting a height chart with Turner's Syndrome reference data. But for weight and head circumference, use the UK-WHO API end point and plot a chart using UK-WHO reference data. Additionally, how should the BMI calculation be handled? Presumably, from a clinical perspective, the BMI couldn't be calculated and plotted?
Thanks for any ideas about how best to approach this use case.
When plotting values on trisomy charts, the tooltip text is duplicated.
Hi,
Got another clinician request for you...
Apparently they can enter estimated height/weight observations in our patient records for various reasons.
What there asking for. is if an observation is estimated could that be marked on the chart?
So you could have a mixture of actual/estimated values displayed in the chart with different dots.
I'd pass across whether the observation was estimated with the observation value.
Thanks
Stephen
Not sure if it's a setup issue but I am finding that mid_parental_height_centile
returns undefined
unless midParentalHeightData is set to an empty array within the component call:
working example:
<RCPCHChart
exportChartCallback={exportChartCallback}
measurementMethod={measurementMethod}
measurementsArray={measurementsArray}
midParentalHeightData={{}}
reference={reference}
sex={sex}
subtitle={subtitle}
title={title}
/>
error occurs:
<RCPCHChart
exportChartCallback={exportChartCallback}
measurementMethod={measurementMethod}
measurementsArray={measurementsArray}
reference={reference}
sex={sex}
subtitle={subtitle}
title={title}
/>
Percentage median BMI is used widely in child and adolescent eating disorders, and may have some utility in obesity, though SDS in obesity seems to be a more commonly used measure.
The RCPCHGrowth package reports %mBMI for both corrected and chronological ages, so should be included, perhaps in the tool tips against BMI.
The x axis label should have a legend explaining the lollipop components represent months
@stephen775
Meeting with Salford users yesterday.
Request for tooltip text to have less in it.
Advice strings in the tooltips are set and written by the project board. There are two types of advice string, especially around corrected age calculation, one for clinicians, one for families.
clinicianFocus
in the RCPCHChart component - this allows users to flag whether they want a chart for clinicians or a chart for children/families. It is optional and defaults to true
(clinician) if absent.clinicianFocus
is true
clinicianFocus
is true
. Return the more lay language version if false
. This tends to be more verbose.These issues have been implemented in salford branch
Looking over the React component today I noticed how much white space there is, and how this has the effect of reducing the overall size of the chart as compared to the container it is in.
I wondered if it would be possible to move some of the logos and buttons to give an overall 'tighter' feel, reduce whitespace, and thereby scale up the chart itself for any given window. I think this would make the clinical view better and might also give us the opportunity to create a 'toolbar' along the bottom for all the buttons we have.
@eatyourpeas any thoughts on this?
If there are lots of plotted data points they look very crowded on the screen. This is likely to be the case for many babies on NICU particularly who have their weights measured regularly. It would be good to reduce the diameter of the plotted data point if close to others, increase it if further away.
Error handling would be helpful to prevent the charts rendering two measurements of the same type taken on the same day.
Can we link directly to the "instructions" that are mentioned? (presumably these come from the original paper chart cards)
Can we do this is a good-looking way? (ie can there be a little ℹ️ type icon to click?)
Related: Is there therefore an argument for adding a "URL" field to the tooltip data (which comes from the API not the chart component) to enable adding a URL to any returned chart information?
I believe you implemented away to scale the chart 0 -18 years. Instead of by the default 0- Child Age.
How in the chart code can I make this change.
Thank
More of an issue with the api rather than the chart.
All other measurements will return the standard measurement response with some error fields populated with helpful messages if the user enters a measurement below or above the constants. This is helping us determine if it should be passed into the chart or to display a warning message to the user.
However when entering values above or below the constants for BMI I have noticed that measurement response comes back with no errors in any of the error nodes, meaning our application deems the response is correct and will try to pass it into the chart component.
This can be worked around with more validation on our input form to stop users entering values that are too high or low in the first place but I was wondering if this is as designed or a known issue
It would be good to prevent panning where all the growth measurents are nolonger in the visible area of the chart.
Request from a user to change date format to include date format with months as words
On Storybook, when running the react-18-feature-test-branch, hovering below the puberty line elicits a filled box that pops up which blocks the screen. This happens between the precocious puberty line and post-17 completion delayed puberty.
Storybook CentileCharts affected: ‘With measurements from Birth Over Two Years’, ‘With Height and No Data’ (seems to be just the normal Height charts)
When embedding the growth chart in a page there is a default padding amount added around the chart. This padding is not exposed as a prop in the JavaScript and as such cannot be altered.
As you can see in the above screenshot the chart has padding which brings it further into the page.
In the Victory Chart documentation the default padding is set to 50, this appears to be causing the issue we are seeing.
https://formidable.com/open-source/victory/docs/victory-chart/#padding
Could we have a prop to customise the chart padding?
Identified by welsh dev team - the tooltip date is swapping month and day, leading to error
Project board decided today to correct for gestation, even if term, across the life course. This means potentially plotting measurements for both ages, leading to a crowded chart. The solution was to render chronological age only if a toggle button is pressed.
At present the dGC Chart Component focuses primarily on the deployment environment we expect in the NHS - majority desktop PCs with a mouse. In general there is relatively low penetration of touchscreen tablets and other touch devices in the clinical areas in which we expect Growth Charts to be initially used (paediatric clinics, GPs etc) and we have had to (for resource constraint reasons) focus on the Desktop browser.
We accept that other areas of clinical practice such as Community Nursing are likely to be the first to adopt touchscreen devices and we aim to support touchscreen zooming better in the future.
Future use of the dGC component for the eRedBook or other mobile apps will definitely need a touch-interface compatible Chart component)
Hi
We have just upgraded to the latest version of the charting library and are having some problems getting the charts to render.
The first issue we have come across is the styling, there appears to be errors in this file
The code:
newStyle.height === null && 600
seems to be trying to set default values but that is not what it is doing, I think the correct code would be something like:
newStyle.height = newStyle.height == null ? 600 : newStyle.height
this will set newStyle.height to 600 if the current value is null or undefined (=== will only check for null) this code could also be made a lot more concise using object spread but may be more difficult to understand.
The checks for null such as if (newStyle.tickLabelTextStyle===null)
will only work if the value is null the typescript does not all null to be set only undefined this could be fixed by adding a check for undefined or changing to == as mentioned above.
=== should be used everywhere except checking for null when you also want to check for undefined.
A linting tool such as eslint with moderately strict settings should catch issues like this as the current code would do nothing.
I would also recommend adding a formatting tool like prettier to help keep code style consistent.
I would be happy to do a PR if you would like me to resolve any of these issues, adding a formatter would change the formatting of all the files so may be difficult to review.
On the centile charts, the labels of the centiles are loaded in at gradients at the respective points on the graph, however some gradients are broken. @eatyourpeas has already noticed this, just formalising it in an Issue.
Requests for centile labels from colleagues in Scotland and also DCHW.
Hi,
I've just set up the component and when trying to load it I get returned the error:
Cannot read properties of undefined (reading 'sdsStroke')
I've gotten around this by hardcoding the sdsStroke
in the centileStyle
but it is set to nullable in the typing so I thought I'd raise an issue.
<RCPCHChart
centileStyle={{
sdsStroke: '#A9A9A9',
}}
exportChartCallback={exportChartCallback}
measurementMethod={measurementMethod}
measurementsArray={measurementsArray}
reference={reference}
sex={sex}
subtitle={subtitle}
title={title}
/>
Thanks
Request from DCHW
Although there is no reference data, clinical colleagues would like the ability to plot measurements at 22 weeks gestation, even if there would be no centile lines or centile/sds calculations.
Hello there,
I am trying to chnage the size of plot points but i didnt find a prop to change it,
Could you add that or tell me how to control it, sometimes its giving very small points ?
Meeting with users in Salford
User request for date of measurement as well as age to appear in tooltips
Now implemented in the salford branch
@stephen775
Is it possible to set the age range displayed in the chart?
As if the child is say 5 years old it displays a 0-6 years range in the chart.
The clinicians would like the chart to be able to display a 0- 18 year range/even if the patient only 5 years old with observations up till that age.
Thanks
Stephen Plant
Tooltips on growth charts should have Montserrat font, like in the live demo, but when running locally the font loads in as Times New Roman
When we saw the charts in use today in someone else's system, it made me wonder if we need some kind of symbol to suggest these charts are 'official'. I wondered if there should be something embedded, eg a logo, in the chart that would signify it is official.
Quick Mockup
When a centile chart is rendered, the centile lines and axis are dependent on the parameter chartScaleType. This then informs the x-axis label, and whether months as lollipops will show up.
At the moment, every Storybook story (except 'With Premature Female Heights) is automatically rendering with the chartScaleType set to biggerChild, since this is the default. However, this means that the rendering of an appropriate x-label doesn't happen. For example, smallChild is defined as ≤ 4 years old, > 1 year old. But Storybook renders a child who has data plotted between 0-2 years on the biggerChild axis.
This has implications for rendering gradient labels as per Issue #64. If we can't use the chartScaleType as a conditional (because it always defaults to biggerChild), then the gradients can't be conditionally scaled up/down as appropriate and so will keep bugging out
This would be helpful to report in the tooltip
Hi Team,
Having the following build issues when installing the charts component library with npm:
Error 1:
node_modules/@rcpch/digital-growth-charts-react-component-library/build/RCPCHChart/RCPCHChart.d.ts(1,8):
error TS1192: Module '"C:/source/Morse/Client/node_modules/@types/react/index"' has no default export.
Error 2:
C:\source\Morse\Client\node_modules/@rcpch/digital-growth-charts-react-component-library/build/index.d.ts(2,18):
error TS2307: Cannot find module '../src/images/icon.png'.
Regarding issue 1, I can resolve by manually editing the ‘RCPCHChart.d.ts’ file and replacing
import React from 'react';
with
import * as React from 'react';
For issue 2, the icon doesn't seem to be present in the ‘node_modules@rcpch\digital-growth-charts-react-component-library’ folder although I can see it in the RCPCH github repo here. Locally resolved by commenting out import and export of icon in ‘index.d.ts’ file.
I'm using:
"react": "17.0.2",
"typescript": "3.2.4"
"@rcpch/digital-growth-charts-react-component-library": 6.1.4
"@types/react": "17.0.2"
Any help would be much appreciated!
Based on today's chat with implementers it would be useful to have a page in the documentation which explains how to obtain a single JS file which can be included via <script src="index.js"></script>
into a normal HTML page and interacted with using plain old JS.
The tooltip text for the shaded area denoting term in the weight centile chart is missing.
Title styling prop currently applies to both title and subtitle
the terms adjusted/unadjusted in the toggle buttons do not match chronological/corrected used elsewhere.
It looks like there isn't a testing suite automatically executed on the Component Library upon PR submission, like with Epilepsy12.
For code safety reasons, this would be a good idea to implement and help ensure best CI/CD practices are being adhered to. Much like with Epilepsy12, it would also ensure that edge cases, dependency changes or any problems that would otherwise go missed are raised if adequate testing is in place.
At the moment Jest only has around ~20% code coverage for the component library, and while complete coverage shouldn't be our sole objective, we can afford to bump up the coverage numbers.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.