How to add business logic on creating of Resources
# support
n
Suppose I use
medplum.createResource
, how do I add more business logic on the backend? for example say I want to create an appointment and restrict that the appointment starts after June 1st, or rate limit the amount of times someone can create an Appointment. How do I do this on the server side, since the POST /fhir endpoint is effectively open It feels like the FHIR expressions are not expressive enough for this purpose.
finally, I understand that the bots could i guess technically do it, but it wouldn't be a request / response flow, as I thought the bots are triggered affter the changes are made
r
@noclip I'll try to clarify a few concepts here: - At the base level, Medplum is an open-ended FHIR store, so it doesn't put any restrictions on the type of FHIR data, that can be added - Yes, Bots are our solution for adding custom business logic on the back end. Our Bot Basics Guide (https://www.medplum.com/docs/bots/bot-basics) is a great intro - Specifically refer to the "Executing Bots'" section. This discusses the
$execute
endpoint, which can be used for synchronous Bot execution - Lastly, it seems like you're working on a scheduling workflow. I'll point you to our scheduling starter pack (code and video). These demonstrate how to implement some of the basic scheduling flows: - https://github.com/medplum/medplum-scheduling-demo -

https://youtu.be/6yAROc0KPos▾

270 Views