node
01/23/2024, 4:27 PMactive status where it was either previously draft OR has no previous state (directly created in active status).
My filter expression valueString is "%previous={} or %previous.status='draft'" and the subscription criteria is 'Consent?status=active' and it is working properly when a Consent goes from draft->active but it does not work when I directly create a Consent in active status.
This leads me to believe that %previous={} is not doing what I expected.
The docs note:
https://www.medplum.com/docs/subscriptions/subscription-extensions#expression-based-criteria
> Upon the creation of a resource, there won't be a previous version of the resource. %previous will be an empty object.
How do we check if %previous is an empty object in the fhirpath expression? Maybe I want to use the [equivalent operator](https://build.fhir.org/ig/HL7/FHIRPath/#equivalent) ?node
01/23/2024, 4:38 PMreshma
01/23/2024, 11:35 PMnode
01/24/2024, 3:55 PMreshma
01/24/2024, 5:05 PMrahul1
01/24/2024, 5:51 PM%previous.exists()? This is a function that is in the FHIRPath spec.
You can see an example here wrt. write-constraints
https://www.medplum.com/docs/access/access-policies#write-constraintsnode
01/25/2024, 12:21 AMexists & empty function implementations
Opened this issue to track https://github.com/medplum/medplum/issues/3807rahul1
01/25/2024, 5:10 AM