Repository containing the work for creating a JavaScript version of the SCORE Project's model for estimation of ten-year risk of fatal cardiovascular disease.
NOTE
See https://kgrid-objects.github.io/score/ (or README.md in the docs
directory) for more information on what the SCORE model does and how to use it.
There are testing and packaging features in this project that require npm, npm is installed with Node.js npm. Once npm is installed
cd ./99999-score/v1
npm install
Check out the score object GitHub repo:
git clone https://github.com/kgrid-objects/score.git
cd score
Then download the latest release of the KGrid Activator from the release page (https://github.com/kgrid/kgrid-activator/releases)
directly into the score
directory you just checked out and start up the Activator pointing to the current directory. For example, on a Mac (you'll need the Java SDK version 8 or higher running on your machine):
java -jar kgrid-activator-1.0.8.jar --kgrid.shelf.cdostore.url=filesystem:file:${PWD}
You can check that the Activator is running by going to http://localhost:8080/99999/score/v1 in a browser. You should see the metadata for the SCORE KO:
{
"@id": "v1",
"@type": "koio:Implementation",
"identifier": "ark:/99999/score/v1",
"title": "SCORE Project",
"hasServiceSpecification": "v1/service-specification.yaml",
"hasDeploymentSpecification": "v1/deployment-specification.yaml",
"hasPayload": "v1/src/score.js",
"@context": [
"http://kgrid.org/koio/contexts/implementation.jsonld"
]
}
To try out the SCORE KO in the Swagger Editor you need to point to the service description from the Swagger Editor at https://editor.swagger.io. The easiest way to is construct a Swagger Editor url pointing to the OpenAPI YAML file containing the service description:
https://editor.swagger.io/?url=http://localhost:8080/99999/score/v1/service-specification.yaml
Follow the editor instructions to try out the SCORE interface. THe Swagger Editor prepopulates the request with the example from teh service description. You can change the input parameters to see how CHD risk is affected.
Go to the sandbox library at monkey-library.kgrid.org and push to push to the sandbox activator at monkey-activator.kgrid.org and follow the link to the Swagger Editor (pointing back to the sandbox activator instance)
├── 99999-score
│ ├── metadata.json
│ └── v1
│ ├── deployment-specification.yaml
│ ├── metadata.json
│ ├── package-lock.json
│ ├── package.json
│ ├── score.js
│ ├── service-specification.yaml
│ └── tests
│ ├── input.csv
│ └── score.test.js
├── README.md
└── docs
├── README.md
└── resources
├── CHD_RISK_Score.Rmd
├── CVD.Scoring.Clinicians.1209.full.pdf
├── SCORE\ Workbook.v2.xlsx
└── score_project_results.pdf
CHD Risk = Non-CHD CVD Risk = Total =
Unit Tests are located in the tests directory and can be executed using npm. These tests utilize Jest and rewire. Jest provides the testing framework and rewire allows the tests to access the javascript function without the convince of the export modules. The tests are in the tests directory. You can execute the tests via npm
npm test
You can create zip file of the Knowledge Object which can be used to deposit to a KGrid Library or load/activate on a KGrid Activator.
npm run package
NPM Tool
CI Build
The IPP Collection utilized Circle CI
- Score KO is tested
- Score KO is packaged
KnowledgeObject to render an image in the browser representing risk score position on chart ex. in existing icon array object