fhir-sdk icon indicating copy to clipboard operation
fhir-sdk copied to clipboard

CodeSystem $lookup operation

Open azriel-healthpoint opened this issue 1 year ago • 1 comments

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?

azriel-healthpoint avatar Mar 19 '24 20:03 azriel-healthpoint

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.

FlixCoder avatar Mar 19 '24 20:03 FlixCoder

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.
}

FlixCoder avatar Aug 18 '24 13:08 FlixCoder

Thank you 🙇!

azriel-healthpoint avatar Aug 18 '24 19:08 azriel-healthpoint