Code Monkey home page Code Monkey logo

fhir-rs's Introduction

fhir-rs

About

FHIR-RS library is an implementation of HL7 FHIR Specification for Rust.

Read this in other languages:

Versioning

This is still a draft version. The functionality is not yet fully developed and the performance has not been optimized, making it unsuitable for production environments.

Usage

Healthcare Interoperability.

Parse

use fhir_rs::prelude::*;

fn main() -> Result<()> {

    let complex_extension = Extension::with_url("http://yeyanbo.cn")
        .add_extension(Extension::new("abc", Any::Coding(Coding::default().set_code("cc"))))
        .add_extension(Extension::new("xcv", Any::Coding(Coding::default().set_code("bb"))));

    let patient = Patient::default()
        .set_id("example")
        .set_meta(Meta::default()
            .set_version_id("v1")
            .set_last_updated(InstantDt::from_str("2001-10-10T10:10:12Z")?))
        .add_extension(Extension::new("dd", Any::String(StringDt::new("ddf"))))
        .add_extension(complex_extension)
        .add_name(HumanName::default().set_text("Mike"))
        .add_telecom(ContactPoint::default().set_value("1234567890"));

    test_xml_serialize(&patient)?;
    test_json_serialize(&patient)?;
    Ok(())
}

fn test_json_serialize(patient: &Patient) -> Result<()> {
    let str = to_json_pretty(patient)?;
    info!("Patient Formatter: {}", str);
    Ok(())
}

fn test_xml_serialize(patient: &Patient) -> Result<()> {
    let str = to_xml_pretty(patient)?;
    info!("Patient Formatter: {}", str);
    Ok(())
}

Fhirpath

At present, the framework for FHIRPath syntax parsing has been completed, but the function support is limited and only a few function methods are supported:

  • empty()
  • exists()

operator:

  • and
  • =

Validate

use fhir_rs::prelude::*;

fn main() -> Result<()> {
    let encounter_str = include_str!("encounter_example_02.xml");
    let encounter: Encounter = from_xml(encounter_str)?;

    let profile_str = include_str!("profile-core-outpatient-encounter.xml");
    let profile: StructureDefinition = from_xml(profile_str)?;

    let mut validator = Validator::new(profile);
    let outcome = validator.validate(&encounter)?;

    println!("Validate Outcome: {:#?}", &outcome);
    Ok(())
}

Complete examples

  • Transform
  • FhirPath
  • Validate

Done

  • datatype
  • resource
  • from json to resource
  • from xml to resource
  • from resource to json
  • from resource to xml
  • fhirpath
  • validator

Todo

  • fhir client
  • fhir server

License

CC0

fhir-rs's People

Contributors

yeyanbo avatar

Stargazers

Anthony Master avatar da2n avatar

Watchers

 avatar Anthony Master avatar

Forkers

engk0ng

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.