chronic-care / mcc-project

MCC eCare Plan project planning and documentation
Apache License 2.0
0 stars 1 forks source link

MyCarePlanner (sdsbetarelease) : SDS is present but not appropriately identified by the app, causing subject to be blank in submitted resources #398

Closed mattStorer closed 2 months ago

mattStorer commented 4 months ago

It was observed in the most recent, intermediate release of the MyCarePlanner app (tagged "sdsbetarelease"), that attempting to answer a Questionnaire and submit the associated QuestionnaireResponse resource to the SDS fails with an HTTP 403 error due to the subject element not being populated.

image

After discussions with Dave and Sean about this, and after analyzing logs (below), they came to the conclusion that a check in the app that (I think I'm phrasing this right) equated the presence (or absence) of the queried-for Patient resource from the SDS, with the presence (or absence) of the SDS itself, was not an appropriate surrogate for making that evaluation. Indeed, the queried-for patient (having the OHSU FHIR Patient ID) from the SDS local partition, that Patient resource will never exist there, and will always return a HTTP 404 response (as that resource exists in the OHSU partition, not the local one).

In any case, EMI is aware of this issue and will work to resolve it in a forthcoming release.

MyCarePlanner logs:

Navigated to https://patient-mccecare2-dev.ohsu.edu/mycareplanner/index.html
resourceData: 
Array(776) [ {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, … ]
fhirService.ts:783
resources: 
Array(388) [ {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, … ]
fhirService.ts:785
ProgressMessage: Found 388 lab results. App.tsx:662
ProgressMessage: Medication Request request: 1:16:13 PM App.tsx:662
ProgressMessage: Found 12 active medication requests. App.tsx:662
ProgressMessage: Found 20 inactive medication requests (before filtering). App.tsx:662
ProgressMessage: Found 20 inactive medication requests (after removing duplicates). App.tsx:662
ProgressMessage: ServiceRequest request: 1:16:14 PM App.tsx:662
resourceData: 
Array(34) [ {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, … ]
fhirService.ts:783
resources: 
Array(17) [ {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, … ]
fhirService.ts:785
ProgressMessage: Found 17 ServiceRequests. App.tsx:662
ProgressMessage: SocialHistory request: 1:16:14 PM App.tsx:662
resourceData: 
Array(14) [ {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, … ]
fhirService.ts:783
resources: 
Array(7) [ {…}, {…}, {…}, {…}, {…}, {…}, {…} ]
fhirService.ts:785
ProgressMessage: Found 7 social history observations. App.tsx:662
ProgressMessage: Obs Survey request: 1:16:14 PM App.tsx:662
resourceData: 
Array []
fhirService.ts:783
resources: 
Array []
fhirService.ts:785
ProgressMessage: Vitals request: 1:16:15 PM App.tsx:662
ProgressMessage: Found 22 vital signs. App.tsx:662
ProgressMessage: All FHIR requests finished: 1:16:16 PM App.tsx:662
FHIR queries: 11423ms - timer ended fhirService.ts:682
Provenance resources: 591 fhirService.ts:684
ProgressMessage: App.tsx:662
launcherData: Check for patient name...is it in here to use vs using launcherClient.tokenResponse?.patient from client itself? 
Object { serverUrl: https://epicmobile.ohsu.edu/FHIRDEV/api/FHIR/R4, isSDS: false, clientScope: "patient/Binary.read patient/CarePlan.read patient/CareTeam.read patient/Condition.read patient/DiagnosticReport.read patient/Encounter.read patient/Flag.read patient/Goal.read patient/Immunization.read patient/Location.read patient/Medication.read patient/MedicationRequest.read patient/Observation.read patient/Organization.read patient/Patient.read patient/Practitioner.read patient/PractitionerRole.read patient/Procedure.read patient/Provenance.read patient/Questionnaire.read patient/QuestionnaireResponse.Read patient/RelatedPerson.Read patient/ServiceRequest.read patient/Task.read fhirUser launch launch/patient openid", fhirUser: {…}, caregiverName: undefined, patient: {…}, patientPCP: {…}, carePlans: (2) […], careTeams: (1) […], careTeamMembers: Map(18), … }
App.tsx:298
launcherPatientId:  eFTHaVbQzCEwOEE97maN2MC2jJi-r8nnkhRh.umMUlz03 App.tsx:300
connect to SDS so we can verify it can exist App.tsx:332
setSupplementalDataClient() App.tsx:604
getSupplementalDataClient Start fhirService.ts:185
getSupplementalDataClient else if (authURL && sdsURL && sdsScope) == true; authorize using existing token fhirService.ts:202
getSupplementalDataClient authURL:  https://epicmobile.ohsu.edu/FHIRDEV/api/FHIR/R4 fhirService.ts:203
getSupplementalDataClient sdsURL:  https://sds-mccecare-dev.ohsu.edu/fhir fhirService.ts:204
getSupplementalDataClient sdsScope:  launch/patient openid fhirUser patient/*.read patient/*.write fhirService.ts:205
enter extractFhirAccessDataObjectIfGivenEndpointMatchesAnyPriorEndpoint() persistenceService.ts:152
givenEndpoint: https://epicmobile.ohsu.edu/FHIRDEV/api/FHIR/R4 persistenceService.ts:153
Key fhir-client-states-array-MCP exists in localForage persistenceService.ts:48
arrayOfFhirAccessDataObjects: 
[{"clientId":"66f00bfd-14a9-49c9-b11a-4a539508c79e","scope":"launch launch/patient openid fhirUser patient/Patient.read patient/Practitioner.read patient/RelatedPerson.read patient/Condition.read patient/DiagnosticReport.read patient/Observation.read patient/Procedure.read patient/CarePlan.read patient/CareTeam.read patient/Goal.read patient/Immunization.read patient/MedicationRequest.read patient/Medication.read patient/ServiceRequest.read patient/Provenance.read patient/Organization.read","redirectUri":https://patient-mccecare2-dev.ohsu.edu/mycareplanner/index.html,"serverUrl":https://epicmobile.ohsu.edu/FHIRDEV/api/FHIR/R4,"tokenResponse":{"access_token":"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJ1cm46b2hzdTpjZXBvYyIsImNsaWVudF9pZCI6IjY2ZjAwYmZkLTE0YTktNDljOS1iMTFhLTRhNTM5NTA4Yzc5ZSIsImVwaWMuZWNpIjoidXJuOmVwaWM6T0hTVSIsImVwaWMubWV0YWRhdGEiOiJOZ2x2S2NfaEdUOWJaWjV0TG5DZTE3eHdaV2pySjN0MDRzdmg4WXQxZ2hpUnc4ajFVWDBiS1lNeFljN3MxekdmQzFicGRNMktmS3N3bUJ2QTQxeTE2c3hOZXdzWmRKQXBoY0tK…
persistenceService.ts:157
arrayOfFhirAccessDataObject is truthy persistenceService.ts:160
inside arrayOfFhirAccessDataObjects.find((curFhirAccessDataObject) function persistenceService.ts:162
endpointInSavedData: https://epicmobile.ohsu.edu/FHIRDEV/api/FHIR/R4 persistenceService.ts:164
getSupplementalDataClient found extractFhirAccessDataObjectIfGivenEndpointMatchesAnyPriorEndpoint using https://epicmobile.ohsu.edu/FHIRDEV/api/FHIR/R4 fhirService.ts:209
getSupplementalDataClient authFhirAccessDataObject is truthy fhirService.ts:212
getSupplementalDataClient  getSupplementalDataClient() sdsFhirAccessDataObject =  
Object { clientId: "66f00bfd-14a9-49c9-b11a-4a539508c79e", scope: "launch/patient openid fhirUser patient/*.read patient/*.write", redirectUri: https://patient-mccecare2-dev.ohsu.edu/mycareplanner/index.html, serverUrl: https://sds-mccecare-dev.ohsu.edu/fhir, tokenResponse: {…}, key: "383dTFJgZYTd5BWX", registrationUri: "", authorizeUri: https://epicmobile.ohsu.edu/FHIRDEV/oauth2/authorize, tokenUri: https://epicmobile.ohsu.edu/FHIRDEV/oauth2/token, codeChallengeMethods: [], … }
fhirService.ts:220
getSupplementalDataClient FHIR.client(sdsFhirAccessDataObject) sdsClient =  
Object { units: {…}, state: {…}, environment: {…}, _refreshTask: null, patient: {…}, encounter: {…}, user: {…} }
fhirService.ts:223
getSupplementalDataClient End fhirService.ts:235
client.patient.id !== null, using client.patient.read() App.tsx:622
XHRGET
https://sds-mccecare-dev.ohsu.edu/fhir/Patient/eFTHaVbQzCEwOEE97maN2MC2jJi-r8nnkhRh.umMUlz03
[HTTP/2 404  65ms]

Warning: SDS Patient cannot be read via client.patient.read(): The SDS client will not be used. App.tsx:627
Warning: Invalid SDS patient read: Overriding valid client to undefined
                and not setting state for supplementalDataClient or canShareData App.tsx:651
Non-terminating Error: The SDS is invalid. Loading the launcher only. App.tsx:701
Technical Message: The SDS cannot be used due to an invalid SDS configuration,
                a missing patient, or otherwise: Loading the launcher only, the SDS will not be loaded. App.tsx:702
Error Caught: !this.state.supplementalDataClient || !this.state.canShareData App.tsx:703
Warning: validateDOMNesting(...): <h5> cannot appear as a descendant of <p>.
    in h5 (at Home.tsx:186)
    in p (at Home.tsx:185)
    in div (at Home.tsx:183)
    in div (at Home.tsx:133)
    in div (at Home.tsx:66)
    in Home (at App.tsx:886)
    in div (created by MuiTabPanelRoot)
    in MuiTabPanelRoot (created by ForwardRef(TabPanel))
    in ForwardRef(TabPanel) (at App.tsx:885)
    in div (created by Styled(div))
    in Styled(div) (created by ForwardRef(Box))
    in ForwardRef(Box) (at App.tsx:872)
    in TabContext (at App.tsx:871)
    in SessionProtected (at App.tsx:870)
    in Route (at App.tsx:869)
    in Switch (at App.tsx:814)
    in div (at App.tsx:793)
    in App (created by Context.Consumer)
    in Route (at src/index.js:18)
    in Switch (at src/index.js:16)
    in Router (created by BrowserRouter)
    in BrowserRouter (at src/index.js:15)
    in StrictMode (at src/index.js:14) index.js:1211
Warning: validateDOMNesting(...): <h5> cannot appear as a descendant of <p>.
    in h5 (at Home.tsx:196)
    in p (at Home.tsx:195)
    in div (at Home.tsx:193)
    in div (at Home.tsx:133)
    in div (at Home.tsx:66)
    in Home (at App.tsx:886)
    in div (created by MuiTabPanelRoot)
    in MuiTabPanelRoot (created by ForwardRef(TabPanel))
    in ForwardRef(TabPanel) (at App.tsx:885)
    in div (created by Styled(div))
    in Styled(div) (created by ForwardRef(Box))
    in ForwardRef(Box) (at App.tsx:872)
    in TabContext (at App.tsx:871)
    in SessionProtected (at App.tsx:870)
    in Route (at App.tsx:869)
    in Switch (at App.tsx:814)
    in div (at App.tsx:793)
    in App (created by Context.Consumer)
    in Route (at src/index.js:18)
    in Switch (at src/index.js:16)
    in Router (created by BrowserRouter)
    in BrowserRouter (at src/index.js:15)
    in StrictMode (at src/index.js:14) index.js:1211
    e index.js:1211
    React 10
    unstable_runWithPriority scheduler.development.js:572
    React 6
    setFhirDataStates App.tsx:597
    _callee$ App.tsx:393
    tryCatch App.tsx:2
    makeInvokeMethod App.tsx:2
    defineIteratorMethods App.tsx:2
    Babel 6
    setLoadAndMergeSDSIfAvailable App.tsx:402
    _callee11$ App.tsx:309
    tryCatch App.tsx:2
    makeInvokeMethod App.tsx:2
    defineIteratorMethods App.tsx:2
    Babel 8
    componentDidMount App.tsx:322
    React 6
    unstable_runWithPriority scheduler.development.js:572
    React 10
    js index.js:13
    Webpack 7
getGoalSummaries(): 10339ms - timer ended App.tsx:523
getConditionSummaries(): 4478ms - timer ended App.tsx:523
getMedicationSummaries(): 1170ms - timer ended App.tsx:523
getLabResultSummaries(): 3854ms - timer ended App.tsx:523
getVitalSignSummaries(): 1902ms - timer ended App.tsx:523
kbertodatti commented 3 months ago

From Dave: The cause for this is from the beginning we always display Questionnaire. But if there's no SDS configured, it will still attempt to write it. Technically you shouldn't be allowed to see Questionnaire if no SDS is configured but from a demo perspective, it's been better to see the questionnaire interface.

perhaps we include an error that says "your responses will not be saved"

kbertodatti commented 2 months ago

Close as OBE. This should be resolved when SDS is working.