Commit 5f1f23a4 authored by Paul McCarthy's avatar Paul McCarthy 🚵
Browse files

RF: Deprecated coding-specific metaproc functions. Made the

hierarchicalDescriptionFrom[Code|Numeric] functions first-class metaproc
functions
parent ca8a9625
......@@ -24,6 +24,7 @@ All ``metaproc`` functions must accept three arguments:
"""
from . import util
from . import custom
from . import coding
from . import hierarchy
......@@ -38,66 +39,76 @@ def codingDescriptionFromValue(dtable, vid, val):
return '{} - {}'.format(val, desc)
def hierarchicalDescriptionFromNumeric(val, name):
@custom.metaproc('hierarchynumdesc')
def hierarchicalDescriptionFromNumeric(dtable, vid, val):
"""Generates a description for a numeric hierarchical code. """
val = hierarchy.numericToCode(val, name)
hier = hierarchy.getHierarchyFilePath(name=name)
val = hierarchy.numericToCode(val, dtable=dtable, vid=vid)
hier = hierarchy.getHierarchyFilePath(dtable, vid)
hier = hierarchy.loadHierarchyFile(hier)
desc = hier.description(val)
return '{} - {}'.format(val, desc)
def hierarchicalDescriptionFromCode(val, name):
@custom.metaproc('hierarchycodedesc')
def hierarchicalDescriptionFromCode(dtable, vid, val):
"""Generates a description for a hierarchical code. """
hier = hierarchy.getHierarchyFilePath(name=name)
hier = hierarchy.getHierarchyFilePath(dtable=dtable, vid=vid)
hier = hierarchy.loadHierarchyFile(hier)
desc = hier.description(val)
return '{} - {}'.format(val, desc)
@custom.metaproc('icd10.numdesc')
@util.deprecated('Use hierarchynumdesc instead')
def icd10DescriptionFromNumeric(dtable, vid, val):
"""Generates a description for a numeric ICD10 code. """
return hierarchicalDescriptionFromNumeric(val, 'icd10')
return hierarchicalDescriptionFromNumeric(dtable, vid, val)
@custom.metaproc('icd10.codedesc')
@util.deprecated('Use hierarchycodedesc instead')
def icd10DescriptionFromCode(dtable, vid, val):
"""Generates a description for an ICD10 code. """
return hierarchicalDescriptionFromCode(val, 'icd10')
return hierarchicalDescriptionFromCode(dtable, vid, val)
@custom.metaproc('icd9.numdesc')
@util.deprecated('Use hierarchynumdesc instead')
def icd9DescriptionFromNumeric(dtable, vid, val):
"""Generates a description for a numeric ICD9 code. """
return hierarchicalDescriptionFromNumeric(val, 'icd9')
return hierarchicalDescriptionFromNumeric(dtable, vid, val)
@custom.metaproc('icd9.codedesc')
@util.deprecated('Use hierarchycodedesc instead')
def icd9DescriptionFromCode(dtable, vid, val):
"""Generates a description for an ICD9 code. """
return hierarchicalDescriptionFromCode(val, 'icd9')
return hierarchicalDescriptionFromCode(dtable, vid, val)
@custom.metaproc('opcs4.numdesc')
@util.deprecated('Use hierarchynumdesc instead')
def opcs4DescriptionFromNumeric(dtable, vid, val):
"""Generates a description for a numeric OPCS4 code. """
return hierarchicalDescriptionFromNumeric(val, 'opcs4')
return hierarchicalDescriptionFromNumeric(dtable, vid, val)
@custom.metaproc('opcs4.codedesc')
@util.deprecated('Use hierarchycodedesc instead')
def opcs4DescriptionFromCode(dtable, vid, val):
"""Generates a description for an OPCS4 code. """
return hierarchicalDescriptionFromCode(val, 'opcs4')
return hierarchicalDescriptionFromCode(dtable, vid, val)
@custom.metaproc('opcs3.numdesc')
@util.deprecated('Use hierarchynumdesc instead')
def opcs3DescriptionFromNumeric(dtable, vid, val):
"""Generates a description for a numeric OPCS3 code. """
return hierarchicalDescriptionFromNumeric(val, 'opcs3')
return hierarchicalDescriptionFromNumeric(dtable, vid, val)
@custom.metaproc('opcs3.codedesc')
@util.deprecated('Use hierarchycodedesc instead')
def opcs3DescriptionFromCode(dtable, vid, val):
"""Generates a description for an OPCS3 code. """
return hierarchicalDescriptionFromCode(val, 'opcs3')
return hierarchicalDescriptionFromCode(dtable, vid, val)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment