pacsretrieve/pacsretrieve.py
def ageCalc(self, astr_birthDate, astr_scanDate):
        """
        Calculate and return the age based on the difference between the
        scan data and birthdate
        """
        str_age                 = ""
        birthY, birthM, birthD  = int(astr_birthDate[0:4]), int(astr_birthDate[4:6]), int(astr_birthDate[6:8])
        scanY, scanM, scanD     = int(astr_scanDate[0:4]), int(astr_scanDate[4:6]), int(astr_scanDate[6:8])

        birthDate = datetime.date(birthY, birthM, birthD)
        scanDate = datetime.date(scanY, scanM, scanD)

        dateDiff = scanDate - birthDate
        if dateDiff.days < 31:
            str_age = '%03dD' % dateDiff.days
        elif dateDiff.days < (9*30.42):
            str_age = '%03dW' % (dateDiff.days / 7)
        elif dateDiff.days < (2*365.25):
            str_age = '%03dM' % (dateDiff.days / 30.42)
        else:
            str_age = '%03dY' % (dateDiff.days / 365.25)
        return str_age

        Calculate and return the age based on the difference between the
        scan data and birthdate
        
Calculate and return the age based on the difference between the
scan data and birthdate
Calculate and return the age based on the difference between the scan data and birthdate
def ageCalc(self, astr_birthDate, astr_scanDate):
        str_age                 = ""
        birthY, birthM, birthD  = int(astr_birthDate[0:4]), int(astr_birthDate[4:6]), int(astr_birthDate[6:8])
        scanY, scanM, scanD     = int(astr_scanDate[0:4]), int(astr_scanDate[4:6]), int(astr_scanDate[6:8])
        birthDate = datetime.date(birthY, birthM, birthD)
        scanDate = datetime.date(scanY, scanM, scanD)
        dateDiff = scanDate - birthDate
        if dateDiff.days < 31:
            str_age = '%03dD' % dateDiff.days
        elif dateDiff.days < (9*30.42):
            str_age = '%03dW' % (dateDiff.days / 7)
        elif dateDiff.days < (2*365.25):
            str_age = '%03dM' % (dateDiff.days / 30.42)
        else:
            str_age = '%03dY' % (dateDiff.days / 365.25)
        return str_age
def ageCalc ( self , astr_birthDate , astr_scanDate ) : str_age = "" birthY , birthM , birthD = int ( astr_birthDate [ 0 : 4 ] ) , int ( astr_birthDate [ 4 : 6 ] ) , int ( astr_birthDate [ 6 : 8 ] ) scanY , scanM , scanD = int ( astr_scanDate [ 0 : 4 ] ) , int ( astr_scanDate [ 4 : 6 ] ) , int ( astr_scanDate [ 6 : 8 ] ) birthDate = datetime . date ( birthY , birthM , birthD ) scanDate = datetime . date ( scanY , scanM , scanD ) dateDiff = scanDate - birthDate if dateDiff . days < 31 : str_age = '%03dD' % dateDiff . days elif dateDiff . days < ( 9 * 30.42 ) : str_age = '%03dW' % ( dateDiff . days / 7 ) elif dateDiff . days < ( 2 * 365.25 ) : str_age = '%03dM' % ( dateDiff . days / 30.42 ) else : str_age = '%03dY' % ( dateDiff . days / 365.25 ) return str_age
Calculate and return the age based on the difference between the
scan data and birthdate
Calculate and return the age based on the difference between the scan data and birthdate
"""
        Calculate and return the age based on the difference between the
        scan data and birthdate
        """
self
astr_birthDate
astr_scanDate