Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Column configuration #143

Open
pbugni opened this issue Aug 29, 2022 · 15 comments
Open

Column configuration #143

pbugni opened this issue Aug 29, 2022 · 15 comments
Assignees

Comments

@pbugni
Copy link
Contributor

pbugni commented Aug 29, 2022

We need a flexible configuration system to define which columns and the FHIR source of each.

A few examples:
MRN - a column that doesn't exist in COSRI, but others will need, and presumably pull from a Patient.identifier with a particular system value.
Alerts - a source FHIR type that will bring patients to the top of the list with important messages for end users.

@mcjustin
Copy link
Member

DCW will utilize this via https://www.pivotaltracker.com/story/show/183147834

@mcjustin
Copy link
Member

mcjustin commented Aug 31, 2022

Ordered list.
Labels & [pointer to jsonpath | fhirpath TBD].
Defaults (fname, lname, DOB), which will be included if the config isn't set.
Optional elements: MRN, (birth sex / gender), last accessed...
If the config exists, all fields need to be specified (default & optional).

@mcjustin
Copy link
Member

@ivan-c to add straw horse config which includes the default fields.

@ivan-c
Copy link
Member

ivan-c commented Aug 31, 2022

@achen2401 @pbugni @mcjustin @lober how does something like this look? Happy to make edits (or suggest your own!), but tried to represent "hardcoded" columns (no expr), alongside "configurable" ones. Please note the expr (expressions) are JSONPath at the moment (not FHIRPath)

DASHBOARD_COLUMNS=
[
    {
        "label": "First Name"
    },
    {
        "label": "Last Name"
    },
    {
        "label": "Gender",
        "expr": "$.Patient.gender"
    },
    {
        "label": "Birth Date"
    },
    {
        "label": "Last Accessed"
    },
    {
        "label": "MRN", 
        "expr": "$.Patient.identifier[?(@.system='https://hl7.org/mrn')].value"
    }
]

@achen2401
Copy link
Contributor

@ivan-c I am wondering if the syntax for the FHIR path in your example is referencing this? Do you know if this is the library that people are using to evaluate FHIR path?

@ivan-c
Copy link
Member

ivan-c commented Sep 1, 2022

@achen2401 sorry I kept editing my comment, the expressions I included in my example were JSONPath, not FHIRPath. There are a lot more libraries that implement JSONPath than FHIRPath. However, I took a quick look at the FHIRPath lib you linked, and didn't see any reason it shouldn't work (if my examples were updated to FHIRPath expressions)

@mcjustin
Copy link
Member

mcjustin commented Sep 1, 2022

@ivan-c weren't we aiming for the labels to be configurable strings, independent of the reference to the field? It looks like your labels are acting as field references, at least for the "hardcoded" columns (no expr).

@ivan-c
Copy link
Member

ivan-c commented Sep 1, 2022

weren't we aiming for the labels to be configurable strings, independent of the reference to the field? It looks like your labels are acting as field references, at least for the "hardcoded" columns (no expr).

@mcjustin Good point- we wouldn't be able to rename the labels for the hard-coded columns with the example I gave. Maybe we could use some hard-coded constants, one for each hard-coded field, eg:

    {
        "label": "First Name",
        "expr": "FIRST_NAME"
    },
    {
        "label": "Last Name",
        "expr": "LAST_NAME"
    },

@lober
Copy link
Member

lober commented Sep 1, 2022

This seems like a difficult way to have a discussion. I'm willing to do it, but it seems like GitHub issues might be best used first to identify and issue then to point to where it is being discussed, related materials, etc. and finally to the documentation of the agreed upon approach to resolve the issue. Not everything is that complex, of course, but I can't figure out what the current example of DASHBOARD_COLUMNS is, what FHIRPath loos like, etc. I'd like to be able to propose some additional column attributes.

On a separate note (also not a good place for questions...?!) do FHIRPath expressions always evaluate to the contents of an item in a resource, or can they also evaluate to True or False?

I'll avoid tagging anyone for now, and see if these two questions get a replies...!

@achen2401
Copy link
Contributor

@lober I tried out the config structure proposed by Ivan, with the expressions or expr written in JSON Path, this is an example using the current fields in the FEMR patient list (and tested and working in my instance):

DASHBOARD_COLUMNS = [{
      'label': 'First Name',
      'expr': '$.name[0].given[0]',
    },
    {
      'label': 'Last Name',
      'expr': '$.name[0].family',
    },
    {
      'label': 'Birth Date',
      'expr': '$.birthDate',
    },
    {
      'label': 'Last Accessed',
      'defaultSort': 'desc',
      'expr': '$.meta.lastUpdated',
      'dataType': 'date',
    }]

I added two additional attributes, i.e. defaultSort and dataType (the names can be changed). The defaultSort attribute tells the code to sort the patient list in FEMR by the Last Accessed field in descending order (which is what it currently is being sorted) and a dataType attribute of date allows the code to recognize the field as date and reformats the output text accordingly.
And to answer your question

do FHIRPath expressions always evaluate to the contents of an item in a resource, or can they also evaluate to True or False?

Currently the expressions evaluate to the contents of an item in a resource, and I don't think they can be evaluated to be true or false, but I could be wrong.

@mcjustin
Copy link
Member

mcjustin commented Sep 2, 2022

do FHIRPath expressions always evaluate to the contents of an item in a resource, or can they also evaluate to True or False?

I do see some boolean operations at https://hl7.org/fhir/fhirpath.html , eg "hasValue", "conformsTo", "memberOf".

@mcjustin
Copy link
Member

mcjustin commented Sep 7, 2022

Noting that we didn't decide between these two:

  • FHIRPath - note that CQL is a superset of FHIRPath, so using this may educate our CQL usage.
  • JSONPath - more tooling available, bigger community.

@mcjustin
Copy link
Member

@sierramatice You can see a couple configurations of this at https://femr.isacc.dev.cirg.uw.edu and https://femr.helloworld.dev.cirg.uw.edu (test/test).

@sierramatice
Copy link

@mcjustin I added a mock up and comments to the PT story

@mcjustin
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants