Last active
September 8, 2021 23:59
-
-
Save ppazos/7fcb12866095b399890fc5165fb51805 to your computer and use it in GitHub Desktop.
openEHR TERMINOLOGY_ID format
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// matcher api https://docs.oracle.com/javase/8/docs/api/java/util/regex/Matcher.html | |
// regex ref https://docs.oracle.com/javase/tutorial/essential/regex/pre_char_classes.html | |
def pat = ~/([\w_-]+)\s*(?:\(?(\w*)\)?.*)?/ | |
// https://specifications.openehr.org/releases/BASE/latest/base_types.html#_syntaxes | |
def patoehr = ~/(([A-Za-z]+)[\w-\+\/]*)(\(([A-Za-z]+)[\w-\+\/]*\))?/ | |
def tids = [ | |
'SNOMED-CT', | |
'SNOMED-CT(2020)', | |
'SNOMED-CT(2020.1)', | |
'ICD9(1999)', | |
'ICD10AM(3rd_ed)', | |
'ICD10AM(A3rd_ed)', | |
'123', | |
'a1', | |
'a1+1', | |
'a1+1/' | |
] | |
tids.each { tid -> | |
println tid +" "+ patoehr.matcher(tid).matches() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment