Open mattStorer opened 1 year ago
Agreed, when a resource has no base url, we can choose to trust it is OK. This seems like a good "policy" flag that belongs in a configuration item.
I’m writing a few unit tests, for storing local and foreign resources as you describe. So far I found an issue with storing a non-partitionable resources. I’ll commit that soon.
Currently I can see that, though I’m providing an id on a new patient resource, when I ask the server to create it, the id is getting erased. It may need to be a PUT instead of a POST. I’ll try that.
Currently I can see that, though I’m providing an id on a new patient resource, when I ask the server to create it, the id is getting erased. It may need to be a PUT instead of a POST. I’ll try that.
Yes, PUT allows the ID to be retained, I've successfully tested that.
The new problem I'm encountering is that I can't PUT a foreign Patient resource without first PUTting the referenced Practitioner resource. But what if the referenced Practitioner references another resource? What if there are cyclical dependencies? What if we can't read certain resources due to scoping issues? We certainly can't remove references. Could we tell the system to just put them anyway, even though the references don't point to anything valid? I don't like that either. But it seems we need be very, very intentional about the order in which we write resources to the SDS if we want to avoid these sorts of issues.
debug session attempting to post a Condition for a foreign Patient resource progresses through the interceptors until we hit
SupplementalDataStorePartitionInterceptor.validateResourceBelongsInPartition()
which fails with message "id element present without base url; cannot match SDS partition" as the id has no base URL.which makes sense, as this is the resource we're trying to post:
the
X-Partition-Name
header ishttps://epicmobile.ohsu.edu/FHIRDEV/api/FHIR/R4
as this resource comes from the OHSU POC FHIR server (all fake / test data), and this is also the base URL for that system. (the partition name and the base URL of the source system should be the same).however, as you can see, the string
https://epicmobile.ohsu.edu/FHIRDEV/api/FHIR/R4
doesn't occur anywhere in the sourceCondition
resource above, so it seems this base URL might not be available within the context of resources we're trying to clone into the SDS in this way.if this is definitely the case and there's no way to get around it, we'll need to sort out another way to validate partition membership, or just trust the source system to provide the correct partition and skip validation altogether.