.olegro
04/21/2023, 7:43 PMnot found error. There are no details on the creation part here: https://www.medplum.com/docs/sdk/classes/MedplumClient#updateresource
In the HL7 FHIR R4 spec it seems that some servers are offering Update as Create https://www.hl7.org/fhir/http.html#update
Trying to see how to make it work through the client, or need to do it by hand with direct request with options like such:
const options = {
method: 'PUT',
headers: {
'Content-Type': 'application/fhir+json',
'If-None-Match': '*'
},
body: JSON.stringify({
// Patient resource goes here with ID included
})
};
fetch(url, options)
.then(response => {
if (response.status === 200) {
// Resource was updated
} else if (response.status === 201) {
// Resource was created
}
})rahul1
04/21/2023, 9:15 PMrahul1
04/21/2023, 9:16 PM.olegro
04/21/2023, 9:43 PM.olegro
04/21/2023, 9:46 PMrahul1
04/21/2023, 10:04 PMmeta.id property.
If you're client application has super admin privileges (i.e. was created in the Super Admin project), it should be able to set the ids upon create.
Below is a guide to our super admin documentation:
https://www.medplum.com/docs/self-hosting/super-admin-guide.olegro
04/21/2023, 10:48 PM.olegro
04/23/2023, 2:53 AMrepo.ts
https://github.com/medplum/medplum/blob/main/packages/server/src/fhir/repo.ts#L498cody
04/23/2023, 4:07 PMPractitioner user or a ClientApplication in the super admin Project.
At present, client-assigned ID's require a little extra care because resource ID === database primary key ID. Therefore, it is only possible in a self-hosted environment / non-multi-tenant environment. It is absolutely technically possible with a few tweaks in repo.ts. Extra care would be required for the case where a user attempts to use a UUID that is already used in a different Project.
The work for full client-assigned IDs is actually mostly done:
1. Github discussion: https://github.com/medplum/medplum/discussions/1175
2. PR with "part 1" of the implementation: https://github.com/medplum/medplum/pull/1350
We've been sitting on that because (1) it does have a perf hit, (2) it increases system complexity, and (3) no customer has explicitly asked for it. We'd be happy to discuss that work too if you're interested..olegro
04/25/2023, 1:52 PMRaf
05/05/2023, 10:45 PMdselans
04/17/2025, 10:23 PMdselans
04/17/2025, 10:24 PM