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

Subject Not Required In Context Rx #18

Closed
jeffeastman opened this issue Nov 30, 2017 · 8 comments
Closed

Subject Not Required In Context Rx #18

jeffeastman opened this issue Nov 30, 2017 · 8 comments

Comments

@jeffeastman
Copy link

It doesn't appear to be required. Is this ok? It certainly makes it simpler to write tests if its not needed. I'll check if its required in prefetch next and add a comment.

Sending 'POST' request to URL: http://54.165.182.195:8080/cqf-ruler/cds-services/cdc-opioid-guidance
{
  "hook": "medication-prescribe",
  "hookInstance": "5bacb720-f493-4fe7-8750-c02595cbb72b",
  "fhirServer": "http://localhost:8080/cqf-ruler/baseDstu3",
  "user": "Practitioner-2516",
  "patient": "Patient-1121",
  "context": [
{
  "resourceType": "MedicationRequest",
  "status": "active",
  "medicationCodeableConcept": {
    "coding": [
      {
        "system": "http://www.nlm.nih.gov/research/umls/rxnorm",
        "code": "197696",
        "display": "fentaNYL 75 MCG/HR 3 Day Transdermal Patch"
      }
    ]
  },
  "authoredOn": "2017-01-01T00:00:00-05:00",
  "reasonCode": [
    {
      "coding": [
        {
          "system": "http://snomed.info/sct",
          "code": "82423001",
          "display": "Chronic pain"
        }
      ],
      "text": "Chronic pain"
    }
  ],
  "dosageInstruction": [
    {
      "text": "Apply once every three days for pain.",
      "timing": {
        "repeat": {
          "count": 1,
          "durationUnit": "d",
          "frequency": 1,
          "frequencyMax": 1,
          "period": 3
        }
      },
      "asNeededBoolean": false,
      "doseQuantity": {
        "value": 1,
        "unit": "tbl",
        "system": "http://unitsofmeasure.org",
        "code": "tbl"
      }
    }
  ],
  "dispenseRequest": {
    "quantity": {
      "value": 30,
      "unit": "day",
      "system": "http://unitsofmeasure.org",
      "code": "d"
    }
  }
}]
}

Response = 200
{
  "cards": [
    {},
    {
      "summary": "High risk for opioid overdose.",
      "detail": "Total morphine milligram equivalent (MME) exceeds recommended amount. Taper to less than 50."
    }
  ]
}

@jeffeastman
Copy link
Author

Evidently not required in the prefetch either:

Sending 'POST' request to URL: http://54.165.182.195:8080/cqf-ruler/cds-services/cdc-opioid-guidance
{
  "hook": "medication-prescribe",
  "hookInstance": "5bacb720-f493-4fe7-8750-c02595cbb72b",
  "fhirServer": "http://localhost:8080/cqf-ruler/baseDstu3",
  "user": "Practitioner-2516",
  "patient": "Patient-1121",
  "context": [
{
  "resourceType": "MedicationRequest",
  "status": "active",
  "medicationCodeableConcept": {
    "coding": [
      {
        "system": "http://www.nlm.nih.gov/research/umls/rxnorm",
        "code": "197696",
        "display": "fentaNYL 75 MCG/HR 3 Day Transdermal Patch"
      }
    ]
  },
  "authoredOn": "2017-01-01T00:00:00-05:00",
  "reasonCode": [
    {
      "coding": [
        {
          "system": "http://snomed.info/sct",
          "code": "82423001",
          "display": "Chronic pain"
        }
      ],
      "text": "Chronic pain"
    }
  ],
  "dosageInstruction": [
    {
      "text": "Apply once every three days for pain.",
      "timing": {
        "repeat": {
          "count": 1,
          "durationUnit": "d",
          "frequency": 1,
          "frequencyMax": 1,
          "period": 3
        }
      },
      "asNeededBoolean": false,
      "doseQuantity": {
        "value": 1,
        "unit": "tbl",
        "system": "http://unitsofmeasure.org",
        "code": "tbl"
      }
    }
  ],
  "dispenseRequest": {
    "quantity": {
      "value": 30,
      "unit": "day",
      "system": "http://unitsofmeasure.org",
      "code": "d"
    }
  }
}],
  "prefetch": {
    "medication": {
      "resource": 
{
  "resourceType": "Bundle",
  "entry": [
    {
      "resource": {
        "resourceType": "MedicationRequest",
        "status": "active",
        "medicationCodeableConcept": {
          "coding": [
            {
              "system": "http://www.nlm.nih.gov/research/umls/rxnorm",
              "code": "197696",
              "display": "fentaNYL 75 MCG/HR 3 Day Transdermal Patch"
            }
          ]
        },
        "authoredOn": "2017-01-01T00:00:00-05:00",
        "reasonCode": [
          {
            "coding": [
              {
                "system": "http://snomed.info/sct",
                "code": "82423001",
                "display": "Chronic pain"
              }
            ],
            "text": "Chronic pain"
          }
        ],
        "dosageInstruction": [
          {
            "text": "Apply once every three days for pain.",
            "timing": {
              "repeat": {
                "count": 1,
                "durationUnit": "d",
                "frequency": 1,
                "frequencyMax": 1,
                "period": 3
              }
            },
            "asNeededBoolean": false,
            "doseQuantity": {
              "value": 1,
              "unit": "tbl",
              "system": "http://unitsofmeasure.org",
              "code": "tbl"
            }
          }
        ],
        "dispenseRequest": {
          "quantity": {
            "value": 30,
            "unit": "day",
            "system": "http://unitsofmeasure.org",
            "code": "d"
          }
        }
      }
    }
  ]
}
}
}

}

Response = 200
{
  "cards": [
    {},
    {
      "summary": "High risk for opioid overdose.",
      "detail": "Total morphine milligram equivalent (MME) exceeds recommended amount. Taper to less than 50."
    }
  ]
}

@c-schuler
Copy link
Contributor

I don't believe this is an issue, especially for prefetch. Normally the prefetch is populated using the query string specified in the discovery response (see this example), which would require the subject to be specified for the specified resources.
I could add a check to validate the subject for the context resource, but I am not sure how valuable that would be.

@jeffeastman
Copy link
Author

If the prefetch is empty then the patient in the hook request needs to be a valid PatientId, otherwise you have no way to search for other Rxs. Or, it might instead be required in the context Rx (it isn't currently).

@jeffeastman
Copy link
Author

If the workflow is to first query all the Rx of the patient that are active (how is this computed? from the authoredOn date? This does not seem to be happening), then putting the active Rxs into the prefetch, it would seem the subject should be set in all of them.

But checking? Not helpful for testing but I can do it if necessary.

@c-schuler
Copy link
Contributor

Well, subject is required by the MedicationRequest resource... I could add validation, but I am still unsure how valuable it would be.
Active medications are determined using the status property - see the query string for prefetch I referenced above.

@jeffeastman
Copy link
Author

I wouldn't suggest validating the subject in any of the Rxs since they're not well formed without it and they would appear in the usual workflow (above). But if the prefetch is empty, where do you get the Patient.id from in the prefetch query?

Is this coming from the hook.patient field? I can't find it in the code.

@c-schuler
Copy link
Contributor

Yes, it is coming from the request. Here is the code where the query string is built for medication-prescribe prefetch.

@jeffeastman
Copy link
Author

I'm happy with the current implementation. Closing this issue now that my understanding is improved. Thanks

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

2 participants