Skip to content

DRAFT: [ BB2-1133 ] Replace code to utilize the BB2 Node SDK#26

Closed
dtisza1 wants to merge 14 commits intomasterfrom
BB2-1133_use_node_sdk
Closed

DRAFT: [ BB2-1133 ] Replace code to utilize the BB2 Node SDK#26
dtisza1 wants to merge 14 commits intomasterfrom
BB2-1133_use_node_sdk

Conversation

@dtisza1
Copy link
Copy Markdown
Contributor

@dtisza1 dtisza1 commented Apr 18, 2022

JIRA Ticket:
BB2-1133

User Story or Bug Summary:

This replaces code to utilize the SDK in the sample application.

This work goes along with this PR for updating the SDK.

NOTE: This replaces this PR and continues Nick's great work.

NOTE: Keeping this PR in draft mode until it is time to publish.

What Does This PR Do?

The following is a summary of the changes in this PR

  • Add cms-bluebutton-sdk dependency via .tgz file installation in server/package.json

  • Add imports for SDK in files where needed. The following imports are used:

import BlueButton from "cms-bluebutton-sdk";
import Environments from 'cms-bluebutton-sdk';
import { Errors } from 'cms-bluebutton-sdk';
  • Add BB2 SDK configuration in server/src/Server.ts

  • Replace Auth related code with SDK usage in server/src/routes/Authorize.ts

  • Add example of handling SDK exceptions in server/src/routes/Authorize.ts

  • Replace FHIR resource code with SDK usage in server/src/routes/Data.ts

  • Remove all code and files replaced by SDK usage.

  • Update Typescript configuration options in server/tsconfig.json

  • Copy server/yarn.lock from docker container installation to add to PR using:

docker cp <container-id>:/server/yarn.lock server/yarn.lock
  • Misc. cleanup.

PR Testing Procedure

  1. Create a .tgz package file from the main SDK branch here.

Use these commands in a shell from the project root directory:

# REPO:  CMSgov/cms-bb2-node-sdk
git checkout main

# Clean up build & dist directories:
rm -rf build/ dist/

# Build
yarn build
yarn build:types

# Create tarball package .tgz file
yarn pack

This should produce a package .tgz tarball file named cms-bluebutton-sdk-v0.1.0.tgz.

  1. Copy the .tgz package file in to this PR's branch.

    Copy the cms-bluebutton-sdk-v0.1.0.tgz file in to the server/ directory.

    Verify the following line is in the server/package.json file:

      "cms-bluebutton": "file:cms-bluebutton-sdk-v0.1.0.tgz",
    
  2. Build and Run the sample application using the SDK:

# REPO:  CMSgov/bluebutton-sample-client-nodejs-react
git checkout origin/BB2-1133_use_node_sdk

docker-compose down

docker rmi bluebutton-sample-client-nodejs-react_server

docker rmi bluebutton-sample-client-nodejs-react_client

rm server/package-lock.json server/yarn.lock

docker-compose up -d

docker-compose logs -f # To see logs
  1. Test the sample client in your browser via http://localhost:3000

What Should Reviewers Watch For?

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

  • Are there any unhandled and/or untested edge cases you can think of?

  • Does this make any backwards-incompatible changes that might break end user clients?

  • Can you find any bugs if you run the code locally and test it manually?

  • Naming in general? Do the namings of variables, methods, classes, and other items make sense? Are they too verbose, or not verbose enough? Any redundancies? Are the comments descriptive enough?

  • Are audit logging items properly handled? Is sensitive information either not included or hashed?

  • What/how to review:

@dtisza1 dtisza1 self-assigned this Apr 18, 2022
@dtisza1 dtisza1 changed the title [ BB2-1133 ] Use node SDK [ BB2-1133 ] Replace code to utilize the BB2 Node SDK Apr 29, 2022
@dtisza1
Copy link
Copy Markdown
Contributor Author

dtisza1 commented Apr 29, 2022

This is ready for review and testing.

@oragame
Copy link
Copy Markdown
Contributor

oragame commented May 6, 2022

I am running into some issues following the test outline. my package.json did not have the line:
"cms-bluebutton": "file:cms-bluebutton-sdk-v0.1.0.tgz",
So i had to add it in the dependencies. When i move to step 3 as a result of adding to package.json i get this error:

error: Your local changes to the following files would be overwritten by checkout:
	server/package.json
Please commit your changes or stash them before you switch branches.
Aborting```

@oragame
Copy link
Copy Markdown
Contributor

oragame commented May 6, 2022

Cool, I was able to work through the issues with your help. This all looks good so far!

@dtisza1 dtisza1 requested review from ajshred and removed request for bfausett77 and gmonahan August 5, 2022 13:07
@dtisza1 dtisza1 changed the title [ BB2-1133 ] Replace code to utilize the BB2 Node SDK DRAFT: [ BB2-1133 ] Replace code to utilize the BB2 Node SDK Aug 5, 2022
@ajshred
Copy link
Copy Markdown

ajshred commented Aug 9, 2022

Updated readme and pointed out SDK call in code comments. Please take a look. @dtisza1 @JFU-GIT

@dtisza1
Copy link
Copy Markdown
Contributor Author

dtisza1 commented Dec 20, 2022

This work was implemented via this PR: #33

@dtisza1 dtisza1 closed this Dec 20, 2022
@dtisza1 dtisza1 deleted the BB2-1133_use_node_sdk branch December 20, 2022 14:25
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