Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
FSL
ukbparse
Commits
ad8034eb
Commit
ad8034eb
authored
May 09, 2019
by
Paul McCarthy
🚵
Browse files
RF: Moved metaproc functions into their own module
parent
639c986c
Changes
3
Hide whitespace changes
Inline
Side-by-side
ukbparse/custom.py
View file @
ad8034eb
...
...
@@ -184,6 +184,7 @@ def registerBuiltIns():
import
ukbparse.exporting_tsv
as
uet
import
ukbparse.cleaning_functions
as
cf
import
ukbparse.processing_functions
as
pf
import
ukbparse.metaproc_functions
as
mf
if
firstTime
:
loglevel
=
log
.
getEffectiveLevel
()
...
...
@@ -194,6 +195,7 @@ def registerBuiltIns():
importlib
.
reload
(
uet
)
importlib
.
reload
(
cf
)
importlib
.
reload
(
pf
)
importlib
.
reload
(
mf
)
if
firstTime
:
log
.
setLevel
(
loglevel
)
...
...
ukbparse/metaproc_functions.py
0 → 100644
View file @
ad8034eb
#!/usr/bin/env python
#
# metaproc_functions.py - Functions for manipulating column metadata.
#
# Author: Paul McCarthy <pauldmccarthy@gmail.com>
#
"""This module contains ``metaproc`` functions - functions for manipulating
column metadata.
Some :class:`.Column` instances have a ``metadata`` attribute, containing some
additional information about the column. The functions in this module can be
used to modify these metadata values. Currently, column metadata is only used
to generate a description of each column (via the ``--description_file``
command-line option).
"""
from
.
import
icd10
from
.
import
custom
from
.
import
hierarchy
@
custom
.
metaproc
(
'icd10.numdesc'
)
def
icd10DescriptionFromNumeric
(
val
):
"""Generates a description for a numeric ICD10 code. """
val
=
icd10
.
numericToCode
(
val
)
hier
=
hierarchy
.
getHierarchyFilePath
(
name
=
'icd10'
)
hier
=
hierarchy
.
loadHierarchyFile
(
hier
)
desc
=
hier
.
description
(
val
)
return
'{} - {}'
.
format
(
val
,
desc
)
@
custom
.
metaproc
(
'icd10.codedesc'
)
def
icd10DescriptionFromCode
(
val
):
"""Generates a description for an ICD10 code. """
hier
=
hierarchy
.
getHierarchyFilePath
(
name
=
'icd10'
)
hier
=
hierarchy
.
loadHierarchyFile
(
hier
)
desc
=
hier
.
description
(
val
)
return
'{} - {}'
.
format
(
val
,
desc
)
ukbparse/processing.py
View file @
ad8034eb
...
...
@@ -37,9 +37,7 @@ import collections
import
pyparsing
as
pp
from
.
import
util
from
.
import
icd10
from
.
import
custom
from
.
import
hierarchy
log
=
logging
.
getLogger
(
__name__
)
...
...
@@ -353,22 +351,3 @@ def makeParser():
function
=
funcName
+
pp
.
Optional
(
allargs
)
return
function
@
custom
.
metaproc
(
'icd10.numdesc'
)
def
icd10DescriptionFromNumeric
(
val
):
"""Generates a description for a numeric ICD10 code. """
val
=
icd10
.
numericToCode
(
val
)
hier
=
hierarchy
.
getHierarchyFilePath
(
name
=
'icd10'
)
hier
=
hierarchy
.
loadHierarchyFile
(
hier
)
desc
=
hier
.
description
(
val
)
return
'{} - {}'
.
format
(
val
,
desc
)
@
custom
.
metaproc
(
'icd10.codedesc'
)
def
icd10DescriptionFromCode
(
val
):
"""Generates a description for an ICD10 code. """
hier
=
hierarchy
.
getHierarchyFilePath
(
name
=
'icd10'
)
hier
=
hierarchy
.
loadHierarchyFile
(
hier
)
desc
=
hier
.
description
(
val
)
return
'{} - {}'
.
format
(
val
,
desc
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment