Get Started with a Database
iCure Data Stack helps developers create connected apps for healthcare in no time. Let's give it a quick try by creating a node application that lets you store and access encrypted patients in a cloud data store.
First head to Register on our cloud platform and create a database and a user. You will need the username and password below.
Node 15 and Yarn are needed for this example.
mkdir patient-manager
cd patient-manager
yarn init -y
yarn add @icure/api
#if you are using node two other dependencies are needed
yarn add node-fetch node-localstorage
Now create a file name index.mjs
import {Api, hex2ua, Patient} from '@icure/api'
import {crypto} from '@icure/api/node-compat.js'
const host = 'https://kraken.icure.dev/rest/v1';
const {
patientApi,
userApi,
healthcarePartyApi,
cryptoApi
} = Api(host, 'esmith', 'mypassword', crypto)
const loggedUser = await userApi.getCurrentUser();
const loggedHcp = await healthcarePartyApi.getCurrentHealthcareParty()
await cryptoApi.loadKeyPairsAsTextInBrowserLocalStorage(
loggedUser.healthcarePartyId,
hex2ua("308204bc02...473a613059")
)
const patient = await patientApi.createPatientWithUser(loggedUser,
await patientApi.newInstance(
loggedUser,
new Patient({
firstName: 'Gustave',
lastName: 'Eiffel',
profession: 'Architect & Engineer',
dateOfBirth: 19731012,
note: 'A very private information'
}))
)
const fetchedPatient = await patientApi.getPatientWithUser(loggedUser, patient.id)
console.log(JSON.stringify(fetchedPatient, null, ' '))
$ node index.mjs
Last updated
Was this helpful?