IWPC华法林剂量公式

基于IWPC华法林剂量计算器的数值,建立python方法

def warDosage(age, height, weight, VKORC1, CYP2C9, race="A", enzyme="N", amiodarone="N"):
    ageFix = 5.6044 - 0.2614 * int(age / 10)
    heightFix = 0.0087 * height
    weightFix = 0.0128 * weight
    
    if VKORC1 == "A/A":
        VKORC1_fix = 1.6974
    elif VKORC1 == "A/G":
        VKORC1_fix = 0.8677
    elif VKORC1 == "G/G":
        VKORC1_fix = 0
    else:
        VKORC1_fix = 0.4854
    
    if CYP2C9 == "*1/*1":
        CYP2C9_fix = 0
    elif CYP2C9 == "*1/*2":
        CYP2C9_fix = -0.5211
    elif CYP2C9 == "*1/*3":
        CYP2C9_fix = -0.9357
    elif CYP2C9 == "*2/*2":
        CYP2C9_fix = -1.0616
    elif CYP2C9 == "*2/*3":
        CYP2C9_fix = -1.9206
    elif CYP2C9 == "*3/*3":
        CYP2C9_fix = -2.3312
    else:
        CYP2C9_fix = -0.2188

    if race == "A":
        race_fix = 0.1092
    elif race == "B":
        race_fix = 0.276
    elif race == "C":
        race_fix = 0
    else:
        race_fix = 0.1032
    
    if enzyme == "Y":
        enzyme_fix = 1.1816
    else:
        enzyme_fix = 0
    
    if amiodarone == "Y":
        amiodarone_fix = 0.5503
    else:
        amiodarone_fix = 0

    dosage = round((ageFix + heightFix + weightFix - VKORC1_fix + CYP2C9_fix - race_fix + enzyme_fix - amiodarone_fix) ** 2)

    return dosage