
Package org.hl7.fhir.r5.conformance
Class ProfileUtilities
java.lang.Object
org.hl7.fhir.utilities.TranslatingUtilities
org.hl7.fhir.r5.utils.TranslatingUtilities
org.hl7.fhir.r5.conformance.ProfileUtilities
This class provides a set of utility operations for working with Profiles.
Key functionality:
* getChildMap --?
* getChildList
* generateSnapshot: Given a base (snapshot) profile structure, and a differential profile, generate a new snapshot profile
* closeDifferential: fill out a differential by excluding anything not mentioned
* generateExtensionsTable: generate the HTML for a hierarchical table presentation of the extensions
* generateTable: generate the HTML for a hierarchical table presentation of a structure
* generateSpanningTable: generate the HTML for a table presentation of a network of structures, starting at a nominated point
* summarize: describe the contents of a profile
note to maintainers: Do not make modifications to the snapshot generation without first changing the snapshot generation test cases to demonstrate the grounds for your change
- Author:
- Grahame
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclass
static class
static class
static class
class
class
class
static interface
class
static class
class
class
static class
Nested classes/interfaces inherited from class org.hl7.fhir.r5.utils.TranslatingUtilities
TranslatingUtilities.TranslationServices
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionProfileUtilities
(IWorkerContext context, List<org.hl7.fhir.utilities.validation.ValidationMessage> messages, ProfileUtilities.ProfileKnowledgeProvider pkp) ProfileUtilities
(IWorkerContext context, List<org.hl7.fhir.utilities.validation.ValidationMessage> messages, ProfileUtilities.ProfileKnowledgeProvider pkp, FHIRPathEngine fpe) -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
allProfilesMustSupport
(List<CanonicalType> profiles) static boolean
static String
void
void
checkForChildrenInGroup
(StructureDefinition derived, List<ElementDefinition> toRemove, ElementDefinition element) void
checkTypeDerivation
(String purl, StructureDefinition srcSD, ElementDefinition base, ElementDefinition derived, ElementDefinition.TypeRefComponent ts) void
checkTypeOk
(ElementDefinition dest, String ft, StructureDefinition sd, String fieldName) void
void
closeDifferential
(StructureDefinition base, StructureDefinition derived) static String
static String
determineFixedType
(List<ElementDefinition> diffMatches, String fixedType, int i) findConstraint
(StructureDefinition sd, String inv) static String
formatTypeSpecifiers
(IWorkerContext context, ElementDefinition d) List<org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Cell>
genElementCells
(org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator gen, ElementDefinition element, String profileBaseFileName, boolean snapshot, String corePath, String imagePath, boolean root, boolean logicalModel, boolean allInvariants, StructureDefinition profile, org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Row typesRow, org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Row row, boolean hasDef, boolean ext, ProfileUtilities.UnusedTracker used, String ref, String sName, org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Cell nameCell, boolean mustSupport, boolean allowSubRows, RenderingContext rc) org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Cell
genElementNameCell
(org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator gen, ElementDefinition element, String profileBaseFileName, boolean snapshot, String corePath, String imagePath, boolean root, boolean logicalModel, boolean allInvariants, StructureDefinition profile, org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Row typesRow, org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Row row, boolean hasDef, boolean ext, ProfileUtilities.UnusedTracker used, String ref, String sName, List<ElementDefinition> elements) void
generateCsvs
(OutputStream dest, StructureDefinition structure, boolean asXml) generateExamples
(StructureDefinition sd, boolean evenWhenNoExamples) org.hl7.fhir.utilities.xhtml.XhtmlNode
generateExtensionTable
(String defFile, StructureDefinition ed, String imageFolder, boolean inlineGraphics, boolean full, String corePath, String imagePath, Set<String> outputTracker, RenderingContext rc) org.hl7.fhir.utilities.xhtml.XhtmlNode
generateGrid
(String defFile, StructureDefinition profile, String imageFolder, boolean inlineGraphics, String profileBaseFileName, String corePath, String imagePath, Set<String> outputTracker) void
generateSchematrons
(OutputStream dest, StructureDefinition structure) void
generateSnapshot
(StructureDefinition base, StructureDefinition derived, String url, String webUrl, String profileName) Given a base (snapshot) profile structure, and a differential profile, generate a new snapshot profileorg.hl7.fhir.utilities.xhtml.XhtmlNode
generateSpanningTable
(StructureDefinition profile, String imageFolder, boolean onlyConstraints, String constraintPrefix, Set<String> outputTracker) org.hl7.fhir.utilities.xhtml.XhtmlNode
generateTable
(String defFile, StructureDefinition profile, boolean diff, String imageFolder, boolean inlineGraphics, String profileBaseFileName, boolean snapshot, String corePath, String imagePath, boolean logicalModel, boolean allInvariants, Set<String> outputTracker, boolean mustSupport, RenderingContext rc) org.hl7.fhir.utilities.xhtml.XhtmlNode
generateTable
(String defFile, StructureDefinition profile, boolean diff, String imageFolder, boolean inlineGraphics, String profileBaseFileName, boolean snapshot, String corePath, String imagePath, boolean logicalModel, boolean allInvariants, Set<String> outputTracker, boolean mustSupport, RenderingContext rc, String anchorPrefix) void
genTargetLink
(org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator gen, String profileBaseFileName, String corePath, org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Cell c, ElementDefinition.TypeRefComponent t, String u, Resource src) getChildList
(StructureDefinition profile, String path, String id) Given a Structure, navigate to the element given by the path and return the direct children of that elementgetChildList
(StructureDefinition profile, String path, String id, boolean diff) getChildList
(StructureDefinition profile, String path, String id, boolean diff, boolean refs) getChildList
(StructureDefinition structure, ElementDefinition element) getChildList
(StructureDefinition structure, ElementDefinition element, boolean diff) getChildList
(StructureDefinition structure, ElementDefinition element, boolean diff, boolean refs) getChildMap
(StructureDefinition profile, ElementDefinition element) getComparer
(ProfileUtilities.ElementDefinitionComparer cmp, ProfileUtilities.ElementDefinitionHolder child) getProfile
(StructureDefinition source, String url) getRowColor
(ElementDefinition element, boolean isConstraintMode) getSliceList
(StructureDefinition profile, ElementDefinition element) org.hl7.fhir.utilities.validation.ValidationOptions
getTypeForElement
(StructureDefinition.StructureDefinitionDifferentialComponent differential, int diffCursor, String profileName, List<ElementDefinition> diffMatches, ElementDefinition outcome, String webUrl, Resource srcSD) getXver()
static String
org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.TableModel
initSpanningTable
(org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator gen, String prefix, boolean isLogical, String id) interpretR2Discriminator
(String discriminator, boolean isExists) boolean
boolean
isDebug()
boolean
isIgmode()
static boolean
isLikelySourceURLReference
(String url, List<String> resourceNames, Set<String> baseFilenames, Set<String> localFilenames) static boolean
isMustSupport
(List<CanonicalType> profiles) static boolean
isMustSupport
(CanonicalType profile) static boolean
static boolean
boolean
boolean
isPrimitive
(String value) boolean
isSameBase
(String p, String sp) static boolean
issLocalFileName
(String url, Set<String> localFilenames) boolean
boolean
static StructureDefinition
makeBaseDefinition
(String fhirVersion) static StructureDefinition
makeBaseDefinition
(Enumerations.FHIRVersion fhirVersion) static StructureDefinition
makeExtensionForVersionedURL
(IWorkerContext context, String url) void
static String
processRelativeUrls
(String markdown, String webUrl, String basePath, List<String> resourceNames, Set<String> baseFilenames, Set<String> localFilenames, boolean processRelatives) readChoices
(ElementDefinition ed, List<ElementDefinition> children) resolveContentRef
(StructureDefinition structure, ElementDefinition element) static String
setAutoFixSliceNames
(boolean autoFixSliceNames) void
setDebug
(boolean debug) void
setDefWebRoot
(String defWebRoot) void
setIds
(StructureDefinition sd, boolean checkFirst) void
setIgmode
(boolean igmode) void
setMasterSourceFileNames
(Set<String> masterSourceFileNames) setNewSlicingProcessing
(boolean newSlicingProcessing) void
setTerminologyServiceOptions
(org.hl7.fhir.utilities.validation.ValidationOptions terminologyServiceOptions) void
setThrowException
(boolean exception) void
setWantFixDifferentialFirstElementType
(boolean wantFixDifferentialFirstElementType) setXver
(XVerExtensionManager xver) void
sortDifferential
(StructureDefinition base, StructureDefinition diff, String name, List<String> errors, boolean errorIfChanges) static String
static String
void
updateMaps
(StructureDefinition base, StructureDefinition derived) updateURLs
(String url, String webUrl, ElementDefinition element) Finds internal references in an Element's Binding and StructureDefinition references (in TypeRef) and bases them on the given urlMethods inherited from class org.hl7.fhir.r5.utils.TranslatingUtilities
egt, gt
Methods inherited from class org.hl7.fhir.utilities.TranslatingUtilities
getTranslator, hasTranslator, setTranslator, toStr, toStr, translate, translate
-
Field Details
-
CONSTRAINT_STYLE
- See Also:
-
STATUS_OK
- See Also:
-
STATUS_HINT
- See Also:
-
STATUS_WARNING
- See Also:
-
STATUS_ERROR
- See Also:
-
STATUS_FATAL
- See Also:
-
BASE_MODEL
- See Also:
-
BASE_PATH
- See Also:
-
DERIVATION_EQUALS
- See Also:
-
DERIVATION_POINTER
- See Also:
-
IS_DERIVED
- See Also:
-
UD_ERROR_STATUS
- See Also:
-
CONSTRAINT_CHAR
- See Also:
-
-
Constructor Details
-
ProfileUtilities
public ProfileUtilities(IWorkerContext context, List<org.hl7.fhir.utilities.validation.ValidationMessage> messages, ProfileUtilities.ProfileKnowledgeProvider pkp, FHIRPathEngine fpe) -
ProfileUtilities
public ProfileUtilities(IWorkerContext context, List<org.hl7.fhir.utilities.validation.ValidationMessage> messages, ProfileUtilities.ProfileKnowledgeProvider pkp)
-
-
Method Details
-
isIgmode
-
setIgmode
-
isWantFixDifferentialFirstElementType
-
setWantFixDifferentialFirstElementType
-
isAutoFixSliceNames
-
setAutoFixSliceNames
-
getChildMap
public ProfileUtilities.SourcedChildDefinitions getChildMap(StructureDefinition profile, ElementDefinition element) throws org.hl7.fhir.exceptions.DefinitionException - Throws:
org.hl7.fhir.exceptions.DefinitionException
-
getSliceList
public List<ElementDefinition> getSliceList(StructureDefinition profile, ElementDefinition element) throws org.hl7.fhir.exceptions.DefinitionException - Throws:
org.hl7.fhir.exceptions.DefinitionException
-
getChildList
Given a Structure, navigate to the element given by the path and return the direct children of that element- Parameters:
profile
- The structure to navigate intopath
- The path of the element within the structure to get the children for- Returns:
- A List containing the element children (all of them are Elements)
-
getChildList
public List<ElementDefinition> getChildList(StructureDefinition profile, String path, String id, boolean diff) -
getChildList
public List<ElementDefinition> getChildList(StructureDefinition profile, String path, String id, boolean diff, boolean refs) -
getChildList
public List<ElementDefinition> getChildList(StructureDefinition structure, ElementDefinition element, boolean diff, boolean refs) -
getChildList
public List<ElementDefinition> getChildList(StructureDefinition structure, ElementDefinition element, boolean diff) -
getChildList
public List<ElementDefinition> getChildList(StructureDefinition structure, ElementDefinition element) -
updateMaps
public void updateMaps(StructureDefinition base, StructureDefinition derived) throws org.hl7.fhir.exceptions.DefinitionException - Throws:
org.hl7.fhir.exceptions.DefinitionException
-
generateSnapshot
public void generateSnapshot(StructureDefinition base, StructureDefinition derived, String url, String webUrl, String profileName) throws org.hl7.fhir.exceptions.DefinitionException, org.hl7.fhir.exceptions.FHIRException Given a base (snapshot) profile structure, and a differential profile, generate a new snapshot profile- Parameters:
base
- - the base structure on which the differential will be appliedderived
- - the differential to apply to the baseurl
- - where the base has relative urls for profile references, these need to be converted to absolutes by prepending this URL (e.g. the canonical URL)webUrl
- - where the base has relative urls in markdown, these need to be converted to absolutes by prepending this URL (this is not the same as the canonical URL)- Throws:
org.hl7.fhir.exceptions.FHIRException
org.hl7.fhir.exceptions.DefinitionException
Exception
-
checkDifferentialBaseType
- Throws:
Error
-
checkForChildrenInGroup
public void checkForChildrenInGroup(StructureDefinition derived, List<ElementDefinition> toRemove, ElementDefinition element) throws Error - Throws:
Error
-
getTypeForElement
public StructureDefinition getTypeForElement(StructureDefinition.StructureDefinitionDifferentialComponent differential, int diffCursor, String profileName, List<ElementDefinition> diffMatches, ElementDefinition outcome, String webUrl, Resource srcSD) -
determineFixedType
-
summarizeSlicing
-
typeCode
-
updateURLs
Finds internal references in an Element's Binding and StructureDefinition references (in TypeRef) and bases them on the given url- Parameters:
url
- - the base url to use to turn internal references into absolute referenceselement
- - the Element to update- Returns:
- - the updated Element
-
processRelativeUrls
-
issLocalFileName
-
isLikelySourceURLReference
-
isSameBase
-
checkTypeDerivation
public void checkTypeDerivation(String purl, StructureDefinition srcSD, ElementDefinition base, ElementDefinition derived, ElementDefinition.TypeRefComponent ts) -
checkTypeOk
public void checkTypeOk(ElementDefinition dest, String ft, StructureDefinition sd, String fieldName) -
closeDifferential
public void closeDifferential(StructureDefinition base, StructureDefinition derived) throws org.hl7.fhir.exceptions.FHIRException - Throws:
org.hl7.fhir.exceptions.FHIRException
-
generateExtensionTable
public org.hl7.fhir.utilities.xhtml.XhtmlNode generateExtensionTable(String defFile, StructureDefinition ed, String imageFolder, boolean inlineGraphics, boolean full, String corePath, String imagePath, Set<String> outputTracker, RenderingContext rc) throws IOException, org.hl7.fhir.exceptions.FHIRException - Throws:
IOException
org.hl7.fhir.exceptions.FHIRException
-
genTargetLink
public void genTargetLink(org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator gen, String profileBaseFileName, String corePath, org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Cell c, ElementDefinition.TypeRefComponent t, String u, Resource src) -
codeForAggregation
-
hintForAggregation
-
describeExtensionContext
-
generateTable
public org.hl7.fhir.utilities.xhtml.XhtmlNode generateTable(String defFile, StructureDefinition profile, boolean diff, String imageFolder, boolean inlineGraphics, String profileBaseFileName, boolean snapshot, String corePath, String imagePath, boolean logicalModel, boolean allInvariants, Set<String> outputTracker, boolean mustSupport, RenderingContext rc) throws IOException, org.hl7.fhir.exceptions.FHIRException - Throws:
IOException
org.hl7.fhir.exceptions.FHIRException
-
supplementMissingDiffElements
-
generateTable
public org.hl7.fhir.utilities.xhtml.XhtmlNode generateTable(String defFile, StructureDefinition profile, boolean diff, String imageFolder, boolean inlineGraphics, String profileBaseFileName, boolean snapshot, String corePath, String imagePath, boolean logicalModel, boolean allInvariants, Set<String> outputTracker, boolean mustSupport, RenderingContext rc, String anchorPrefix) throws IOException, org.hl7.fhir.exceptions.FHIRException - Throws:
IOException
org.hl7.fhir.exceptions.FHIRException
-
generateGrid
public org.hl7.fhir.utilities.xhtml.XhtmlNode generateGrid(String defFile, StructureDefinition profile, String imageFolder, boolean inlineGraphics, String profileBaseFileName, String corePath, String imagePath, Set<String> outputTracker) throws IOException, org.hl7.fhir.exceptions.FHIRException - Throws:
IOException
org.hl7.fhir.exceptions.FHIRException
-
genElementNameCell
public org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Cell genElementNameCell(org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator gen, ElementDefinition element, String profileBaseFileName, boolean snapshot, String corePath, String imagePath, boolean root, boolean logicalModel, boolean allInvariants, StructureDefinition profile, org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Row typesRow, org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Row row, boolean hasDef, boolean ext, ProfileUtilities.UnusedTracker used, String ref, String sName, List<ElementDefinition> elements) throws IOException - Throws:
IOException
-
genElementCells
public List<org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Cell> genElementCells(org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator gen, ElementDefinition element, String profileBaseFileName, boolean snapshot, String corePath, String imagePath, boolean root, boolean logicalModel, boolean allInvariants, StructureDefinition profile, org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Row typesRow, org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Row row, boolean hasDef, boolean ext, ProfileUtilities.UnusedTracker used, String ref, String sName, org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Cell nameCell, boolean mustSupport, boolean allowSubRows, RenderingContext rc) throws IOException - Throws:
IOException
-
getRowColor
-
describeSlice
-
isPrimitive
-
getProfile
-
sortDifferential
public void sortDifferential(StructureDefinition base, StructureDefinition diff, String name, List<String> errors, boolean errorIfChanges) throws org.hl7.fhir.exceptions.FHIRException - Throws:
org.hl7.fhir.exceptions.FHIRException
-
getComparer
public ProfileUtilities.ElementDefinitionComparer getComparer(ProfileUtilities.ElementDefinitionComparer cmp, ProfileUtilities.ElementDefinitionHolder child) throws org.hl7.fhir.exceptions.FHIRException, Error - Throws:
org.hl7.fhir.exceptions.FHIRException
Error
-
sdNs
-
generateSchematrons
public void generateSchematrons(OutputStream dest, StructureDefinition structure) throws IOException, org.hl7.fhir.exceptions.DefinitionException - Throws:
IOException
org.hl7.fhir.exceptions.DefinitionException
-
generateCsvs
public void generateCsvs(OutputStream dest, StructureDefinition structure, boolean asXml) throws IOException, org.hl7.fhir.exceptions.DefinitionException, Exception - Throws:
IOException
org.hl7.fhir.exceptions.DefinitionException
Exception
-
setIds
public void setIds(StructureDefinition sd, boolean checkFirst) throws org.hl7.fhir.exceptions.DefinitionException - Throws:
org.hl7.fhir.exceptions.DefinitionException
-
generateExamples
public List<Element> generateExamples(StructureDefinition sd, boolean evenWhenNoExamples) throws org.hl7.fhir.exceptions.FHIRException - Throws:
org.hl7.fhir.exceptions.FHIRException
-
populateLogicalSnapshot
public void populateLogicalSnapshot(StructureDefinition sd) throws org.hl7.fhir.exceptions.FHIRException - Throws:
org.hl7.fhir.exceptions.FHIRException
-
cleanUpDifferential
-
generateSpanningTable
public org.hl7.fhir.utilities.xhtml.XhtmlNode generateSpanningTable(StructureDefinition profile, String imageFolder, boolean onlyConstraints, String constraintPrefix, Set<String> outputTracker) throws IOException, org.hl7.fhir.exceptions.FHIRException - Throws:
IOException
org.hl7.fhir.exceptions.FHIRException
-
initSpanningTable
public org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.TableModel initSpanningTable(org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator gen, String prefix, boolean isLogical, String id) -
interpretR2Discriminator
public static ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent interpretR2Discriminator(String discriminator, boolean isExists) -
buildR2Discriminator
public static String buildR2Discriminator(ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent t) throws org.hl7.fhir.exceptions.FHIRException - Throws:
org.hl7.fhir.exceptions.FHIRException
-
makeExtensionForVersionedURL
-
isThrowException
-
setThrowException
-
getTerminologyServiceOptions
-
setTerminologyServiceOptions
public void setTerminologyServiceOptions(org.hl7.fhir.utilities.validation.ValidationOptions terminologyServiceOptions) -
isNewSlicingProcessing
-
setNewSlicingProcessing
-
isDebug
-
setDebug
-
getDefWebRoot
-
setDefWebRoot
-
makeBaseDefinition
-
makeBaseDefinition
-
getXver
-
setXver
-
readChoices
public List<ProfileUtilities.ElementChoiceGroup> readChoices(ElementDefinition ed, List<ElementDefinition> children) -
allTypesMustSupport
-
allProfilesMustSupport
-
isMustSupportDirect
-
isMustSupport
-
isMustSupport
-
isMustSupport
-
resolveContentRef
public ProfileUtilities.ElementDefinitionResolution resolveContentRef(StructureDefinition structure, ElementDefinition element) -
getMasterSourceFileNames
-
setMasterSourceFileNames
-
findConstraint
public static ElementDefinition.ElementDefinitionConstraintComponent findConstraint(StructureDefinition sd, String inv) -
formatTypeSpecifiers
-