fhir_r4_validation library

Classes

ArrayNode
Represents an array node in the AST.
FhirValidationEngine
A modular FHIR Validator class
GraphemeSplitter
LiteralNode
Tokenizes a JSON string into a list of tokens.
Loc
Represents a basic location (line and column).
Node
Base class representing a node in the abstract syntax tree (AST).
ObjectNode
Represents an object node in the AST.
Position
Tokenizes a JSON string into a list of tokens.
PropertyNode
Represents a property node in the AST.
Segment
Represents a location segment with line, column, and offset.
Settings
Tokenizes a JSON string into a list of tokens.
Token
Represents a single token with its type, line, column, and value.
ValidationDiagnostics
ValidationDiagnostics
ValidationLocation
Represents a location within the input source, spanning from a start segment to an end segment.
ValidationResults
ValidationResults
ValueIndex<T>
Tokenizes a JSON string into a list of tokens.
ValueNode
Represents a value node in the AST.

Enums

Severity
Severity
TokenType
Represents various token types used in parsing JSON.

Extensions

Capitalize on String
Extension on String to provide a method for capitalizing the first letter.
GetUrl on StructureDefinition
Retrieves the fully qualified URL of a StructureDefinition, appending the version if available.

Constants

Break → const int
BreakLastRegional → const int
BreakPenultimateRegional → const int
BreakStart → const int
Control → const int
CR → const int
E_Base → const int
E_Base_GAZ → const int
E_Modifier → const int
Extend → const int
Glue_After_Zwj → const int
L → const int
LF → const int
LV → const int
LVT → const int
NotBreak → const int
Other → const int
Prepend → const int
Regional_Indicator → const int
SpacingMark → const int
T → const int
V → const int
ZWJ → const int

Properties

escapes Map<String, int>
Tokenizes a JSON string into a list of tokens.
final
keywordTokensMap Map<String, TokenType>
Maps keywords to their respective token types.
final
punctuatorTokensMap Map<String, TokenType>
Maps punctuators to their respective token types.
final

Functions

astSubstring(String str, int start, [int? end]) String
Tokenizes a JSON string into a list of tokens.
cleanLocalPath(String originalPath, String replacePath, String childPath) String
Cleans and standardizes paths by replacing the originalPath with replacePath and removing array indices (e.g., [0]).
codeErrorFragment(String input, int linePos, int columnPos, [Settings? settings]) String
Generates a fragment of code to display where an error occurred.
codePointAt(String str, [int? idx]) int
codePointAt gets a Unicode code point from a JavaScript UTF-16 string handling surrogate pairs appropriately
errorEof(String input, List tokenList, Settings settings) JSONASTException
Tokenizes a JSON string into a list of tokens.
extractElements(StructureDefinition structureDefinition) Map<String, ElementDefinition>
Extracts all ElementDefinition entries from a StructureDefinition, merging elements from both the snapshot and differential components.
fhirPrimitiveToDartPrimitive(String primitiveClass) String
Converts a FHIR primitive into an appropriate Dart primitive
findCode(ElementDefinition element, String path) String?
Determines the appropriate FHIR type code for an element. For polymorphic elements (ending in [x]), the code is derived from the specific type indicated in the path.
getGraphemeBreakProperty(int code) int
getNodePath(Node node) String
Generates a path for the given node in the AST.
getValueSetCodes(String valueSetUrl, ResourceCache resourceCache) Future<Set<String>>
Fetches and extracts all codes from a ValueSet or CodeSystem URL. Handles recursive includes for ValueSets and hierarchical concepts within CodeSystems.
isComparablePrimitive(String type) bool
Tells if the primitive in question is comparable
isDigit(String char) bool
Tokenizes a JSON string into a list of tokens.
isDigit1to9(String char) bool
Tokenizes a JSON string into a list of tokens.
isExp(String char) bool
Tokenizes a JSON string into a list of tokens.
isHex(String char) bool
Tokenizes a JSON string into a list of tokens.
isPrimitiveType(String type) bool
List of the Strings for the primitive types
isSurrogate(String str, int pos) bool
isValueAValidPrimitive(String primitiveClass, dynamic value) bool
Assesses if a value is a valid Primitive of the type specificed
parse(String input, Settings settings, String path) Node
Tokenizes a JSON string into a list of tokens.
parseArray(String input, List<Token> tokenList, int oldIndex, Settings settings, String path) ValueIndex<ArrayNode>?
Tokenizes a JSON string into a list of tokens.
parseChar(String input, int index, int line, int column) Token?
Tokenizes a JSON string into a list of tokens.
parseKeyword(String input, int index, int line, int column) Token?
Tokenizes a JSON string into a list of tokens.
parseLiteral(String input, List<Token> tokenList, int index, Settings settings, String path) ValueIndex<LiteralNode>?
Tokenizes a JSON string into a list of tokens.
parseNumber(String input, int oldIndex, int line, int column) Token?
Tokenizes a JSON string into a list of tokens.
parseObject(String input, List<Token> tokenList, int oldIndex, Settings settings, String path) ValueIndex<ObjectNode>?
Tokenizes a JSON string into a list of tokens.
parseProperty(String input, List<Token> tokenList, int oldIndex, Settings settings, String path) ValueIndex<PropertyNode>?
Tokenizes a JSON string into a list of tokens.
parseString(String input, int oldIndex, int line, int column) Token?
Tokenizes a JSON string into a list of tokens.
parseWhitespace(String input, int oldIndex, int oldLine, int oldColumn) Position?
Tokenizes a JSON string into a list of tokens.
printLine(String line, int position, int maxNumLength, Settings settings) String
Tokenizes a JSON string into a list of tokens.
printLines(List<String> lines, int start, int end, int maxNumLength, Settings settings) String
Tokenizes a JSON string into a list of tokens.
repeatString(String str, int n) String
Tokenizes a JSON string into a list of tokens.
safeSubstring(String str, int start, int end) String
Tokenizes a JSON string into a list of tokens.
shouldBreak(int start, List<int> mid, int end) int
shouldBreak returns whether a break is allowed between the two given grapheme breaking classes
sliceFromEnd(List<int> list, int idx) List<int>
tokenize(String input, Settings settings) List<Token>
Tokenizes a JSON string into a list of tokens.
unexpectedEnd() String
Tokenizes a JSON string into a list of tokens.
unexpectedSymbol(String symbol, String source, int line, int column) String
Tokenizes a JSON string into a list of tokens.
unexpectedToken(String token, String source, int line, int column) String
Tokenizes a JSON string into a list of tokens.
validateBindings({required Node node, required Map<String, ElementDefinition> elements, required ValidationResults results, required ResourceCache resourceCache}) Future<ValidationResults>
Validates the bindings of nodes against the value sets defined in their corresponding ElementDefinitions.
validateCardinality({required ObjectNode node, required Map<String, ElementDefinition> elements, String? url, required String originalPath, required String replacePath, required ValidationResults results, required ResourceCache resourceCache}) Future<ValidationResults>
Validates the cardinality of a Node against its corresponding ElementDefinition in the FHIR StructureDefinition.
validateExtensions({required Node node, required Map<String, ElementDefinition> elements, required ValidationResults results, required ResourceCache resourceCache}) Future<ValidationResults>
Validates the extensions of a Node against the corresponding ElementDefinition.
validateInvariants({required Node node, required ElementDefinition element, required ValidationResults results, String? url, required ResourceCache resourceCache}) Future<ValidationResults>
Validates the invariants of a Node against the corresponding fhir.ElementDefinition.
validateQuestionnaireResponse({required QuestionnaireResponse questionnaireResponse, required ResourceCache resourceCache}) Future<ValidationResults>
Validates a QuestionnaireResponse against the corresponding Questionnaire.
validateStructure({required ObjectNode node, required Map<String, ElementDefinition> elements, required String type, String? url, required ResourceCache resourceCache}) Future<ValidationResults>
Validates the structure of a FHIR resource against a given StructureDefinition.
withUrlIfExists(String string, String? url) String
Appends the URL to a message if the URL is provided.

Exceptions / Errors

JSONASTException
Custom exception class for handling JSON AST parsing errors.