@spencer-health/hap-db
v2.29.25
Published
spencer Database Models and higher order functions for DB access
Readme
hap-db
Part Number: 11856
Version 2.15.1
Copyright (c) 2020 by Spencer Health Solutions, Inc. All rights reserved.
Overview
hap-db is a common library of database functions used between Node.js and the MySQL database. It is delivered as a package and linked by the following applications:
- jobberthehut
- portal-api
- registration-service
- sns-device-notification-service
Each time the hap-db project is updated, the above projects should also be relinked as needed to pick up the changes.
Installing
- Install the npm package (on mac prefix with
CXX=g++-5)npm install --save git+ssh://[email protected]:8445/cloud/hap-db.gitThis adds the master branch to the project.
Docker Usage
Building into a docker image
The project contains a docker-build.sh script that can be used to build the project into a docker image. There is a hierarchy of modules used within the spencer applications, so each of these is built into a layer that can be used by other projects. The current layering consists of: node:10 -> netsuite-integration -> hap-mailer -> hap-db -> final target.
Installing into a project
Starting at v2.12.0, hap-db is built into a Docker image that can be used by an application as the base image. In this case, the install is actually performed when the container is run, and requires that the calling program builds from the image:
FROM 317172064895.dkr.ecr.us-east-1.amazonaws.com/shs/hap-db:v2.12
CMD ["/usr/src/app/bin/start.sh"]
Change the version to be the one that is the latest release, as appropriate, and include the bin scripts to start the application after installing the hp-db module upon starting the container.
Using
The following code snippet is an example of integrating the hap-db module into your project. Note that your module is responsible for making the dbConfig parameters configurable.
const hapDb = require('hapDb');
const isDebug = true; // Optional
const dbConfig = {
connection: {
dbHost: 'IP_OR_HOSTNAME',
dbPort: 3306,
dbUser: 'USERNAME',
dbPass: 'PASS'
}
};
hapDb.init(dbConfig, isDebug);
// Test it out
db.Patient.query().where({ PatientId: 1 })
.then(results => console.log(results))
.catch(err => console.log(err, err.stack))
.finally(() => db.knex.destroy());Known Issues
- Refer to 2020.A Outstanding Defect List
Revision History
Version 2.12.3 (2020.A)
- SOFTW-1067 Dockerize hap-db
Version 2.11.2 (2019.D)
- SOFTW-701 Create Prod EU environment
- CLOUD-2004 Add pouches bug
- SOFTW-82 Add get MedBoxEvent and External Patients
- SOFTW-525 Device Register Token Too Long Causing Promise Rejection
- SOFTW-343 Account culture
- SOFTW-399 Add culture to get patient
- CLOUD-2414 Hierarchies
Version 2.10.2 (2019.A)
- CLOUD-1998 Jobber MedBox Alerts based on EventType table
Version 2.10.2 (2019.A)
- CLOUD-1998 Jobber MedBox Alerts based on EventType table
Version 2.10.0
- CLOUD-1843 Adherence data incorrect with API
- CLOUD-1977 spencerCare - All doses, once sent to Pass are immediately showing in spencerCare as future dose, prior to putting into refill
Version 2.9.2 (2018.B, 2018.C)
- MB-4234
- MB-4224
- MB-4154
- MB-3974
- MB-3576
- CLOUD-3907
- CLOUD-1915
- CLOUD-1793
Version 2.8.0 (2018.A a.k.a. 2017.I)
- CLOUD-1815
- CLOUD-1806
- CLOUD-1751
- CLOUD-1734
- CLOUD-1726
- CLOUD-1721
- CLOUD-1699
- CLOUD-1698
- CLOUD-1596
- CLOUD-1408
- CLOUD-1327
- CLOUD-1230
Version 2.7.5 (2017.H)
- CLOUD-1699
- CLOUD-1654
- CLOUD-1596
- CLOUD-1408
- CLOUD-1327
Version 2.7.4 (2017.G)
- CLOUD-1696
- CLOUD-1646
- CLOUD-1621
- CLOUD-1597
- CLOUD-1536
- CLOUD-1512
- CLOUD-1327
Version 2.6.5 (2017.F)
- CLOUD-1589
- CLOUD-1491
- CLOUD-1471
- CLOUD-1452
- CLOUD-1438
- CLOUD-1436
- CLOUD-1398
- CLOUD-1397
- CLOUD-1346
- CLOUD-1326
- CLOUD-1017
Version 2.5.11
- CLOUD-1418
- CLOUD-1356
- CLOUD-1297
- CLOUD-1207
- CLOUD-1171
- CLOUD-1152
- CLOUD-1130
- CLOUD-1113
- CLOUD-1106
- CLOUD-1093
- CLOUD-1077
- CLOUD-1062
- CLOUD-1060
- CLOUD-1049
- CLOUD-1048
- CLOUD-1022
- CLOUD-1019
- CLOUD-1016
- CLOUD-956
- CLOUD-945
- CLOUD-944
- CLOUD-943
- CLOUD-904
- CLOUD-811
- CLOUD-716
- CLOUD-696
- CLOUD-695
- CLOUD-693
- CLOUD-537
- CLOUD-423
Version 2.4.4
- CLOUD-980
- CLOUD-845
- CLOUD-811
- CLOUD-797
- CLOUD-796
- CLOUD-782
- CLOUD-775
- CLOUD-768
- CLOUD-728
- CLOUD-714
- CLOUD-696
- CLOUD-681
- CLOUD-662
- CLOUD-629
- CLOUD-607
- CLOUD-563
- CLOUD-494
- CLOUD-300
- CLOUD-162
- CLOUD-43
Version 2.3.5
- CLOUD-641
- CLOUD-637
- CLOUD-583
- CLOUD-576
- CLOUD-575
- CLOUD-565
- CLOUD-561
- CLOUD-553
- CLOUD-537
- CLOUD-536
- CLOUD-530
- CLOUD-521
- CLOUD-517
- CLOUD-509
- CLOUD-506
- CLOUD-505
- CLOUD-503
- CLOUD-488
- CLOUD-397
- CLOUD-383
- CLOUD-302
- CLOUD-300
- CLOUD-43
Version 2.2.11
- MB-2822
- MB-2821
- MB-2315
- MB-1828
- CLOUD-477
- CLOUD-449
- CLOUD-448
- CLOUD-447
- CLOUD-388
- CLOUD-387
- CLOUD-385
- CLOUD-369
- CLOUD-329
- CLOUD-309
- CLOUD-305
- CLOUD-304
- CLOUD-298
- CLOUD-264
- CLOUD-249
- CLOUD-247
- CLOUD-185
- CLOUD-184
- CLOUD-131
- CLOUD-122
- CLOUD-121
- CLOUD-115
- CLOUD-111
Version 2.1.0
- CLOUD-119
