jakxz
07/14/2023, 5:32 PM@medplum/fhir-router (similar to how the mock client is set up) in our development environment as we explore Medplum's FHIR server capabilities. We have it running at /mock in development, and we noticed what seem like intentional omissions from the functionality of the handlers. I found the original discussion (https://github.com/medplum/medplum/discussions/1218) so I'm curious about the intentions behind this (i.e. does this handle everything it is intended to as a facade?). Here's some of the things we tried:
1. It stores a Bundle as a Bundle and doesn't decompose it - can't search for the Patient or EOB resource after storing
2. Regular search parameters don't seem to work - searched localhost:3001/mock/Patient?given=Wellington and it returned all Patients in a Bundle
3. _security doesn't seem to work - searched localhost:3001/mock/Patient?_security=test|R and other variations and it returned the same Bundle regardless
4. _include doesn't seem to work - searched localhost:3001/mock/ExplanationOfBenefit?_include:* and other variations and it returned the same Bundle regardless
5. $everything is not implemented (404)
These are just the first things we thought to test. If they're out of scope for the fhir-router package, that's totally fine, just wanted to confirm. Thanks!jakxz
07/14/2023, 5:36 PMcody
07/14/2023, 6:03 PM@medplum/fhir-router I'll make a distinction between:
1. FhirRouter which is stable, robust, and used in production
2. MemoryRepository which primarily exists for unit tests and Storybook (i.e., https://storybook.medplum.com)
You're right that MemoryRepository has a number of limitations, and is not as complete as the main Repository implementation in @medplum/server
One implementation detail to be aware of is that the behavior of MemoryRepository depends on whether StructureDefinition and SearchParameter resources have been loaded.
On server side, you can load everything like this:
indexStructureDefinitionBundle(readJson('fhir/r4/profiles-types.json') as Bundle);
indexStructureDefinitionBundle(readJson('fhir/r4/profiles-resources.json') as Bundle);
indexStructureDefinitionBundle(readJson('fhir/r4/profiles-medplum.json') as Bundle);
indexSearchParameterBundle(readJson('fhir/r4/search-parameters.json') as Bundle<SearchParameter>);
indexSearchParameterBundle(readJson('fhir/r4/search-parameters-medplum.json') as Bundle<SearchParameter>);
That will fix a bunch of the search parameter issues you're seeing.
To be candid, we've been very surprised by the community usage of MemoryRepository and MockClient. We're trying to add more capabilities, move more functionality out of server into fhir-router, but that's slow.
If you have a particular use case for it, let us know, and we'd be happy to go into more details.rahul1
07/14/2023, 6:20 PMjakxz
07/14/2023, 7:09 PM