Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- conviction_record_clearable_outcomes = [] # list of outcomes for each charge
- condition_for_clearability = None # define variable and set it to None
- conditions_for_clearability = [] # list of conditions for each charge
- current_date = datetime(2018, 11, 15)
- for charge_detail in df_expungement.itertuples():
- conviction_record_clearable = np.NaN # need these to go back to null on each iteration
- condition_for_clearability = np.NaN # need these to go back to null on each iteration
- person_id = charge_detail[1]
- charge_normalization = charge_detail[2]
- charge_type_normalization = charge_detail[3]
- disposition_normalization = charge_detail[4]
- is_most_recent_conviction = charge_detail[5]
- disposition_date = charge_detail[6]
- sentencing_length_days = charge_detail[7]
- # 1- if the person was found not guilty, then you donβt have to analyze it. We are capturing this data a different way.
- if disposition_normalization == 'not guilty':
- conviction_record_clearable = 0
- condition_for_clearability = 1
- # 2- CRS 24-72-704, if a person who is convicted of a drug related petty offense, misdemeanor, or felony (not for the sale or
- # distribution of drugs) between July 1, 2008 and July 1, 2011 and has gone 10 years without a charge or conviction, original
- # conviction can be sealable.
- elif charge_normalization == "drug_poss" and disposition_date + timedelta(days=sentencing_length_days) < current_date and is_most_recent_conviction == 1 and charge_type_normalization in ['C1', 'C2_M', 'C2_PO', 'C2_T', 'C3', 'M', 'F5', 'F6'] and datetime(2008, 7, 1) < disposition_date < datetime(2011, 7, 1):
- conviction_record_clearable = 1
- condition_for_clearability = 2
- # 3- CRS 24-72-704, if this type of offense occurred before July 1, 2008 the conviction needs prosecutor approval to be sealable.
- elif disposition_date < datetime(2008, 7, 1):
- conviction_record_clearable = 1
- condition_for_clearability = 3
- # 4- for petty offense, level 2 and 3 misdemeanors (including drug misdemeanors), convicted must go 3 years without charge or conviction
- elif charge_type_normalization in ['C2_PO', 'C2-M', 'C2_T', 'M3'] and disposition_date + timedelta(days=1095) < current_date and disposition_date + timedelta(days=sentencing_length_days) < current_date and charge_normalization == 'drug_distribute':
- conviction_record_clearable = 1
- condition_for_clearability = 4
- #5- for level 1 misdemeanors (including drug misdemeanors), convicted must go 5 years without charge or conviction
- elif charge_type_normalization == 'M1' and disposition_date + timedelta(days=1825) < current_date and disposition_date + timedelta(days=sentencing_length_days) < current_date and is_most_recent_conviction == 1:
- conviction_record_clearable = 1
- condition_for_clearability = 5
- #6- for level 4, 5, and 6 drug felonies, convicted must go 7 years without charge or conviction
- elif charge_type_normalization in ['F4', 'F5', 'F6'] and disposition_date + timedelta(days=2555) < current_date and disposition_date + timedelta(days=sentencing_length_days) < current_date and is_most_recent_conviction == 1 and disposition_date > datetime(2011, 7, 1):
- conviction_record_clearable = 1
- condition_for_clearability = 6
- #7- for all other drug related offense not covered, after 10 years without charge or conviction the records can be sealable.
- elif charge_normalization == 'drug_poss' and disposition_date + timedelta(days=3650) < current_date and disposition_date + timedelta(days=sentencing_length_days) < current_date and is_most_recent_conviction == 1:
- conviction_record_clearable = 1
- condition_for_clearability = 7
- #8- for all other instances
- else:
- conviction_record_clearable = 0
- condition_for_clearability = 8
- # append the conviction_record_clearable 1 or 0 value to conviction_record_clearable_outcomes
- conviction_record_clearable_outcomes.append(conviction_record_clearable)
- conditions_for_clearability.append(condition_for_clearability)
Add Comment
Please, Sign In to add comment