Skip to content

Instantly share code, notes, and snippets.

@ppazos
Last active September 8, 2021 23:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ppazos/7fcb12866095b399890fc5165fb51805 to your computer and use it in GitHub Desktop.
Save ppazos/7fcb12866095b399890fc5165fb51805 to your computer and use it in GitHub Desktop.
openEHR TERMINOLOGY_ID format
// 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