
In this document we will help you understand the node.js projects and code and where you need to intervene in order to complete our assignments
We think you have your environment ready from the previous unit.
Just in case:
(We use Visual Studio Code because we use the same editor for all the platforms)
We are giving you TWO node.js projects:
The FHIR server you will intervene to add functionality / fix

To start FIC-SERVER, you need to execute in the console
node index.js or npm start
Verify that the project is running in "http://localhost:3000/"
Remember that the actual FHIR endpoint is http://localhost:3000/4_0_0"
The project that you will use to test your progress and create your submission
Verify the config.js file to see if ServerEndpoint is pointing to "http://localhost:3030/4_0_0/"
So, you will modify FIC-SERVER and use TESTER (in a different window) to test it.
We also provide a postman collection. If you are used to test your APIs with Postman, this is an easy way before using the Tester project

Remember to change the environment to Node.JS FHIR Server before testing.
The Environment menu is in the top-right corner in Postman

For this assignment you need to add search parameters telecom and email to the Patient resource.
Tip#1.1: Where to look: patient.service.js
Remember that for each resource we support we need to code a {{resource_class}}.service.js containing all the CRUD methods we support.
But this resource (Patient) is already supported
Tip#1.2: The FHIR Search for Patient is implemented in module.exports.search
This is how the node.js server identifies how the Search method is implemented for the resource.
Tip#1.3: The module.exports.search method defines the parameters for searching, so you will need to add the new search parameters as new parameters for this method.
let name = args['name'];
let iden = args['identifier'];
let fami = args['family'];
let gend = args['gender'];
let birt = args['birthdate'];
Tip#1.4: After adding the parameters you will need to do something with them if they arrive. See how we process all the other parameters and do something...similar.
Tip#1.5: Remember that for telecom searches, when the system is not equal to email, we want you to raise an exception message, because the underlying API/db does not support phone as an element.
How to do that? You need to put this...somewhere:
...
{
ErrorMessage="HTTP 501 Not Implemented: The underlying server only handles email addresses for the patients, thus search by system=phone is not implemented";
}
}
if (ErrorMessage != "") {
let OO = new getOperationOutcome();
OO.issue=[{
severity: "error",
code : "processing",
diagnostics: ErrorMessage}];
OO.text= {
"status": "generated",
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><h1>Operation Outcome</h1><table border=\"0\"><tr><td style=\"font-weight: bold;\">ERROR</td><td>[]</td><td><pre>"+ErrorMessage+"</pre></td>\n\t\t\t</tr>\n\t\t</table>\n\t</div>"
}
resolve(OO);
Tip#1.6: After implementing, run the set of tests for L01 in the TESTER project using the node.js test tooling in your IDE - you should see something like this if you are successful

For this assignment you need to implement support for the Practitioner resource, using the same underlying person API.
Remember that for each resource we support we need to code a {{resource_class}}.service.js containing all the CRUD methods we support.
This resource (Practitioner) is not supported yet.
Tip#2.1: Where to look? You need to create a new one! Hint: practitioner.service.js
The content for this node.js file will be very similar to the one for Patient.
Tip#2.2: Remember to change all references to Patient into Practitioner
Tip#2.3: Remember to add your new resource provider to the index.js file

Tip#2.4: Remember that birthdate is not one of the parameters for Practitioner search - review your equivalent (for Practitioner) to module.exports.search
Tip#2.5: Remember that for telecom searches, when the system is not equal to email, we want you to raise an exception message, because the underlying API/db does not support phone as an element.
How to do that? You need to return an OperationOutcome, like we did in the previous assignment.
Tip#2.6: Remember that only the NPI identifier is allowed for identifier searches. You need to return a specific message if this is not the case, via an OperationOutcome.
Tip#2.7: Remember to filter in any other search: only persons with one NPI identifier are included in all searches (name, family, gender, etc.)
Tip#2.8: Remember that if you receive a direct get (Practitioner/xxx) and the person does not have a NPI identifier, you need to return a specific error message (Operation Outcome)
Tip#2.9: After implementing, run the set of tests for L02 in the TESTER project using the node.js test tooling in your IDE - you should see something like this if you are successful
For this assignment you need to fix the support for the MedicationRequest resource
Remember that for each resource we support we need to code a {{resource_class}}.service.js containing all the CRUD methods we support.
This resource is already supported.
Tip#3.1: Where to look? Hint: medicationrequest.service.js
Only one method to review - the mapper from Legacy to FHIR Resource, to fix what is needed for FHIR/US Core conformance and add what is requested in the assignment (warning message for opioids and requester.display):
RxToMedicationRequestMapper
Tip#3.2: Remember to review the resource this code creates and see what is missing to make it compliant with FHIR and US CORE MedicationRequest
Tip#3.3: Then you need to use the Legacy API to recover the Practitioner name and add it as display for the requester.
Tip#3.3: Finally, use the Legacy API to check whether the prescribed medication is an opioid, and add the warning message there.
Tip#3.4: After implementing, run the set of three tests for L03 in the TESTER project using the node.js test tooling in your IDE.

Run the node.js file CreateSubmission.js from the Terminal
This will create a file called FHIR_INTERMEDIATE_U3_SUBMISSION...JSON in your project folder
Send the submission file using the assignment block ‘Send your Submission Text'
Send the submission code (Only the classes you modified) using the assignment block ‘Send your Submission Code'