Created
March 23, 2017 09:58
-
-
Save davidhuser/de27ab88dd1416fb49b3cf7c46721943 to your computer and use it in GitHub Desktop.
dhis2 indicator UID regexes
This file contains hidden or 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
| def find_dataelements(definition): | |
| out = re.compile('[a-zA-Z]{1}[a-zA-Z0-9]{10}\.').findall(definition) | |
| return [e[:-1] for e in out] | |
| def find_catcombos(definition): | |
| out = re.compile('\.[a-zA-Z]{1}[a-zA-Z0-9]{10}\}').findall(definition) | |
| return [e[:-1][1:] for e in out] | |
| def find_oug(definition): | |
| out = re.compile('\OUG{[a-zA-Z]{1}[a-zA-Z0-9]{10}\}').findall(definition) | |
| return [e[:-1][4:] for e in out] | |
| def find_constants(definition): | |
| out = re.compile('\C{[a-zA-Z]{1}[a-zA-Z0-9]{10}\}').findall(definition) | |
| return [e[:-1][2:] for e in out] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment