The Standard Health Record (SHR)
The Standard Health Record Initiative is working to create a single, high-quality health record for every individual in the United States. For more information, see standardhealthrecord.org.
This GitHub repository provides a custom ANTLR4 grammar for the SHR SIMPL format used to represent namespaces, elements, valuesets, and mappings. The custom grammar continues to evolve and is subject to change.
├── build # contains build artifacts (temporary) ├── gradle # contains files needed by the gradle wrapper build system └── src ├── generated # contains ANTLR-generated Java parser/lexer code ├── main │ ├── antlr # contains ANTLR .g4 files defining the SHR spec grammar │ └── java # contains simple utility for parsing an SHR spec definition └── test
Building the Project
Building this project will compile the SHR lexer and parser grammars into Java lexer\parser libraries and a simple application that can create the parse tree for a given SHR definition file.
This project uses the Gradle build system. A gradle wrapper, which automatically downloads and uses an instance of gradle, is provided for convenience. To build the project, install the Java SE Development Kit 8 (a.k.a. JDK 1.8), clone this repository, then execute this command from within this directory:
To clean up the build artifacts:
shr.js.parsers.dir project property, as demonstrated below:
./gradlew -Pshr.js.parsers.dir=../shr-text-import/lib/parsers generateAntlrJSGrammarSource
Parsing SHR Text Files
ParseTool application is a simple tool that parses an SHR file or a folder of SHR files. The
ParseTool will print out all syntactical errors where files don't conform to the ANLTR SHR specification. This is useful during the development of SHR text files to ensure they are syntactically valid. It does not, however, ensure correctness of references between elements, valid valuesets or codes, etc.
To execute the parse tree on an arbitrary SHR folder or definition file, you must first use gradle to generate a script:
Then execute the generated script, passing in a path to an SHR folder or definition file: