Package com.ibm.fhir.search.compartment
Class CompartmentUtil
- java.lang.Object
-
- com.ibm.fhir.search.compartment.CompartmentUtil
-
public class CompartmentUtil extends Object
The compartments are defined using FHIR R4 CompartmentDefinitions.
The R4 CompartmentDefintions and boundaries are defined at https://www.hl7.org/fhir/compartmentdefinition.html
CompartmentDefintion:- Patient - https://www.hl7.org/fhir/compartmentdefinition-patient.json
- Encounter - https://www.hl7.org/fhir/compartmentdefinition-encounter.json
- RelatedPerson - https://www.hl7.org/fhir/compartmentdefinition-relatedperson.json
- Practitioner - https://www.hl7.org/fhir/compartmentdefinition-practitioner.json
- Device - https://www.hl7.org/fhir/compartmentdefinition-device.json
Load the class in the classloader to initialize static members. Call this before using the class in order to avoid a slight performance hit on first use.
-
-
Field Summary
Fields Modifier and Type Field Description static StringFHIR_PATH_BUNDLE_ENTRYstatic StringFROM_STREAMstatic StringINVALID_COMPARTMENTstatic StringINVALID_COMPARTMENT_AND_RESOURCEstatic StringIO_EXCEPTIONstatic StringPARSE_EXCEPTIONstatic StringRESOURCE
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Map<String,CompartmentCache>buildCompartmentMap()Builds an in-memory model of the Compartment map defined in compartments.json, for supporting compartment based FHIR searches.static voidbuildCompositeBundle(PrintStream out)builds the bundle and the resources for the compartments.json and puts out to the output stream.static voidcheckValidCompartment(String compartment)checks that the compartment is valid, and throws and exception if, notstatic voidcheckValidCompartmentAndResource(String compartment, String resourceType)checks that the compartment and resource are valid, and throws and exception if, notstatic List<String>getCompartmentResourceTypeInclusionCriteria(String compartment, String resourceType)gets the compartment and resource type inclusion criteria.static List<String>getCompartmentResourceTypes(String compartment)gets the compartmentstatic voidinit()Loads the class in the classloader to initialize static members.
-
-
-
Field Detail
-
FHIR_PATH_BUNDLE_ENTRY
public static final String FHIR_PATH_BUNDLE_ENTRY
- See Also:
- Constant Field Values
-
RESOURCE
public static final String RESOURCE
- See Also:
- Constant Field Values
-
PARSE_EXCEPTION
public static final String PARSE_EXCEPTION
- See Also:
- Constant Field Values
-
IO_EXCEPTION
public static final String IO_EXCEPTION
- See Also:
- Constant Field Values
-
INVALID_COMPARTMENT
public static final String INVALID_COMPARTMENT
- See Also:
- Constant Field Values
-
INVALID_COMPARTMENT_AND_RESOURCE
public static final String INVALID_COMPARTMENT_AND_RESOURCE
- See Also:
- Constant Field Values
-
FROM_STREAM
public static final String FROM_STREAM
- See Also:
- Constant Field Values
-
-
Method Detail
-
init
public static void init()
Loads the class in the classloader to initialize static members. Call this before using the class in order to avoid a slight performance hit on first use.
-
buildCompartmentMap
public static final Map<String,CompartmentCache> buildCompartmentMap()
Builds an in-memory model of the Compartment map defined in compartments.json, for supporting compartment based FHIR searches.- Returns:
- a map of compartment caches
- Throws:
IOException
-
getCompartmentResourceTypes
public static List<String> getCompartmentResourceTypes(String compartment) throws FHIRSearchException
gets the compartment- Parameters:
compartment-- Returns:
- Throws:
FHIRSearchException
-
getCompartmentResourceTypeInclusionCriteria
public static List<String> getCompartmentResourceTypeInclusionCriteria(String compartment, String resourceType) throws FHIRSearchException
gets the compartment and resource type inclusion criteria.- Parameters:
compartment-resourceType-- Returns:
- Throws:
FHIRSearchException
-
checkValidCompartment
public static void checkValidCompartment(String compartment) throws FHIRSearchException
checks that the compartment is valid, and throws and exception if, not- Parameters:
compartment-- Throws:
FHIRSearchException
-
checkValidCompartmentAndResource
public static void checkValidCompartmentAndResource(String compartment, String resourceType) throws FHIRSearchException
checks that the compartment and resource are valid, and throws and exception if, not- Parameters:
compartment-- Throws:
FHIRSearchException
-
buildCompositeBundle
public static void buildCompositeBundle(PrintStream out) throws FHIRGeneratorException
builds the bundle and the resources for the compartments.json and puts out to the output stream.- Throws:
FHIRGeneratorException
-
-