flixcoder / fhir-sdk Goto Github PK
View Code? Open in Web Editor NEWRust FHIR SDK
Home Page: https://crates.io/crates/fhir-sdk
License: MIT License
Rust FHIR SDK
Home Page: https://crates.io/crates/fhir-sdk
License: MIT License
FHIR spec seems to allow setting an extension instead of setting the required field value. This library currently requires to set the field value, regardless of whether the extension is set. It is difficult to represent it in a nice way, so for now it is just ignored. At some point full FHIR compliance would be nice and important though.
Types like DateTime and such are currently just a String, they should become a Rust time that is more usable.
Some checks in GitHub workflows are nice, but the standard runners do not have enough RAM. Would need paid plans or something..
Deriving Hash for ResourceType (and maybe for other structs, too) would allow to use ResourceType as key in a HashMap.
#18 introduced a lot of client implementation detail duplication due to different resource types and such. Maybe it can be reduced a bit as it is mostly copied code. A macro is usually bad to maintain though, so that might or might not be a solution..
I want to experiment with my own Serialize/Deserialize implementation to see if that fixes some of it.
The code generator is a bit chaotic right now, would be nice to clean that up a bit.
Hi, I'm wondering if it would be better to split the generated files in multiple files so that the compiler can handle them without taking 8+ GBs of RAM to compile.
Currently it uses incomplete CodeSystems from the definition, it is better to use the expanded value sets.
fhir_model::r4b::reources::generated::Resource
enum has a duplicate resourceType
field when serialized to json.
Given the following exampe:
#[test]
fn test_serialization() {
let subscription_status = SubscriptionStatus::builder()
.r#type(SubscriptionNotificationType::EventNotification)
.subscription(Reference::builder().build().unwrap())
.build()
.unwrap();
println!("SubscriptionStatus: {}", serde_json::ser::to_string(&subscription_status).unwrap());
let resource = Resource::SubscriptionStatus(subscription_status);
println!("Resource: {}", serde_json::ser::to_string(&resource).unwrap());
}
The SubscriptionStatus is serialized to
{"resourceType":"SubscriptionStatus","type":"event-notification","subscription":{}}
When wrapped in Resource::SubscriptionStatus
, it is serialized to
{"resourceType":"SubscriptionStatus","resourceType":"SubscriptionStatus","type":"event-notification","subscription":{}}
Notice the duplicate resourceType
in the json.
It seems to be caused by this serde tag at fhir-model/src/r4b/resources/generated.rs:114923
#[serde(tag = "resourceType")]
When changed to this, it serializes correctly.
#[serde(untagged)]
And the result:
{"resourceType":"SubscriptionStatus","type":"event-notification","subscription":{}}
See https://github.com/translating-science/rust-smart-fhir (thanks for the notification).
Some integration into fhir-sdk would be great.
Try splitting out codes and types into their own crates.
Support for custom profiles would be a nice to have.
https://www.hl7.org/fhir/profiling.html
Although, this would require thinking about the implementation, because you would need to generate the structs in the consuming service, so this could be quite a fundimental change.
Something like how prost-builder generates structs from protcol buffer files in the build.rs
file of the consuming project could be nice. It could also help with build times as the generated types would sit in the consumers project and would be seporated from the sdk-client code.
This might not be the best approach though.
The fhir-sdk crate can currently only be compiled with one client version, it needs to be adjusted to be able to be used with all FHIR versions somehow..
HI there, i am curios about rust and FHIR with typescript background, i was looking around and just came across this repo in which you are actually quite active. Sending regards. How is it going?
Right now it can be pretty difficult to create FHIR resources directly with Rust code.
Rust example:
let mut patient = Patient::builder().build();
let family_name = HumanName::builder().family(String::from("Family")).build();
let given_name = HumanName::builder().given(Vec::from([Some(String::from("Given"))])).build();
patient.name = vec![Some(family_name), Some(given_name)];
While for C# FHIR SDK it's like:
var patient = new Patient();
patient.Name = new List<HumanName>
{
new HumanName
{
Family = "Family",
Given = new List<string>
{
"Given"
}
}
};
My suggestion would be to either have a helper/wrapper for all fields, or if possible to do it like C# where you basically write it as JSON (I don't know if it's possible).
Have helpers for all fields
let mut patient = Patient::builder().build();
patient.set_family_name(String::from("Family");
patient.set_given_name(Vec::from([Some(String::from("Given"))]));
If possible have it similar to C#.
NOTE! Not valid code, just a suggestion as I really like this kind of syntax.
let mut patient = Patient::builder().build();
patient.name = {
family = String::from("Family"),
given = vec![Some(String::from("Given))]
};
Currently, the GET version is used with parameters being in the URL. This is limited in length.
Hello, have checked the tests but can't figure out what's the process to patch a full Vector or a single element in a vector. Is there a way with the current Builder API?
fhir_update = fhir_update.replace(
"Patient.name",
ParametersParameter::builder()
.name("value".to_owned())
.value(ParametersParameterValue::HumanName(
HumanName::builder()
.given(vec![Some(first_name.to_string())])
.family(last_name.to_string())
.build()?,
))
.build()?,
);
This will replace all the names by the new HumanName provided. Is there a way to replace the whole array providing more than one HumanName? Or better replace one HumanName E.g. by Type? or System?
I cannot seem to find the history
operation (https://www.hl7.org/fhir/http.html#history). Is the operation not yet implemented?
Hi there! I'm trying to use your library. Would really appreciate some examples for reading fhir resources from JSON files.
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
?
The ClientBuilder
requires the auth_callback
being passed to be Copy
. This makes it difficult to manage the credentials being used, as Copy
closures need to only contain Copy
references. If we have a client_id
and client_secret
as String
s, they cannot be owned by the function being passed. We also cannot use Arc
references to them, since Arc
also isn't Copy
. The possible workarounds seem to be either using 'static
references, or having to keep track of lifetimes, neither of which is ideal.
I would suggest changing the Copy
requirement to Clone
, as this would still allow usage of Copy
closures, but also allow having credentials owned by the auth_callback
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.