Does anyone know if there is a way for force valid...
# dev
s
Does anyone know if there is a way for force validation on the API side of medplum. For example, I want to require some fields for patients on entry and if it fails that validation, want an error to be thrown and not create the patient
r
@slosarek the mechanism to do this is FHIR Profiles. You can read the discussion here: https://github.com/medplum/medplum/discussions/2006 Do you have a known Proflie you like?
s
The default profiles are fine (something like the US Core Patient Profile) for in terms of definitions. It doesn't look like it would be possible for individual projects or accounts to make adjustments to the profiles, is that correct? For example, if we wanted to make first name and last name required fields. I know we can add front end validation for some of this, but I want to be able to actually enforce it in the database.
r
This is pretty advanced use case - and we don't typically recommend it unless there is a strong reason, but happy to discuss your requirements if it is helpful!
s
So, there is no way to handle data validation in medplum other than in a frontend?
r
If the profiles are active the API will 400 if they are not properly formed - however, creating/authoring profiles is an advanced feature. Here is the guide: https://www.medplum.com/docs/fhir-datastore/profiles
167 Views