athenahealth / apiserver-athenaFlex

Software developers can use sample code and documentation to use athenahealth's athenaPractice/athenaFlow FHIR API Server.
https://mydata.athenahealth.com/home
17 stars 7 forks source link

Issue with a valueQuantity Units. #224

Closed Roger-Geacom closed 2 months ago

Roger-Geacom commented 2 years ago

Your question

Is there a valueQuantity unit I should use for a phq9 score?

Any background information about this question

I'm trying to match observation codes used by our client's centricity software, and for most things it has gone really well. One problem that I am having is with scores for a phq-9. The Centricty software saves it as an numbered score as a valueQuantity. The problem is it doens't save a system or unit in this value quantitiy. When I read the observation written from centricity I get this:

{
            "fullUrl":removed 
            "resource": {
                "resourceType": "Observation",
                (Removed boilerplate, meta, tags, identifier status etc.. )
                "category": {
                    "coding": [
                        {
                            "system": "http://www.gehealthcare.com/fhir/cpsemr/codesystem/HIERGRPS/5131-39380-10664",
                            "code": "1509",
                            "display": "Psychiatric"
                        },
                        {
                            "system": "http://hl7.org/fhir/observation-category",
                            "code": "exam",
                            "display": "Exam"
                        }
                    ],
                    "text": "Psychiatric"
                },
                "code": {
                    "coding": [
                        {
                            "system": "http://loinc.org",
                            "code": "44250-9",
                            "display": "Little interest or pleasure in doing things?"
                        },
                        {
                            "system": "http://www.gehealthcare.com/fhir/cpsemr/codesystem/HDID/5131-39380-10664",
                            "code": "62776",
                            "display": "PHQ9 Q1"
                        }
                    ],
                    "text": "PHQ9 Question One score"
                },
                "subject": {
                    "reference": "Patient/removed"
                },
                "encounter": {
                    "reference": "Encounter/removed
                },
                "effectiveDateTime": "2021-12-28T15:38:26-06:00",
                "issued": "2021-12-29T10:42:34.120-06:00",
                "performer": [
                    {
                        "reference": "Practitioner/removed"
                    }
                ],
                "valueQuantity": {
                    "value": 0
                }
            },

As you can see on the backed it is saving as single score value. Unfortunately, the api requires system and unit fields in a value quantity so when I try to write a similar observation I get api errors. I'm wondering if there is a way around this, is there a unit that it will accept, or another way to save this data? I've tried Count, ScoreOf, Score, and a number of others but they all come back as invalid. Here is an example body:

{
    "resourceType": "Observation",
    "status": "final",
    "category": {
        "coding": [
            {
                "system": "http://www.gehealthcare.com/fhir/cpsemr/codesystem/HIERGRPS/5131-39380-10664",
                "code": "1509",
                "display": "Psychiatric"
            },
            {
                "system": "http://hl7.org/fhir/observation-category",
                "code": "exam",
                "display": "Exam"
            }
        ],
        "text": "Psychiatric"
    },
    "code": {
        "coding": [
            {
                "system": "http://loinc.org",
                "code": "44250-9",
                "display": "Little interest or pleasure in doing things?"
            },
            {
                "system": "http://www.gehealthcare.com/fhir/cpsemr/codesystem/HDID/5131-39380-10664",
                "code": "62776",
                "display": "PHQ9 Q1"
            }
        ],
        "text": "PHQ9 Question One score"
    },
    "valueQuantity": {
        "system": "http://unitsofmeasure.org",
        "unit": "ScoreOf",
        "value": 0
    },
    "subject": {
        "reference": "Patient/r"
    },
    "performer": [
        {
            "reference": "Practitioner/r"
        }
    ]
}

And an error I get for the above:

{
    "resourceType": "OperationOutcome",
    "text": {
        "status": "generated",
        "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><table width=\"100%\"><tbody><tr><td width=\"25%\"><span class=\"text-muted\">Outcome null</span></td><td width=\"42%\"><span class=\"text-muted\"><table><thead><tr><th>#</th><th>Severity</th><th>Type</th><th>Detail</th></tr></thead><tbody><tr><td>1</td><td>ERROR</td><td>BUSINESSRULE</td><td>Observation ValueQuantity.unit is invalid</td></tr></tbody></table></span></td></tr></tbody></table></div>"
    },
    "issue": [
        {
            "severity": "error",
            "code": "business-rule",
            "diagnostics": "Observation ValueQuantity.unit is invalid"
        }
    ]
}

Error I get when trying to post without unit or system:

{
    "resourceType": "OperationOutcome",
    "text": {
        "status": "generated",
        "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><table width=\"100%\"><tbody><tr><td width=\"25%\"><span class=\"text-muted\">Outcome null</span></td><td width=\"42%\"><span class=\"text-muted\"><table><thead><tr><th>#</th><th>Severity</th><th>Type</th><th>Detail</th></tr></thead><tbody><tr><td>1</td><td>ERROR</td><td>BUSINESSRULE</td><td>Observation value quantity unit is mandatory</td></tr><tr><td>2</td><td>ERROR</td><td>BUSINESSRULE</td><td>Observation value quantity system is mandatory</td></tr></tbody></table></span></td></tr></tbody></table></div>"
    },
    "issue": [
        {
            "severity": "error",
            "code": "business-rule",
            "diagnostics": "Observation value quantity unit is mandatory"
        },
        {
            "severity": "error",
            "code": "business-rule",
            "diagnostics": "Observation value quantity system is mandatory"
        }
    ]
}

Is it possible to find a workaround for this through the api? Or do I need to have our client get their backend adjusted to include a unit in their phq9 scores?

Torin-Shepard-athena commented 2 years ago

@Roger-Geacom Please try a blank string with a single space character for valueQuantity.unit. Post another comment to confirm if that allows successful posting of values for these Observations.

    "valueQuantity": {
        "system": "http://unitsofmeasure.org",
        "unit": " ",
        "value": 0
    },
Roger-Geacom commented 2 years ago

@Torin-Shepard-athena Using the above value quantity it looks like the backend reads that as empty and gives the following error:

    "issue": [
        {
            "severity": "error",
            "code": "business-rule",
            "diagnostics": "Observation value quantity unit is mandatory"
        }
    ]
Torin-Shepard-athena commented 2 years ago

@Roger-Geacom You have identified a shortcoming and limitation in the athenaPractice FHIR Server. It seems like it is currently not possible to push values for numeric Observations that are defined without any units. This will need to be fixed in a future release.

Roger-Geacom commented 2 years ago

@Torin-Shepard-athena Thanks for the info.

Do you want me to close this issue, or leave it open as its an issue with a pending fix. Not sure how you track issues.

Roger-Geacom commented 2 years ago

@Torin-Shepard-athena Would this fix be in the upcoming V20.2 release or a ways off?

deepaktiwari29 commented 2 months ago

@Roger-Geacom Closing this issue as it's planned for future release and we will tracking it internally.