Code Monkey home page Code Monkey logo

snomed-expression-constraint-language's Introduction

SNOMED CT Expression Constraint Language

This repository contains the formal syntax and valid examples for each version of the SNOMED CT Expression Constraint Language, commonly known as ECL.

The Expression Constraint Language is used to represent SNOMED CT expression constraints and simple queries, it is a computable language that is part of the SNOMED CT Family of Languages.

The folders are organized as follows:

  • syntax
    • Contains the brief (normative) and long (informative) ABNF syntaxes. Also the brief ANTLR v4 syntax.
  • examples
    • Contains an extensive set of files with valid ECL examples.

Other Useful Resources

ECL Specification and Guide

The Specification and Guide is available at snomed.org/ecl.

ECL Parsers

  • JavaScript (ECMAScript):
    • Parsers can be generated using the APG JS project, enables validating the syntax of ECL in a web page.
  • Java parsers:
    • IHTSDO / snomed-ecl-parser - ANTLR and plain java abstract ECL implementation, base layer of a full implementation.
    • b2ihealthcare / snomed-ecl - Eclipse Xtext based abstract ECL implementation, base layer of a full implementation. Enables an Eclipse based UI an Eclipse LSP4J language server.

snomed-expression-constraint-language's People

Contributors

cmark avatar johngrimes avatar kaicode avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

cmark aehrc

snomed-expression-constraint-language's Issues

Possible unreachable conjunction / disjunction refinement rules in the ANTLR grammar?

Hi,

I've been investigating the SNOMED ECL ANTLR grammar for use with a language other than Java. Whilst experimenting with the ANTLR tooling, I've observed that the following rules may not be reachable in the grammar:

  • conjunctionrefinementset
  • disjunctionrefinementset

Link to rules

The subrefinement rule appears to be greedy in the eclrefinement rule they are used in. All conjunction / disjunction combinations I've tried seem to just use the conjunctionattributeset/disjunctionattributeset rules.

Example below using the latest ANTLR grammar in ANTLR Lab:

ECL:

<  404684003 |Clinical finding| :
          363698007 |Finding site|  = <<  39057004 |Pulmonary valve structure|  AND
          116676008 |Associated morphology|  = <<  415582006 |Stenosis|  AND
          42752001 |Due to|  = <<  445238008 |Malignant carcinoid tumor|

Parse Hierarchy:
image

Are there scenarios that do use these two rules or could the grammar be simplified?

Grammar behaviour in Snowstorm vs ANTLR Lab / C# Targets

Hi,

I've observed some different behaviour when validating / executing ECL in the International SNOMED CT Browser / Snowstorm vs using the Grammar with ANTLR Lab or an ANTLR Parser targeting a different language e.g. C#.

If I execute an ECL query with some erroneous text after a valid expressionconstraint rule snowstorm correctly reports that there is some unexpected input e.g.

<< 404684003 |Clinical finding (finding)|  - Some invalid text : 363698007 |Finding site| = 89187006 |Airway structure (body structure)|

The error I get back is Syntax error at line 1, character 43: unexpected character '-' expecting {, '\u0009', '\u000A', '\u000D', ' ', '/'}

However validating the same ECL statement in ANTLR Lab the parser recognises << 404684003 as a valid expression constraint and ignores the remainder of the statement.

image

I've found that adding a new top level rule including an EOF reference fixes this behaviour and the parser in ANTLR Lab correctly provides the same error.

grammar ECL;

ecl : expressionconstraint EOF;
expressionconstraint : .... 

I have noticed that the snomed-ecl-parser repo uses an older version of the ANTLR Runtime (4.5.3), I'm wondering if there has been a behaviour change in the more recent versions (e.g. 4.13.1) of the ANTLR Runtime causing this difference?

However I did find this guidance on Starting Rules and EOF on the ANTLR repo, highlighting the same issue. Should there be a new top level rule in the grammar with an EOF marker to ensure the whole input document / ECL statement is read?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.