fhir-sdk
fhir-sdk copied to clipboard
CodeSystem $lookup operation
Hi there,
I'm trying out this SDK, and couldn't figure out if it's possible to call the /CodeSystem/$lookup operation:
GET $base_url/CodeSystem/$lookup?system=..&code=..
Would the SDK need to be extended to include methods like Client::operation_encounter_everything, or is there some way to invoke arbitrary operations through Client and OperationDefinition?
Hi, thank you for the interest.
There is currently no generic way for arbitrary operations, partly due to unknown return types, partly due to the reason I want to implement proper more usable methods.
So if the operation is defined in the FHIR spec, it would just need additional methods for the operation. Otherwise it would need some kind of generic method.
As of 0.14.0 it is now possible to send custom requests and therefore implement your own operations and implementing missing operations :)
let base = client.base_url();
let response = client.send_custom_request(|http| http.get(&format!("{base}/CodeSystem/$lookup")).query(...)).await?;
if response.status().is_success() {
let parameters: Parameters = response.json().await?;
// Do whatever with it.
}
Thank you 🙇!