Closed jacklinton closed 2 years ago
Thanks for the question!
You are correct, most FHIR resources are able to handle all CRUD responses. However, not all servers want to support this functionality for each resource. The CapabilityStatement should show which CRUD operations can be performed on each resource. To improve flexibility, we use separate services for each resource
Do you want to request a feature, report a bug, or improve documentation?
Yes.
I asked this question on Stack Overflow 8 months ago with no response so I have to assume you folks aren't checking there. Apologies for asking about it here, but I'm not sure what else to do.
https://stackoverflow.com/questions/60469987/why-isnt-the-resource-type-exposed-through-the-sanitized-args-in-node-fhir-serv
"I figure there must be a reason why the resource type is not returned with the sanitized params when building services for fhir resources. Why is that?
Without the resource type there would have to be a separate service for each resource (like the MongoDB example repo that Asymmetrik provides) which ends up in a lot of code duplication. The resource type can be dug out of the request object, however I don't want to do that if there is some kind of safety or security reason for not making it easily accessible like the base_version url parameter.
I'm sure there are subtle differences between the way that some resources need to be handled. I certainly haven't worked with them all, but in my experience, each resource requires the same set of methods with the same functionality and so a single generic service could be created to handle all the CRUD and basic REST functionality for all resources easily but only if you know what resource services are being requested programmatically."