def get_fields(ph, event): """ :type ph: PersonalHistory :type event: Event """ return [ ("1a", FormUtil.attorney_or_party_without_attorney(ph, event)), ("1b", str(ph.address)), ("1c", ph.phone_number), ("1d", ph.email), ("1e", "Self-Represented"), ("2a", SanMateoCountyCourt.county_name()), ("2b", SanMateoCountyCourt.mailing_address().address), ("2d", SanMateoCountyCourt.mailing_address().city + " " + SanMateoCountyCourt.mailing_address().zip_code), ("3a", "THE PEOPLE OF THE STATE OF CALIFORNIA"), ("3b", str(FormUtil.event_to_name_as_charged(ph, event))), ("4a", True), ("5", event.associated_cases[0].case_id), ("6", ph.address.to_str_one_line()), ("7a", FormUtil.case_date(event)), ("7b", "CR180, CR181" + (", DECLARATION" if event.needs_declaration() else "")), ("8a", SanMateoCountyCourt.chief_probation_officer_name_and_title_str()), ("8b", True), ("8c", SanMateoCountyCourt.mailing_address_oneline_str()), ("9", True), ("10", FormUtil.short_case_name(ph, event)), ("11", event.associated_cases[0].case_id), ("12", FormUtil.today_date_str()), ("13", str(ph.name)), ]
def get_fields(ph, event): """ :type ph: PersonalHistory :type event: Event """ return FormUtil.cr_180_header(ph, event) + FormUtil.cr_180_header_2(ph, event)
def generate_form(form_model, ph, event, packet_output_folder, resources_directory): # ==> saves PDF """ :type form_model: FormModel """ fields_list = form_model.get_fields(ph, event) form_filler = FormFiller(form_model.get_name(), resources_directory) json_list = form_filler.get_fields() json_list = FormUtil.fill_field_json_with_field_list(json_list, fields_list) output_path = os.path.join(packet_output_folder, form_model.get_output_file_name()) form_filler.fill(json_list, output_path)
def get_fields(ph, event): """ :type ph: PersonalHistory :type event: Event """ header = FormUtil.cr_180_header(ph, event) table = CR180Model._offenses_table(event) offense_date = [("4a", FormUtil.case_date(event))] categorization = CR180Model._petition_categorization(ph, event) header_2 = FormUtil.cr_180_header_2(ph, event) page_2_footer = [ ("11", FormUtil.today_date_str()), ("12", ph.address.to_str_one_line()), ("13", ph.address.city), ("14", ph.address.state), ("15", ph.address.zip_code), ] return header + offense_date + table + categorization + header_2 + page_2_footer
def generate_form(form_model, ph, event, packet_output_folder, resources_directory): # ==> saves PDF """ :type form_model: FormModel """ fields_list = form_model.get_fields(ph, event) form_filler = FormFiller(form_model.get_name(), resources_directory) json_list = form_filler.get_fields() json_list = FormUtil.fill_field_json_with_field_list( json_list, fields_list) output_path = os.path.join(packet_output_folder, form_model.get_output_file_name()) form_filler.fill(json_list, output_path)
def _generate_forms(request): personal_history = pickle.loads(request.session['personal_history']) webapp_path = os.path.abspath(record_expungement_webapp.__path__[0]) forms_dir_path = os.path.join(webapp_path, "static/forms") packet_base_folder = os.path.join(webapp_path, "outputs", "session_" + request.session.session_key) if os.path.exists(packet_base_folder): shutil.rmtree(packet_base_folder) for i, event in enumerate(personal_history.rap_sheet.events): if event.has_eligible_convictions(): # TODO change this to has any eligible event_subfolder = FormUtil.date_to_str(event.arrest_info.date) + "_arrest" packet_output_folder = os.path.join(packet_base_folder, str(event_subfolder)) PacketFactory.generate(personal_history, event, packet_output_folder, forms_dir_path) return packet_base_folder
def get_fields(ph, event): """ :type ph: PersonalHistory :type event: Event """ return [ ("1a", str(ph.name)), ("1b", ph.address.address), ("1c", ph.address.city), ("1d", ph.address.state), ("1e", ph.address.zip_code), ("2", "N/A"), # Lawyer, if person has one ("3", SanMateoCountyCourt.mailing_address_multiline_str()), ("4", event.associated_cases[0].case_id), ("5", FormUtil.short_case_name(ph, event)), ("6", str(ph.name)), ("7", event.associated_cases[0].case_id), ]
def get_fields(ph, event): """ :type ph: PersonalHistory :type event: Event """ fi = ph.financial_information fields = [ ("1a", str(ph.name)), ("1b", ph.address.address), ("1c", ph.address.city), ("1d", ph.address.state), ("1e", ph.address.zip_code), ("1f", ph.phone_number), ("2a", fi.job.job_title), ("2b", fi.job.employer_name), ("2c", fi.job.employer_address.to_str_one_line()), ("3a", "N/A"), # Lawyer, if person has one ("4a", True), # Check 4a but not 4b ] fields.extend(FW001Model._waiver_needed_reasons(fi)) fields.extend( [("6a", True)] if fi.event_index_to_whether_fees_have_been_waived_recently[ph.rap_sheet.events.index(event)] else [] ) fields.extend( [("7", True)] if fi.income_changes_significantly_month_to_month else [] ) fields.extend(FW001Model._monthly_and_household_income(fi)) fields.extend(FW001Model._money_and_property(fi)) fields.extend(FW001Model._monthly_deductions_and_expenses(fi)) fields.extend([ ("12", SanMateoCountyCourt.mailing_address_multiline_str()), ("13", event.associated_cases[0].case_id), ("14", FormUtil.short_case_name(ph, event)), ]) return fields
def get_fields(ph, event): """ :type ph: PersonalHistory :type event: Event """ fi = ph.financial_information fields = [ ("1a", str(ph.name)), ("1b", ph.address.address), ("1c", ph.address.city), ("1d", ph.address.state), ("1e", ph.address.zip_code), ("1f", ph.phone_number), ("2a", fi.job.job_title), ("2b", fi.job.employer_name), ("2c", fi.job.employer_address.to_str_one_line()), ("3a", "N/A"), # Lawyer, if person has one ("4a", True), # Check 4a but not 4b ] fields.extend(FW001Model._waiver_needed_reasons(fi)) fields.extend([( "6a", True)] if fi.event_index_to_whether_fees_have_been_waived_recently[ ph.rap_sheet.events.index(event)] else []) fields.extend([( "7", True)] if fi.income_changes_significantly_month_to_month else []) fields.extend(FW001Model._monthly_and_household_income(fi)) fields.extend(FW001Model._money_and_property(fi)) fields.extend(FW001Model._monthly_deductions_and_expenses(fi)) fields.extend([ ("12", SanMateoCountyCourt.mailing_address_multiline_str()), ("13", event.associated_cases[0].case_id), ("14", FormUtil.short_case_name(ph, event)), ]) return fields