Skip to content

Commit 06cba4a

Browse files
committed
Feature: support for uploading GZIP bundles of patient data
1 parent e03b28b commit 06cba4a

File tree

8 files changed

+176
-106
lines changed

8 files changed

+176
-106
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,6 @@ yarn-error.log*
2828

2929
# https://github.com/facebook/create-react-app/issues/6560
3030
src/*.d.ts
31+
32+
# Local data directory
33+
data/

package-lock.json

Lines changed: 24 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
"morgan": "~1.9.1",
5959
"node-jose": "^2.0.0",
6060
"nodemon": "^2.0.7",
61+
"pako": "^2.1.0",
6162
"prop-types": "^15.7.2",
6263
"query-string": "^6.13.8",
6364
"react": "^18.0.0",

src/App.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ app.use(express.json());
1515
app.use(bodyParser.json({ type: ['application/json', 'application/fhir+json'] }));
1616

1717
// Routes for collections
18-
Object.values(collections).forEach(collectionName => {
18+
Object.values(collections).forEach((collectionName) => {
1919
app.use(`/collection/${collectionName}`, genericController(collectionName));
2020
});
2121

src/handlers/crudHandler.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,16 @@ function isMatch(object, attrs) {
2020
}
2121

2222
function getHandler(collectionName, req, res) {
23-
const result = db.select(collectionName, row => isMatch(row, req.query));
23+
const result = db.select(collectionName, (row) => isMatch(row, req.query));
2424
res.send(result);
2525
}
2626

2727
function updateHandler(collectionName, req, res) {
2828
const changedItem = req.body;
29-
if (req.query.id) db.upsert(collectionName, changedItem, r => r.id === req.query.id);
29+
if (req.query.id) db.upsert(collectionName, changedItem, (r) => r.id === req.query.id);
3030
else if (req.query.fullUrl) {
3131
const fullUrl = base64url.decode(req.query.fullUrl);
32-
db.upsert(collectionName, changedItem, r => r.fullUrl === fullUrl);
32+
db.upsert(collectionName, changedItem, (r) => r.fullUrl === fullUrl);
3333
} else {
3434
res.send('Must include id or fullUrl').status(StatusCodes.BAD_REQUEST);
3535
return;
@@ -40,10 +40,10 @@ function updateHandler(collectionName, req, res) {
4040

4141
function deleteHandler(collectionName, req, res) {
4242
if (req.query.id) {
43-
db.delete(collectionName, r => r.id === req.query.id);
43+
db.delete(collectionName, (r) => r.id === req.query.id);
4444
} else if (req.query.fullUrl) {
4545
const fullUrl = base64url.decode(req.query.fullUrl);
46-
db.delete(collectionName, r => r.fullUrl === fullUrl);
46+
db.delete(collectionName, (r) => r.fullUrl === fullUrl);
4747
} else {
4848
res.send('Must include id or fullUrl').status(StatusCodes.BAD_REQUEST);
4949
return;

src/storage/collections.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ module.exports = {
1414
PAYERS: 'payers',
1515
PROCEDURES: 'procedures',
1616
PROVIDERS: 'providers',
17-
SUPPLIES: 'supplies'
17+
SUPPLIES: 'supplies',
1818
};

src/storage/logs.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ const debugConsole = require('debug');
44
const { v4: uuidv4 } = require('uuid');
55

66
function debug(location) {
7-
return message => {
7+
return (message) => {
88
const logger = debugConsole(location);
99
logger(message);
1010
const log = {
1111
id: uuidv4(),
1212
timestamp: Date.now(),
1313
message: message,
14-
location: location
14+
location: location,
1515
};
1616
db.insert(LOGS, log);
1717
};
@@ -25,7 +25,7 @@ function error(location) {
2525
id: uuidv4(),
2626
timestamp: Date.now(),
2727
error: error,
28-
location: location
28+
location: location,
2929
};
3030
db.insert(ERRORS, log);
3131

@@ -34,7 +34,7 @@ function error(location) {
3434
timestamp: Date.now(),
3535
notif: notif || error,
3636
viewed: false,
37-
type: 'error'
37+
type: 'error',
3838
};
3939
db.insert(NOTIFICATIONS, notification);
4040
};
@@ -46,7 +46,7 @@ function storeRequest(request) {
4646
timestamp: Date.now(),
4747
url: request.url,
4848
body: request.body,
49-
headers: request.headers
49+
headers: request.headers,
5050
};
5151
db.insert(REQUESTS, log);
5252
}

0 commit comments

Comments
 (0)