uwcirg / cosri-patientsearch

Thin client and backend to support patient search prior to SoF launch
Apache License 2.0
1 stars 0 forks source link

Column configuration #143

Open pbugni opened 2 years ago

pbugni commented 2 years ago

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 commented 2 years ago

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

mcjustin commented 2 years ago

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 commented 2 years ago

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

ivan-c commented 2 years ago

@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 commented 2 years ago

@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 commented 2 years ago

@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 commented 2 years ago

@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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

@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 commented 2 years ago

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 commented 2 years ago

Noting that we didn't decide between these two:

mcjustin commented 2 years ago

@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 commented 1 year ago

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

mcjustin commented 1 year ago

@pbugni mock-up from @sierramatice is at https://www.pivotaltracker.com/story/show/183147834/comments/233809643