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:
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