Skip to content

[BB2-896] Responsive Design Sample App Python React 2#7

Merged
JFU-GIT merged 3 commits intomainfrom
jfuqian/BB2-896-Responsive-Design-Sample-App-Python-React-2
Jan 21, 2022
Merged

[BB2-896] Responsive Design Sample App Python React 2#7
JFU-GIT merged 3 commits intomainfrom
jfuqian/BB2-896-Responsive-Design-Sample-App-Python-React-2

Conversation

@JFU-GIT
Copy link
Copy Markdown
Contributor

@JFU-GIT JFU-GIT commented Jan 6, 2022

JIRA Ticket:
BB2-896

User Story or Bug Summary:

As a 3rd party app, I should be able to understand what to do when I receive certain error messages from BB2 so that I can properly respond to my own users

AC:

Draft documentation for review for:

  • What to do when receiving a 403 error
  • What to do when receiving a 404 error
  • What to do when receiving a 500 error
  • how to implement exponential backoff

In the Node.JS and Python sample apps add in responsive design to show:

  • What to do when receiving a 403 error
  • What to do when receiving a 404 error
  • What to do when receiving a 500 error
  • how to implement exponential backoff

This PR is for applying similar error handling and retry logic to BB2 Sample App Python React.

What Should Reviewers Watch For?

  • Are error responses from API calls handled as instructed by the document?
  • Are any additional documentation updates needed?
  • Are there any unhandled and/or untested edge cases you can think of?
  • Is the retry work as expected?

If you're reviewing this PR, please check these things, in particular:

  • Review the document on API error responses
  • Verify the retry logic works (exponential back off)

To facilitate the verification of retry failed requests, an instrumented BB2 server is deployed to sandbox canary:
put below line into your host file on you local machine:

10.246.44.54 sandbox.bluebutton.cms.gov

then verify retry on EOB request by following following steps:

  1. create an app on sandbox (or using an existing one)
  2. make sure the url is among the redirect urls: http://server:3001/api/bluebutton/callback/
  3. copy the client_id, client_secret to the sample app server config.ts
  4. start sample app in docker: go to local repo base and run : docker-compose up

Wait until the server and client components are up and running.
note, a waffle switch "simulate_500_error" is provisioned on sandbox which when "active", will produce a 500 error on fhir request, with error message: "Service temporarily unavailable, try again later, network connection refused".

From client webUI, click button "Authorize" to complete the beneficiary medicare.gov login, and grant access to the app, the corresponding EOB search will hit the simulated 500 network connection error, and the failed EOB request met the criteria for retry.

below is a sample server stdout showing the retry process, the 3rd attempt succeeded (by setting switch "simulate_500_error" to false soon after 2nd retry ...)

server_1 | Response status code: 500
server_1 | Response text: {"detail":"Service temporarily unavailable, try again later, network connection r
efused."}
server_1 | retrying started ...
server_1 | retry attempts: 1
server_1 | retry attempts: 2
server_1 | retry attempts: 3
server_1 | retry successful:
server_1 | Response status_code: 200
server_1 | Response stext: {"resourceType":"Bundle","id":"4b33d4ff-08da-4daa-8a54-ae033a395cb8","meta":{"la
stUpdated":"2021-09-23T13:36:42.530-04:00"},"type":"searchset","total":40,"link":[{"relation":"first","url":
.... FHIR bundle truncated for briefness.

Copy link
Copy Markdown
Contributor

@dtisza1 dtisza1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JFU-GIT This is looking good.

Just a couple of snake vs. camel case renaming changes and including error code information is needed.

These should be changed to snake case for the following Python files:

For example:

server/src/data/Database.py -> database.py
server/src/utils/bb2Util.py -> bb2_util.py
server/src/utils/configUtil.py -> config_util.py
server/src/utils/userUtil.py -> user_util.py

Comment thread README.md Outdated
Debugging server component
--------------------------
debugpy remote debugging enabled on port 5678 for server in docker compose, developer can attach to server from IDE e.g. vscode.

No newline at end of file
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The corresponding ErrorResponses.md from the NodeJS/React PR should be added and referenced in this readme file.

Copy link
Copy Markdown
Contributor

@nbragdon nbragdon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once you do the changes that @dtisza1 recommended, this should be good!

@JFU-GIT JFU-GIT merged commit 381272e into main Jan 21, 2022
@JFU-GIT JFU-GIT deleted the jfuqian/BB2-896-Responsive-Design-Sample-App-Python-React-2 branch January 21, 2022 16:44
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

Successfully merging this pull request may close these issues.

3 participants