Skip to content

Commit 90eb9b6

Browse files
committed
Merge branch 'main' of https://github.com/CMSgov/bluebutton-sample-client-python-react into feature/c4dic
2 parents ac6a45d + 8ae52b6 commit 90eb9b6

33 files changed

+4316
-7541
lines changed

.github/pull_request_template.md

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,16 @@ This PR template is here to help ensure you're setup for success:
55
-->
66

77
**JIRA Ticket:**
8-
[SOMEPROJECT-42](https://jira.cms.gov/browse/SOMEPROJECT-42)
8+
[BB2-XXXX](https://jira.cms.gov/browse/BB2-XXXX)
99

10-
**User Story or Bug Summary:**
11-
12-
<!-- Please copy-paste the brief user story or bug description that this PR is intended to address. -->
1310

1411
### What Does This PR Do?
15-
1612
<!--
1713
Add detailed description & discussion of changes here.
18-
The contents of this section should be used as your commit message (unless you merge the PR via a merge commit, of course).
19-
20-
Please follow standard Git commit message guidelines:
21-
* First line should be a capitalized, short (50 chars or less) summary.
22-
* The rest of the message should be in standard Markdown format, wrapped to 72 characters.
23-
* Describe your changes in imperative mood, e.g. "make xyzzy do frotz" instead of "[This patch] makes xyzzy do frotz" or "[I] changed xyzzy to do frotz", as if you are giving orders to the codebase to change its behavior.
24-
* List all relevant Jira issue keys, one per line at the end of the message, per: <https://confluence.atlassian.com/jirasoftwarecloud/processing-issues-with-smart-commits-788960027.html>.
25-
26-
Reference: <https://git-scm.com/book/en/v2/Distributed-Git-Contributing-to-a-Project>.
2714
-->
2815

2916
### What Should Reviewers Watch For?
30-
3117
<!--
32-
Add some items to the following list, or remove the entire section if it doesn't apply for some reason.
33-
3418
Common items include:
3519
* Is this likely to address the goals expressed in the user story?
3620
* Are any additional documentation updates needed?
@@ -40,6 +24,11 @@ Common items include:
4024
* Can you find any bugs if you run the code locally and test it manually?
4125
-->
4226

43-
If you're reviewing this PR, please check these things, in particular:
27+
If you're reviewing this PR, please check for these things in particular:
28+
<!-- Add some items here -->
29+
30+
### Validation
4431

45-
- TODO
32+
<!--
33+
Have you fully verified and tested these changes? Is the acceptance criteria met? Please provide reproducible testing instructions, code snippets, or screenshots as applicable.
34+
-->

.github/workflows/ci.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: CI for Node.js React Sample App
2+
on: [push]
3+
jobs:
4+
build:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- uses: actions/checkout@v4
8+
9+
- uses: actions/setup-node@v4
10+
with:
11+
node-version: 20
12+
13+
- uses: actions/setup-python@v5
14+
with:
15+
python-version: 3.9
16+
17+
- name: Install client
18+
run: yarn --cwd client install
19+
20+
- name: Lint client source
21+
run: yarn --cwd client lint
22+
23+
- name: Install server (Python) and lint
24+
run: |
25+
cd server
26+
python -m venv bb2_venv
27+
. ./bb2_venv/bin/activate
28+
pip install pipenv flake8
29+
pip install cms-bluebutton-sdk
30+
pipenv lock
31+
pipenv install --system --deploy --ignore-pipfile
32+
flake8 --exclude bb2_venv --max-line-length 130

README-bb2-dev.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,21 @@ Note: --abort-on-container-exit will abort client and server containers when sel
2828

2929
Note: You may need to clean up already existing Docker containers, if you are having issues or have changed your configuration file.
3030

31+
## Use default data sets
32+
33+
Instead of using the BB2 API to retrieve data from a BB2 server every time you run the
34+
sample client, you can alternatively pre-populate json content to be loaded. To do so,
35+
replace the json files in `server/default_datasets/Dataset 1` with your desired default
36+
data, and then in `client/src/components/patientData.tsx`, update the
37+
`useDefaultDataButton` const to `true`.
38+
39+
Then on the landing page of the sample client, in addition to the normal button
40+
`Authorize` which can be used to query a BB2 server, there will also be a
41+
`Load default data` button which can be used to load the data from the json files.
42+
43+
This is useful when developing front-end content since it shortens the amount of time
44+
it takes to load sample data.
45+
3146
## Visual trouble shoot
3247

3348
Install VNC viewer and point browser to http://localhost:5900 to monitor web UI interactions

README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,28 @@ Running the Back-end & Front-end
2424
---------------
2525

2626
Once Docker and Python are Installed then do the following:
27-
27+
28+
```
2829
cp server/sample-bluebutton-config.json server/.bluebutton-config.json
30+
```
2931

3032
Make sure to replace the client_id and client_secret variables within the config file with
3133
the ones you were provided, for your application, when you created your Blue Button Sandbox account,
3234
the supported environments are SANDBOX or PRODUCTION.
3335

36+
```
3437
docker-compose up -d
38+
```
3539

3640
This single command will create the docker container with all the necessary packages, configuration, and code to
3741
run both the front and back ends of this sample application.
3842

43+
To run the front-end (client component listening on port 3000) in preview mode, set environment variable BB2_APP_LAUNCH=preview when launch docker-compose:
44+
45+
```
46+
BB2_APP_LAUNCH=preview docker-compose up -d
47+
```
48+
3949
To see the application in action open your browser and enter the following URL:
4050

4151
http://localhost:3000
@@ -64,7 +74,7 @@ Please review our SDK documentation for more information and additional features
6474

6575
Debugging server component
6676
--------------------------
67-
debugpy remote debugging enabled on port 5678 for server in docker compose, developer can attach to server from IDE e.g. vscode.
77+
debugpy remote debugging enabled on port 10678 for server in docker compose, developer can attach to server from IDE e.g. vscode.
6878

6979
Error Responses and handling:
7080
-----------------------------

client/.eslintrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"extends": [
3+
"react-app"
4+
]
5+
}

client/Dockerfile

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
FROM node:20-slim
1+
FROM node:22
2+
3+
ARG BB2-APP_LAUNCH
4+
5+
ENV BB2_APP_LAUNCH=${BB2_APP_LAUNCH:-"start"}
26

37
LABEL version="1.1"
48
LABEL description="Demo of a Medicare claims data sample app"
@@ -13,7 +17,9 @@ RUN apt-get install python3 -y
1317
RUN apt-get install python3-pip -y
1418

1519
RUN yarn install
20+
# comment build out if not going to use preview to save build time
21+
RUN yarn build
1622

1723
EXPOSE 3000
1824

19-
CMD ["yarn","start"]
25+
CMD ["sh", "-c", "yarn $BB2_APP_LAUNCH"]

client/README.md

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
# Getting Started with Create React App
1+
# Getting Started with Vite
22

3-
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
3+
This project was created with build tool [Vite](https://v2.vitejs.dev/).
4+
Vite (French word for "quick", pronounced /vit/, like "veet") is a build tool that aims to provide a faster and leaner development experience for modern web projects.
45

56
## Available Scripts
67

@@ -14,11 +15,6 @@ Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
1415
The page will reload if you make edits.\
1516
You will also see any lint errors in the console.
1617

17-
### `yarn test`
18-
19-
Launches the test runner in the interactive watch mode.\
20-
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
21-
2218
### `yarn build`
2319

2420
Builds the app for production to the `build` folder.\
@@ -27,20 +23,20 @@ It correctly bundles React in production mode and optimizes the build for the be
2723
The build is minified and the filenames include the hashes.\
2824
Your app is ready to be deployed!
2925

30-
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
26+
### `yarn preview`
3127

32-
### `yarn eject`
28+
Locally preview the production build. Do not use this as a production server as it's not designed for it.
3329

34-
**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
30+
## Learn More
3531

36-
If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
32+
You can learn more in the [Vite documentation: Getting Started](https://v2.vitejs.dev/guide/).
3733

38-
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
34+
To learn React, check out the [React documentation](https://reactjs.org/).
3935

40-
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
36+
### `yarn test`
4137

42-
## Learn More
38+
Run vitest based test (need spinning up the app to pass the tests)
4339

44-
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
40+
### `yarn coverage`
4541

46-
To learn React, check out the [React documentation](https://reactjs.org/).
42+
Run vitest based test with coverage (need spinning up the app to pass the tests)

client/eslint.config.mjs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { fixupConfigRules } from "@eslint/compat";
2+
import path from "node:path";
3+
import { fileURLToPath } from "node:url";
4+
import js from "@eslint/js";
5+
import { FlatCompat } from "@eslint/eslintrc";
6+
7+
const __filename = fileURLToPath(import.meta.url);
8+
const __dirname = path.dirname(__filename);
9+
const compat = new FlatCompat({
10+
baseDirectory: __dirname,
11+
recommendedConfig: js.configs.recommended,
12+
allConfig: js.configs.all
13+
});
14+
15+
export default [{
16+
ignores: [],
17+
}, ...fixupConfigRules(compat.extends("react-app"))];

client/eslintrc.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"env": {
3+
"browser": true,
4+
"es2021": true
5+
},
6+
"extends": [
7+
"eslint:recommended",
8+
"plugin:react/recommended",
9+
"plugin:@typescript-eslint/recommended"
10+
],
11+
"parser": "@typescript-eslint/parser",
12+
"parserOptions": {
13+
"ecmaFeatures": {
14+
"jsx": true
15+
},
16+
"ecmaVersion": 12
17+
},
18+
"plugins": [
19+
"react",
20+
"@typescript-eslint"
21+
],
22+
"rules": {
23+
"@typescript-eslint/no-explicit-any": "off"
24+
}
25+
}

client/index.html

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<link rel="icon" href="/favicon.ico" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1" />
7+
<meta name="theme-color" content="#000000" />
8+
<meta
9+
name="description"
10+
content="Blue Button 2.0 Sample App"
11+
/>
12+
<link rel="manifest" href="/manifest.json" />
13+
<title>Medicare claims data sample app</title>
14+
</head>
15+
<body>
16+
<noscript>You need to enable JavaScript to run this app.</noscript>
17+
<div id="root"></div>
18+
<script type="module" src="/src/index.tsx"></script>
19+
</body>
20+
</html>

0 commit comments

Comments
 (0)