Exemple #1
0
def years_since_final_release(crec: CRecord, year_min: int) -> Decision:
    return Decision(
        name=
        f"Has it been at least {year_min} years since {crec.person.first_name}'s final release from custody?",
        value=crec.years_since_final_release() > year_min,
        reasoning=f"It has been {crec.years_since_final_release()}.",
    )
Exemple #2
0
def expunge_over_70(crecord: CRecord, analysis: dict) -> Tuple[CRecord, dict]:
    """
    Analyze a crecord for expungements if the defendant is over 70.

    18 Pa.C.S. 9122(b)(1) provides for expungements of an individual who
    is 70 or older, and has been free of arrest or prosecution for 10
    years following the final release from confinement or supervision.
    """
    conditions = {
        "age_over_70":
        crecord.person.age() > 70,
        "years_since_last_arrested_or_prosecuted":
        crecord.years_since_last_arrested_or_prosecuted() > 10,
        "years_since_final_release":
        crecord.years_since_final_release() > 10,
    }

    if all(conditions.values()):
        conclusion = "Expunge cases"
        modified_record = CRecord(person=copy.deepcopy(crecord.person),
                                  cases=[])
    else:
        conclusion = "No expungements possible"
        modified_record = crecord
    analysis.update({
        "age_over_70_expungements": {
            "conditions": conditions,
            "conclusion": conclusion,
        }
    })

    return modified_record, analysis