aehrc / smart-forms

React-based form renderer implementing Structured Data Capture (SDC) FHIR specification
https://smartforms.csiro.au
Apache License 2.0
36 stars 16 forks source link

Build reference and quantity components #639

Open fongsean opened 9 months ago

fongsean commented 9 months ago

The renderer is still yet unable to render items of type = "reference" and "quantity".

The "Bit of everything" questionnaire provides a simple example of how these items look like.

robeastwood-agency commented 3 months ago

Hi @fongsean - in the Agency we are looking to build a set of Questionnaire instances using item.type = "quantity", and making use of the CSIRO renderer.

Therefore, just wondering what the plans are for implementing quantity? Thank you!

(note- we have no plans for type = "reference")

fongsean commented 3 months ago

It was previously placed in the backlog (stale issues) as a to-do without a high priority since none of our Questionnaires use it.

Given your interest in having it, I think its high time I get this implemented :)

https://github.com/konsulin-id/smart-forms actually implemented it in their fork a couple days ago: https://github.com/konsulin-id/smart-forms/commit/af8b8f872d0a73cb7cb738c27e8da75ac874c2be. I'll work with them to get this into the main repo.

Will keep you updated.

robeastwood-agency commented 3 months ago

Thanks very much @fongsean !

ryuuzake commented 3 months ago

I created a PR for this @fongsean

fongsean commented 3 months ago

Thanks @ryuuzake! I'll look into it today and add my changes re: pre-population

fongsean commented 3 months ago

Hi all,

Unfortunately I have to work on something else with higher priority (needs to be demoed next week at Brisbane), I'll come back to this if I have capacity this week, otherwise it seems like I can only deliver it next week.

I'm pretty close, is just more about making sure it works properly with calculations and other SDC stuff.

robeastwood-agency commented 3 months ago

All good @fongsean - thank you again for progressing this

fongsean commented 3 months ago

Hi @robeastwood-agency, just got this implemented.

See the docs here: https://smartforms.csiro.au/docs/components/quantity See examples here: https://smartforms.csiro.au/storybook/?path=/story/component-itemtype-quantity--quantity-basic

We got unitOption implemented (big thanks to Riza!) but not unitValueSet. Not sure if that is something your team is interested in having.

robeastwood-agency commented 2 months ago

Thank you very much @fongsean (sorry have just returned from leave).

This looks great, having used the smartforms playground to do some experimentation with (close to) our real examples of vital sign measures.

Comments:

Cheers, thanks again; looks awesome!

fongsean commented 2 months ago

Sounds great Rob! Feel free to open a feature request if you have a need for minQuantity and maxQuantity.

We currently have minValue and maxValue implemented https://smartforms.csiro.au/docs/sdc/advanced/constraint#minvalue, so hopefully it can be leveraged during our future implementation.

I'll keep this issue open given we haven't built out type reference yet.

samturneradha commented 1 week ago

Hi, just weighing in on the discussion surrounding the implementation of quantity. My query relates to using the unitOption extension the smartforms playground (http://hl7.org/fhir/StructureDefinition/questionnaire-unitOption). The use of this extension in certain sections of the questionnaire would be desirable for us if we were to extract values out at later stages due to it being implemented with other fhir profiles where the extracted information might wind up. This raises two issues that if at all possible could you please take a look at? a) the quantity entry field has an associated field which allows entry of <, >, <= etc symbols as optional.

image

Wondering if this can be suppressed as it is not deemed useful for the specific questions. However of course the optional symbol may be required for other situations - so removing the option is not desired, but rather optionally suppressing. Is it ok to post this request here or open a new feature request?

b) the other associated field is for the configured unit(s) of the quantity (cm, kg, etc). Our CHAP usecase questions have a single unit and therefore the drop down seems redundant, but of course there would be other use cases where multiple units need to be configured and the drop down is necessary. Therefore wondering if there was a way (also sounds like a new feature) to not render a drop down when one unit is configured.

image

Thank you

fongsean commented 1 week ago

@samturneradha Thanks for raising this.

a) I wholeheartedly agree with you on this. Most of the questionnaires I've seen with Quantity items do not require the comparator symbol, but it's wrong to leave it out given it's there in the spec. I'm working on a set of library APIs to tweak rendering behaviours that SDC doesn't provide extensions for. I will include a hideQuantityComparator boolean flag to suppress it.

These new library APIs are currently in the alpha release of the library, but I imagine there could be breaking changes between different alpha versions (not yet so far), so proceed with caution. There are also no documentation on how to use these APIs yet.

b) Valid point. I think it makes sense to have the unit baked into the input field (example) when there's only a single unitOption.

Can you create two new issues on both of these? Thanks a bunch.

samturneradha commented 1 week ago

Thanks so much will do.