-
Notifications
You must be signed in to change notification settings - Fork 100
Customizing node fhir server core Behavior
If you're looking to customize or modify the behavior of @asymmetrik/node-fhir-server-core
for your node-fhir-server-mongo
implementation, there are a couple of steps you'll need to follow.
node-fhir-server-core
: git clone https://github.com/Asymmetrik/node-fhir-server-core.git
node-fhir-server-mongo
: git clone https://github.com/Asymmetrik/node-fhir-server-mongo.git
Make whatever modifications you need to the server and associated controllers and resources to your local copy of node-fhir-server-core
. For example, this process was tested by making edits to the .toJSON()
method in the patient resource class at ./node-fhir-server-core/src/server/resources/4_0_0/schemas/patient.js
.
You'll need to change the dependencies in ./node-fhir-server-mongo/package.json
.
The dependencies section of the file will look like this (version numbers may be out of date in this example):
"dependencies": {
"@asymmetrik/node-fhir-server-core": "^2.0.5",
"fast-json-patch": "^2.0.7",
"moment-timezone": "^0.5.14",
"mongo": "^0.1.0",
"object-hash": "^1.3.1",
"var": "^0.3.2"
},
Edit the @asymmetrik/node-fhir-server-core
dependency to point to your local copy of the code:
"dependencies": {
"@asymmetrik/node-fhir-server-core": "/YOUR/PATH/HERE/node-fhir-server-core",
"fast-json-patch": "^2.0.7",
"moment-timezone": "^0.5.14",
"mongo": "^0.1.0",
"object-hash": "^1.3.1",
"var": "^0.3.2"
},
Run yarn install
to add the customized package to your node_modules
.
NOTE: Every time you make additional changes/customizations to your local copy of node-fhir-server-core
, you will need to delete the ./node-fhir-server-mongo/node_modules
directory and re-run the yarn-install
command.
In order to propagate your customized package when running the server using Docker, you'll need to edit ./node-fhir-server-mongo/docker-compose.yml
.
The volumes section of the file will look like this:
volumes:
- ./src:/srv/src/src
Edit it to look like this:
volumes:
- ./src:/srv/src/src
- ./node_modules:/srv/src/node_modules
Now when you run your server using either yarn start
or docker-compose up
you should see the changes you made in node-fhir-server-core
in action.