Class ConceptUtil

java.lang.Object
com.ssgllc.fish.service.util.registered.ConceptUtil

@Component public final class ConceptUtil extends Object
  • Constructor Details

    • ConceptUtil

      public ConceptUtil()
  • Method Details

    • getConceptFromCode

      public static com.ssgllc.fish.service.dto.gen.ConceptDTO getConceptFromCode(String valueSetCode, String conceptCode)
      Retrieves a ConceptDTO based on its unique code within a specified value set.
      Parameters:
      valueSetCode - The code identifying the value set.
      conceptCode - The unique code of the concept within the value set.
      Returns:
      The ConceptDTO corresponding to the specified concept code within the value set.

      Groovy example:
      return conceptUtil.getConceptFromCode("FieldDataType", "STRING")

      Returns:
      { "code": "STRING", "display": "String" }

      SpEL example:
      #getConceptFromCode("FieldDataType", "STRING").display

      Returns:
      "String"
    • getConcepts

      public static Set<com.ssgllc.fish.service.dto.gen.ConceptDTO> getConcepts(String valueSetCode)
      Retrieves all ConceptDTO objects within a specified value set.
      Parameters:
      valueSetCode - The code identifying the value set.
      Returns:
      A set of all ConceptDTO objects within the specified value set.

      Groovy example:
      return conceptUtil.getConcepts("FieldDataType")

      Returns:
      [ { "code": "REFONEONE", "display": "Ref One One" }, { "code": "DATE", "display": "Date" }, ... ]

      SpEL example:
      #getConcepts("FieldDataType").![display]

      Returns:
      [ "Ref One One", "Date", "Any Blob", "Big Decimal", "Value Set Many", "Instant", "Ref One", "Long", "Blob", "Ref Many Many", "Text Blob", "Ref Many", "Value Set", "Image Blob", "Double", "Boolean", "Float", "Integer", "String" ]
    • getConceptsInGroup

      public static Set<com.ssgllc.fish.service.dto.gen.ConceptDTO> getConceptsInGroup(String valueSetCode, String group)
      Retrieves a set of ConceptDTO that belong to a specific group within a value set.
      Parameters:
      valueSetCode - The code identifying the value set.
      group - The name of the group within the value set to filter the concepts by.
      Returns:
      A set of ConceptDTO that are part of the specified group, or the original set if the group is null.

      Groovy example:
      return conceptUtil.getConceptsInGroup("FieldDataType", "Numeric")

      Returns:
      [ { "code": "BIGDECIMAL", "display": "Big Decimal" }, { "code": "DOUBLE", "display": "Double" }, { "code": "FLOAT", "display": "Float" }, { "code": "INTEGER", "display": "Integer" } ]

      SpEL example:
      #getConceptsInGroup("FieldDataType", "Numeric").![display]

      Returns:
      [ "Big Decimal", "Double", "Float", "Integer" ]
      Note: If either the 'group' is null or the 'valueSetCode' does not yield any concepts, the method returns the original set of concepts.
    • getConceptRefFromCode

      public static com.ssgllc.fish.domain.gen.Concept getConceptRefFromCode(String valueSetCode, String conceptCode)
      Retrieves a Concept reference based on its unique code within a specified value set.
      Parameters:
      valueSetCode - The code identifying the value set.
      conceptCode - The unique code of the concept within the value set.
      Returns:
      The Concept reference corresponding to the specified concept code within the value set.

      Groovy example:
      return conceptUtil.getConceptRefFromCode("FieldDataType", "STRING")

      Returns:
      { "code": "STRING", "display": "String" }

      SpEL example:
      #getConceptRefFromCode("FieldDataType", "STRING").display

      Returns:
      "String"
    • getInitializedConceptFromCode

      public static com.ssgllc.fish.domain.gen.Concept getInitializedConceptFromCode(String valueSetCode, String conceptCode)
      Retrieves an initialized Concept based on its unique code within a specified value set.
      Parameters:
      valueSetCode - The code identifying the value set.
      conceptCode - The unique code of the concept within the value set.
      Returns:
      The initialized Concept corresponding to the specified concept code within the value set.

      Groovy example:
      return conceptUtil.getInitializedConceptFromCode("FieldDataType", "STRING")

      Returns:
      { "code": "STRING", "display": "String" }

      SpEL example:
      #getInitializedConceptFromCode("FieldDataType", "STRING").display

      Returns:
      "String"
    • getConceptFromId

      public static com.ssgllc.fish.service.dto.gen.ConceptDTO getConceptFromId(String valueSetCode, String conceptId)
      Retrieves a ConceptDTO based on its unique identifier within a specified value set.
      Parameters:
      valueSetCode - The code identifying the value set.
      conceptId - The unique identifier of the concept within the value set.
      Returns:
      The ConceptDTO corresponding to the specified concept identifier within the value set.

      Groovy example:
      return conceptUtil.getConceptFromId("FieldDataType", "0ace438c-7b0f-1fac-8190-267e32390074")

      Returns:
      { "code": "STRING", "display": "String" }

      SpEL example:
      #getConceptFromId("FieldDataType", "0ace438c-7b0f-1fac-8190-267e32390074").display

      Returns:
      "String"
    • getConceptFromIdOnly

      public static com.ssgllc.fish.service.dto.gen.ConceptDTO getConceptFromIdOnly(String conceptId)
      Retrieves a ConceptDTO based on its unique identifier, without specifying a value set.
      Parameters:
      conceptId - The unique identifier of the concept.
      Returns:
      The ConceptDTO corresponding to the specified concept identifier.

      Groovy example:
      return conceptUtil.getConceptFromIdOnly("0ace438c-7b0f-1fac-8190-267e32390074")

      Returns:
      { "code": "STRING", "display": "String" }

      SpEL example:
      #getConceptFromIdOnly("0ace438c-7b0f-1fac-8190-267e32390074").display

      Returns:
      "String"
    • getConceptFromDisplay

      public static com.ssgllc.fish.service.dto.gen.ConceptDTO getConceptFromDisplay(String valueSetCode, String conceptDisplay)
      Retrieves a ConceptDTO based on its display value within a specified value set.
      Parameters:
      valueSetCode - The code identifying the value set.
      conceptDisplay - The display value of the concept within the value set.
      Returns:
      The ConceptDTO corresponding to the specified display value within the value set.

      Groovy example:
      return conceptUtil.getConceptFromDisplay("FieldDataType", "String")

      Returns:
      { "code": "STRING", "display": "String" }

      SpEL example:
      #getConceptFromDisplay("FieldDataType", "String").code

      Returns:
      "STRING"
    • getValueSetIdFromCodeOnly

      public static String getValueSetIdFromCodeOnly(String valueSetCode)
      Retrieves the unique identifier of a value set based on its code.
      Parameters:
      valueSetCode - The code identifying the value set.
      Returns:
      The unique identifier of the value set corresponding to the specified code.

      Groovy example:
      return conceptUtil.getValueSetIdFromCodeOnly("FieldDataType")

      Returns:
      "0ace438c-7b0f-1fac-8190-267e3236005e"

      SpEL example:
      #getValueSetIdFromCodeOnly("FieldDataType")

      Returns:
      "0ace438c-7b0f-1fac-8190-267e3236005e"
    • getConceptIdFromCode

      public static String getConceptIdFromCode(String valueSetCode, String conceptCode)
      Retrieves the unique identifier of a concept based on its unique code within a specified value set.
      Parameters:
      valueSetCode - The code identifying the value set.
      conceptCode - The unique code of the concept within the value set.
      Returns:
      The unique identifier of the concept corresponding to the specified concept code within the value set.

      Groovy example:
      return conceptUtil.getConceptIdFromCode("FieldDataType", "STRING")

      Returns:
      "0ace438c-7b0f-1fac-8190-267e32390074"

      SpEL example:
      #getConceptIdFromCode("FieldDataType", "STRING")

      Returns:
      "0ace438c-7b0f-1fac-8190-267e32390074"
    • getConceptIdFromId

      public static String getConceptIdFromId(String valueSetId, String conceptCode)
      Retrieves the unique identifier of a concept based on its unique code within a specified value set identifier.
      Parameters:
      valueSetId - The unique identifier of the value set.
      conceptCode - The unique code of the concept within the value set.
      Returns:
      The unique identifier of the concept corresponding to the specified concept code within the value set identifier.

      Groovy example:
      return conceptUtil.getConceptIdFromId("0ace438c-7b0f-1fac-8190-267e3236005e", "STRING")

      Returns:
      "0ace438c-7b0f-1fac-8190-267e32390074"

      SpEL example:
      #getConceptIdFromId("0ace438c-7b0f-1fac-8190-267e3236005e", "STRING")

      Returns:
      "0ace438c-7b0f-1fac-8190-267e32390074"
    • getConceptIdFromDisplay

      public static String getConceptIdFromDisplay(String valueSetCode, String conceptDisplay)
      Retrieves the unique identifier of a concept based on its display value within a specified value set.
      Parameters:
      valueSetCode - The code identifying the value set.
      conceptDisplay - The display value of the concept within the value set.
      Returns:
      The unique identifier of the concept corresponding to the specified display value within the value set.

      Groovy example:
      return conceptUtil.getConceptIdFromDisplay("FieldDataType", "String")

      Returns:
      "0ace438c-7b0f-1fac-8190-267e32390074"

      SpEL example:
      #getConceptIdFromDisplay("FieldDataType", "String")

      Returns:
      "0ace438c-7b0f-1fac-8190-267e32390074"
    • getConceptCodeFromDisplay

      public static String getConceptCodeFromDisplay(String valueSetCode, String conceptDisplay)
      Retrieves the unique code of a concept based on its display value within a specified value set.
      Parameters:
      valueSetCode - The code identifying the value set.
      conceptDisplay - The display value of the concept within the value set.
      Returns:
      The unique code of the concept corresponding to the specified display value within the value set.

      Groovy example:
      return conceptUtil.getConceptCodeFromDisplay("FieldDataType", "String")

      Returns:
      "STRING"

      SpEL example:
      #getConceptCodeFromDisplay("FieldDataType", "String")

      Returns:
      "STRING"
    • getConceptCodeFromDescription

      public static String getConceptCodeFromDescription(String valueSetCode, String conceptDescription)
      Retrieves the unique code of a concept based on its description within a specified value set.
      Parameters:
      valueSetCode - The code identifying the value set.
      conceptDescription - The description of the concept within the value set.
      Returns:
      The unique code of the concept corresponding to the specified description within the value set.

      Groovy example:
      return conceptUtil.getConceptCodeFromDescription("FieldDataType", "String data type")

      Returns:
      "STRING"

      SpEL example:
      #getConceptCodeFromDescription("FieldDataType", "String data type")

      Returns:
      "STRING"
    • getConceptCodeFromId

      public static String getConceptCodeFromId(String valueSetCode, String conceptId)
      Retrieves the unique code of a concept based on its unique identifier within a specified value set.
      Parameters:
      valueSetCode - The code identifying the value set.
      conceptId - The unique identifier of the concept within the value set.
      Returns:
      The unique code of the concept corresponding to the specified concept identifier within the value set.

      Groovy example:
      return conceptUtil.getConceptCodeFromId("FieldDataType", "0ace438c-7b0f-1fac-8190-267e32390074")

      Returns:
      "STRING"

      SpEL example:
      #getConceptCodeFromId("FieldDataType", "0ace438c-7b0f-1fac-8190-267e32390074")

      Returns:
      "STRING"
    • getConceptCodeFromIdOnly

      public static String getConceptCodeFromIdOnly(String conceptId)
      Retrieves the unique code of a concept based on its unique identifier, without specifying a value set.
      Parameters:
      conceptId - The unique identifier of the concept.
      Returns:
      The unique code of the concept corresponding to the specified concept identifier.

      Groovy example:
      return conceptUtil.getConceptCodeFromIdOnly("0ace438c-7b0f-1fac-8190-267e32390074")

      Returns:
      "STRING"

      SpEL example:
      #getConceptCodeFromIdOnly("0ace438c-7b0f-1fac-8190-267e32390074")

      Returns:
      "STRING"
    • getConceptDisplayFromId

      public static String getConceptDisplayFromId(String valueSetCode, String conceptId)
      Retrieves the display value of a concept based on its unique identifier within a specified value set.
      Parameters:
      valueSetCode - The code identifying the value set.
      conceptId - The unique identifier of the concept within the value set.
      Returns:
      The display value of the concept corresponding to the specified concept identifier within the value set.

      Groovy example:
      return conceptUtil.getConceptDisplayFromId("FieldDataType", "0ace438c-7b0f-1fac-8190-267e32390074")

      Returns:
      "String"

      SpEL example:
      #getConceptDisplayFromId("FieldDataType", "0ace438c-7b0f-1fac-8190-267e32390074")

      Returns:
      "String"
    • getConceptDisplayFromCode

      public static String getConceptDisplayFromCode(String valueSetCode, String conceptCode)
      Retrieves the display value of a concept based on its unique code within a specified value set.
      Parameters:
      valueSetCode - The code identifying the value set.
      conceptCode - The unique code of the concept within the value set.
      Returns:
      The display value of the concept corresponding to the specified concept code within the value set, or null if not found.

      Groovy example:
      return conceptUtil.getConceptDisplayFromCode("FieldDataType", "STRING")

      Returns:
      "String"

      SpEL example:
      #getConceptDisplayFromCode("FieldDataType", "STRING")

      Returns:
      "String"
    • mapConceptCode

      public static String mapConceptCode(String fromValueSetCode, String inputCode)
      Maps a concept code from a specified value set to its display value, or returns the input code if the mapping is not found.
      Parameters:
      fromValueSetCode - The code identifying the value set from which to map the concept code.
      inputCode - The input concept code to be mapped.
      Returns:
      The display value of the concept if found, otherwise the input code. If the display value is "<BLANK>", an empty string is returned.

      Groovy example:
      return conceptUtil.mapConceptCode("FieldDataType", "STRING")

      Returns:
      "String"

      SpEL example:
      #mapConceptCode("FieldDataType", "STRING")

      Returns:
      "String"
    • mapConceptCodeNull

      public static String mapConceptCodeNull(String fromValueSetCode, String inputCode)
      Maps a concept code from a specified value set to its display value, or returns null if the mapping is not found.
      Parameters:
      fromValueSetCode - The code identifying the value set from which to map the concept code.
      inputCode - The input concept code to be mapped.
      Returns:
      The display value of the concept if found, otherwise null. If the display value is "<BLANK>", an empty string is returned.

      Groovy example:
      return conceptUtil.mapConceptCodeNull("FieldDataType", "STRING")

      Returns:
      "String"

      SpEL example:
      #mapConceptCodeNull("FieldDataType", "STRING")

      Returns:
      "String"
    • getConceptDisplayFromIdOnly

      public static String getConceptDisplayFromIdOnly(String conceptId)
      Retrieves the display value of a concept based on its unique identifier, without specifying a value set.
      Parameters:
      conceptId - The unique identifier of the concept.
      Returns:
      The display value of the concept corresponding to the specified concept identifier.

      Groovy example:
      return conceptUtil.getConceptDisplayFromIdOnly("0ace438c-7b0f-1fac-8190-267e32390074")

      Returns:
      "String"

      SpEL example:
      #getConceptDisplayFromIdOnly("0ace438c-7b0f-1fac-8190-267e32390074")

      Returns:
      "String"
    • getConceptDescriptionFromId

      public static String getConceptDescriptionFromId(String valueSetCode, String conceptId)
      Retrieves the description of a concept based on its unique identifier within a specified value set.
      Parameters:
      valueSetCode - The code identifying the value set.
      conceptId - The unique identifier of the concept within the value set.
      Returns:
      The description of the concept corresponding to the specified concept identifier within the value set.

      Groovy example:
      return conceptUtil.getConceptDescriptionFromId("FieldDataType", "0ace438c-7b0f-1fac-8190-267e32390074")

      Returns:
      "This is a description."

      SpEL example:
      #getConceptDescriptionFromId("FieldDataType", "0ace438c-7b0f-1fac-8190-267e32390074")

      Returns:
      "This is a description."
    • containsCodes

      public static boolean containsCodes(List<String> ids, String conceptCode)
      Checks if a list of concept identifiers contains a specific concept code.
      Parameters:
      ids - A list of concept identifiers.
      conceptCode - The concept code to be checked.
      Returns:
      true if the list contains the specified concept code, otherwise false.

      Groovy example:
      return conceptUtil.containsCodes(["0ace438c-7b0f-1fac-8190-267e32390074"], "STRING")

      Returns:
      true

      SpEL example:
      #containsCodes({"0ace438c-7b0f-1fac-8190-267e32390074"}, "STRING")

      Returns:
      true
    • isValidConcept

      public static boolean isValidConcept(String conceptId, String valueSetCode)
      Checks if a concept is valid within a specified value set based on its unique identifier.
      Parameters:
      conceptId - The unique identifier of the concept.
      valueSetCode - The code identifying the value set.
      Returns:
      true if the concept is valid within the specified value set, otherwise false.

      Groovy example:
      return conceptUtil.isValidConcept("0ace438c-7b0f-1fac-8190-267e32390074", "FieldDataType")

      Returns:
      true

      SpEL example:
      #isValidConcept("0ace438c-7b0f-1fac-8190-267e32390074", "FieldDataType")

      Returns:
      true
    • isConceptInGroup

      public static boolean isConceptInGroup(String valueSetCode, String conceptId, String group)
      Checks if a concept belongs to a specific group within a value set based on its unique identifier.
      Parameters:
      valueSetCode - The code identifying the value set.
      conceptId - The unique identifier of the concept within the value set.
      group - The name of the group to check.
      Returns:
      true if the concept belongs to the specified group, otherwise false.

      Groovy example:
      return conceptUtil.isConceptInGroup("FieldDataType", "0ace438c-7b0f-1fac-8190-267e32390074", "Numeric")

      Returns:
      false

      SpEL example:
      #isConceptInGroup("FieldDataType", "0ace438c-7b0f-1fac-8190-267e32390074", "Numeric")

      Returns:
      false
    • isConceptInGroupFromCode

      public static boolean isConceptInGroupFromCode(String valueSetCode, String conceptCode, String group)
      Checks if a concept belongs to a specific group within a value set based on its unique code.
      Parameters:
      valueSetCode - The code identifying the value set.
      conceptCode - The unique code of the concept within the value set.
      group - The name of the group to check.
      Returns:
      true if the concept belongs to the specified group, otherwise false.

      Groovy example:
      return conceptUtil.isConceptInGroupFromCode("FieldDataType", "STRING", "Numeric")

      Returns:
      false

      SpEL example:
      #isConceptInGroupFromCode("FieldDataType", "STRING", "Numeric")

      Returns:
      false
    • isValidConceptFromCode

      public static boolean isValidConceptFromCode(String valueSetCode, String conceptCode)
      Checks if a concept is valid within a specified value set based on its unique code.
      Parameters:
      valueSetCode - The code identifying the value set.
      conceptCode - The unique code of the concept within the value set.
      Returns:
      true if the concept is valid within the specified value set, otherwise false.

      Groovy example:
      return conceptUtil.isValidConceptFromCode("FieldDataType", "STRING")

      Returns:
      true

      SpEL example:
      #isValidConceptFromCode("FieldDataType", "STRING")

      Returns:
      true
    • isValidConceptFromDisplay

      public static boolean isValidConceptFromDisplay(String valueSetCode, String conceptDisplay)
      Checks if a concept is valid within a specified value set based on its display value.
      Parameters:
      valueSetCode - The code identifying the value set.
      conceptDisplay - The display value of the concept within the value set.
      Returns:
      true if the concept is valid within the specified value set, otherwise false.

      Groovy example:
      return conceptUtil.isValidConceptFromDisplay("FieldDataType", "String")

      Returns:
      true

      SpEL example:
      #isValidConceptFromDisplay("FieldDataType", "String")

      Returns:
      true
    • getConcatDisplayValues

      public static String getConcatDisplayValues(String valueSetCode, Collection<String> conceptIds)
      Concatenates the display values of concepts within a specified value set based on a collection of their unique identifiers.
      Parameters:
      valueSetCode - The code identifying the value set.
      conceptIds - A collection of unique identifiers of the concepts.
      Returns:
      A string of concatenated display values, sorted and separated by commas. Returns an empty string if the value set code or collection of concept IDs is empty.

      Groovy example:
      return conceptUtil.getConcatDisplayValues("FieldDataType", ["0ace438c-7b0f-1fac-8190-267e32390074", "0ace438c-7b0f-1fac-8190-267e32390073"])

      Returns:
      "Integer,String"

      SpEL example:
      #getConcatDisplayValues("FieldDataType", {"0ace438c-7b0f-1fac-8190-267e32390074", "0ace438c-7b0f-1fac-8190-267e32390073"})

      Returns:
      "Integer,String"
    • valuesetIsLoaded

      public static boolean valuesetIsLoaded(String valueSetCode)
      Checks if a value set is loaded based on its unique code.
      Parameters:
      valueSetCode - The code identifying the value set.
      Returns:
      true if the value set is loaded, otherwise false.

      Groovy example:
      return conceptUtil.valuesetIsLoaded("FieldDataType")

      Returns:
      true

      SpEL example:
      #valuesetIsLoaded("FieldDataType")

      Returns:
      true