paint-brush
This Library Translates Confusing FHIR Dosage Data Into Actual Human Wordsby@hacker3101625

This Library Translates Confusing FHIR Dosage Data Into Actual Human Words

by February 11th, 2025
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

Turn HAPI FHIR Dosage into human readable text in your desired language and much more.
featured image - This Library Translates Confusing FHIR Dosage Data Into Actual Human Words
undefined HackerNoon profile picture
0-item


TD;LR

import io.github.jy95.fds.common.types.DisplayOrder;
import io.github.jy95.fds.r4.DosageAPIR4;
import io.github.jy95.fds.r4.config.FDSConfigR4;
import org.hl7.fhir.r4.model.Dosage;
import java.util.List;

public class Main {
    public static void main(String[] args) {
        // Create a configuration to be used by the library
        FDSConfigR4 configR4 = FDSConfigR4
                .builder()
                .build();

        // Create the library with that configuration
        DosageAPIR4 lib = new DosageAPIR4(configR4);
        
        // TODO Your HAPI FHIR Dosage instance you would like to deal with ;)
        Dosage dosage = new Dosage();

        // Converts the dosage object into human-readable text
        String asText = lib.asHumanReadableText(dosage).get();

        // Extract specific existing field(s) to meet your requirements
        String singleField = lib.getFields(dosage, DisplayOrder.DOSE_QUANTITY).get();
        String multipleFields = lib.getFields(dosage, DisplayOrder.TEXT, DisplayOrder.PATIENT_INSTRUCTION).get();
        
        // Converts the dosage object into human-readable text
        String multipleAsText = lib.asHumanReadableText(List.of(dosage)).get();
        
        // And much more ...
    }
}


Key Features:

  • Compatible: Works with Dosage R4 and Dosage R5
  • Extensible – Easily adaptable to your needs
  • Internationalized – ICU4J for multilingual support
  • Easy Integration – Works across server, client, and more


Why Use This ?

This library is built with flexibility in mind, ensuring that developers can seamlessly work with different FHIR dosage structures without compatibility concerns. Whether you're dealing with R4 or R5, the design ensures a smooth experience without requiring major modifications.


The extensibility aspect makes it an excellent choice for projects that need customization. If your use case requires additional dosage-related logic or specific domain-based adaptations, you can easily extend its capabilities without breaking existing functionality.


For teams working on multilingual applications, internationalization is a critical factor. Thanks to ICU4J, this library ensures robust language support, making it easier to integrate into healthcare systems across different regions without manual localization efforts.


Integration is another key advantage. Whether your system runs on a server-side backend, a client-side web application, or even a hybrid environment, this library is designed to work effortlessly. It adheres to best practices, allowing for quick adoption in different architectural setups.


For more details, visit the official project site or explore the GitHub repository.

🔗 More Info: Project Site | GitHub