As soon as you have access to iCure (online or locally), you will need to set up your environment. To do this, you can follow this example which will help you initialize a node application communicating with the iCure solution.
Authenticating with iCure from your code
After completing the steps above, you will be able to dive into writing some code. For this, you will need the encryption private key you downloaded during the registration process of your user.
In the following example, the private key is MIIEvAIBAD...9HOmEwWQ==. Also, do not forget to replace the username - password (esmith - mypassword) by your own values.
Once you are authenticated, you can easily create a patient. The Patient data model is described here.
Create a patient
const patient = await patientApi.createPatientWithUser(loggedUser,
await patientApi.newInstance(
loggedUser,
new Patient({
firstName: 'Gustave',
lastName: 'Eiffel',
dateOfBirth:19731011,
note: 'A very private information'
}))
)
As you can see in the code above, we are using some specific API methods to create our patient (createPatientWithUser instead of createPatient, api.newInstance instead of "only" creating a new object, ...). This is because those methods are taking care of the data end-to-end encryption for us.
In iCure, medical data is stored inside contacts. A contact groups a batch of measures/observations (represented in iCure data model as services) in one single transaction. A contact always links together a healthcare party (A care provider) to one patient.
Before adding new medical data into the iCure system, you then absolutely need to create :