def add_fields(self, fields: List[Field], name_position: Tuple[int, int], occupation_position: Tuple[int, int], start_date_position: Tuple[int, int], end_date_position: Tuple[int, int]): fields.append(Field( self.name_and_address, name_position, 10, False, "A.III.", "4")) fields.append(Field( self.occupation, occupation_position, 10, False, "A.III.", "4")) fields.append(Field( self.start_date, start_date_position, 10, False, "A.III.", "4")) fields.append(Field( self.end_date, end_date_position, 10, False, "A.III.", "4"))
def add_fields(self, fields, name_position: Tuple[int, int], city_position: Tuple[int, int], location_position: Tuple[int, int], is_deceased_position: Tuple[int, int]): fields.append(Field( self.full_name, name_position, 10, False, "A.III.", "5")) fields.append(Field( "%s, %s" % (self.city_birth, self.country_birth), city_position, 10, False, "A.III.", "5")) fields.append(Field( self.location, location_position, 10, False, "A.III.", "5")) fields.append(BooleanField( self.is_deceased, is_deceased_position, "A.III.", "5"))
def __init__(self, asylum_reasons: List[AsylumReason], experienced_harm: bool, experienced_harm_explanation: Optional[str], fear_harm: bool, fear_harm_explanation: Optional[str]): fields = [] for reason in asylum_reasons: fields.append(asylum_reason_fields[reason]) if experienced_harm: fields.append(BooleanField(True, (143, 456), "B", "A")) if experienced_harm_explanation: fields.append( Field(experienced_harm_explanation, (59, 380), 10, False, "B", "A")) else: fields.append(BooleanField(True, (59, 456), "B", "A")) if fear_harm: fields.append(BooleanField(True, (143, 234), "B", "A")) if fear_harm_explanation: fields.append( Field(fear_harm_explanation, (59, 170), 10, False, "B", "A")) else: fields.append(BooleanField(True, (59, 234), "B", "A")) Page.__init__(self, fields, "resources/i-589-page-5.pdf")
def __init__(self, name, description=None, default=None, required=0, multiple=0, setable=1, **view_attrs): self.required = required Field.__init__(self, name, description, default, multiple, setable) Viewable.__init__(self, **view_attrs)
def add_fields(self, fields: List[Field], name_position: Tuple[int, int], type_position: Tuple[int, int], location_position: Tuple[int, int], start_date_position: Tuple[int, int], end_date_position: Tuple[int, int]): fields.append(Field(self.name, name_position, 10, False, "A.III.", "3")) fields.append( Field(self.school_type, type_position, 10, False, "A.III.", "3")) fields.append( Field(self.location, location_position, 10, False, "A.III.", "3")) fields.append( Field(self.start_date, start_date_position, 10, False, "A.III.", "3")) fields.append( Field(self.end_date, end_date_position, 10, False, "A.III.", "3"))
def __init__(self, been_imprisoned: bool, imprisoned_explanation: Optional[str], belong_group: bool, belong_group_explanation: Optional[str], continue_group: Optional[bool], continue_group_explanation: Optional[str], afraid_torture: bool, afraid_torture_explanation: Optional[str]): fields = [] if been_imprisoned: fields.append(BooleanField(True, (143, 678), "B", "2")) if imprisoned_explanation: fields.append( Field(imprisoned_explanation, (59, 645), 10, False, "B", "2")) else: fields.append(BooleanField(True, (59, 678), "B", "2")) if belong_group: fields.append(BooleanField(True, (143, 498), "B", "3A")) if belong_group_explanation: fields.append( Field(belong_group_explanation, (59, 458), 10, False, "B", "3A")) else: fields.append(BooleanField(True, (59, 498), "B", "3A")) if continue_group is not None: if continue_group: fields.append(BooleanField(True, (143, 336), "B", "3B")) if continue_group_explanation: fields.append( Field(continue_group_explanation, (59, 296), 10, False, "B", "3B")) else: fields.append(BooleanField(True, (59, 336), "B", "3B")) if afraid_torture: fields.append(BooleanField(True, (143, 174), "B", "4")) if afraid_torture_explanation: fields.append( Field(afraid_torture_explanation, (59, 140), 10, False, "B", "4")) else: fields.append(BooleanField(True, (59, 174), "B", "4")) Page.__init__(self, fields, "resources/i-589-page-6.pdf")
def __init__(self, previously_applied: bool, previously_applied_explanation: Optional[str], reside_other_country: bool, lawful_other_country: bool, other_country_explanation: Optional[str], caused_harm: bool, caused_harm_explanation: Optional[str]): fields = [] if previously_applied: fields.append(BooleanField(True, (143, 653), "C", "1")) if previously_applied_explanation: fields.append( Field(previously_applied_explanation, (59, 576), 10, False, "C", "1")) else: fields.append(BooleanField(True, (59, 653), "C", "1")) if reside_other_country: fields.append(BooleanField(True, (143, 432), "C", "2A")) else: fields.append(BooleanField(True, (59, 432), "C", "2A")) if lawful_other_country: fields.append(BooleanField(True, (143, 384), "C", "2B")) else: fields.append(BooleanField(True, (59, 384), "C", "2B")) if reside_other_country or lawful_other_country: fields.append( Field(other_country_explanation, (59, 324), 10, False, "C", "2B")) if caused_harm: fields.append(BooleanField(True, (143, 180), "C", "3")) if caused_harm_explanation: fields.append( Field(caused_harm_explanation, (59, 145), 10, False, "C", "3")) else: fields.append(BooleanField(True, (59, 180), "C", "3")) Page.__init__(self, fields, "resources/i-589-page-7.pdf")
def __init__(self, a_number: Optional[str], name: str, date: date, part: str, question: str, text: str): fields = [] if a_number: fields.append(Field(a_number, (40, 677), 10, False, "", "")) fields.append( Field(date.strftime('%m/%d/%Y'), (310, 677), 10, False, "", "")) fields.append(Field(name, (40, 647), 10, False, "", "")) fields.append(Field(part, (85, 600), 10, False, "", "")) fields.append(Field(question, (85, 583), 10, False, "", "")) fields.append(Field(text, (40, 555), 10, False, "", "")) Page.__init__(self, fields, "resources/i-589-page-12.pdf")
def __init__(self, returned: bool, returned_explanation: Optional[str], over_a_year: bool, over_a_year_explanation: Optional[str], committed_crime: bool, committed_crime_explanation: Optional[str] ): fields = [] if returned: fields.append(BooleanField( True, (143, 696), "C", "4")) if returned_explanation: fields.append( Field( returned_explanation, (59, 656), 10, False, "C", "4")) else: fields.append(BooleanField( True, (59, 696), "C", "4")) if over_a_year: fields.append(BooleanField( True, (143, 486), "C", "5")) if over_a_year_explanation: fields.append( Field( over_a_year_explanation, (59, 434), 10, False, "C", "5")) else: fields.append(BooleanField( True, (59, 486), "C", "5")) if committed_crime: fields.append(BooleanField( True, (143, 252), "C", "6")) if committed_crime_explanation: fields.append( Field( committed_crime_explanation, (59, 188), 10, False, "C", "6")) else: fields.append(BooleanField( True, (59, 252), "C", "6")) Page.__init__(self, fields, "resources/i-589-page-8.pdf")
def __init__(self, a_number: Optional[str], name: str, date: str, child_1: Optional[ChildFields], child_2: Optional[ChildFields]): fields = [] if a_number: fields.append(Field(a_number, (40, 695), 10, False, "", "")) fields.append(Field(date, (310, 695), 10, False, "", "")) fields.append(Field(name, (40, 665), 10, False, "", "")) if child_1: fields.append( Field(child_1.a_number, (40, 562), 10, False, "", "1")) fields.append( Field(child_1.passport_number, (202, 562), 10, False, "", "2")) fields.append( Field(child_1.marital_status.value, (317, 562), 10, False, "", "3")) fields.append(Field(child_1.ssn, (454, 562), 10, False, "", "4")) fields.append( Field(child_1.last_name, (40, 532), 10, False, "", "5")) fields.append( Field(child_1.first_name, (197, 532), 10, False, "", "6")) fields.append( Field(child_1.middle_name, (317, 532), 10, False, "", "7")) fields.append( Field(child_1.date_of_birth, (454, 532), 10, False, "", "8")) fields.append( Field("%s, %s" % (child_1.city_birth, child_1.country_birth), (40, 502), 10, False, "", "9")) fields.append( Field(child_1.nationality, (197, 502), 10, False, "", "10")) fields.append( Field(child_1.race_ethnic_tribal, (317, 502), 10, False, "", "11")) fields.append(child_1_gender_fields[child_1.gender]) if child_1.in_us: fields.append(BooleanField(True, (154, 486), "", "13")) fields.append( Field(child_1.last_entry.place, (40, 449), 10, False, "", "14")) fields.append( Field(child_1.last_entry.date, (197, 449), 10, False, "", "15")) fields.append( Field(child_1.i_94, (317, 449), 10, False, "", "16")) fields.append( Field(child_1.last_entry.status, (454, 449), 10, False, "", "17")) fields.append( Field(child_1.current_status, (40, 414), 10, False, "", "18")) fields.append( Field(child_1.last_entry.expiration_date, (220, 414), 10, False, "", "19")) if child_1.in_immigration_court: fields.append(BooleanField(True, (397, 419), "", "20")) else: fields.append(BooleanField(True, (455, 419), "", "20")) if child_1.included_in_application: fields.append(BooleanField(True, (52, 384), "", "21")) else: fields.append(BooleanField(True, (52, 366), "", "21")) else: fields.append(BooleanField(True, (298, 486), "", "13")) fields.append( Field(child_1.location, (398, 486), 10, False, "", "13")) if child_2: fields.append( Field(child_2.a_number, (40, 329), 10, False, "", "1")) fields.append( Field(child_2.passport_number, (202, 329), 10, False, "", "2")) fields.append( Field(child_2.marital_status.value, (317, 329), 10, False, "", "3")) fields.append(Field(child_2.ssn, (454, 329), 10, False, "", "4")) fields.append( Field(child_2.last_name, (40, 299), 10, False, "", "5")) fields.append( Field(child_2.first_name, (197, 299), 10, False, "", "6")) fields.append( Field(child_2.middle_name, (317, 299), 10, False, "", "7")) fields.append( Field(child_2.date_of_birth, (454, 299), 10, False, "", "8")) fields.append( Field("%s, %s" % (child_2.city_birth, child_2.country_birth), (40, 269), 10, False, "", "9")) fields.append( Field(child_2.nationality, (197, 269), 10, False, "", "10")) fields.append( Field(child_2.race_ethnic_tribal, (317, 269), 10, False, "", "11")) fields.append(child_2_gender_fields[child_2.gender]) if child_2.in_us: fields.append(BooleanField(True, (155, 252), "", "13")) fields.append( Field(child_2.last_entry.place, (40, 216), 10, False, "", "14")) fields.append( Field(child_2.last_entry.date, (197, 216), 10, False, "", "15")) fields.append( Field(child_2.i_94, (317, 216), 10, False, "", "16")) fields.append( Field(child_2.last_entry.status, (454, 216), 10, False, "", "17")) fields.append( Field(child_2.current_status, (40, 181), 10, False, "", "18")) fields.append( Field(child_2.last_entry.expiration_date, (220, 181), 10, False, "", "19")) if child_2.in_immigration_court: fields.append(BooleanField(True, (397, 186), "", "20")) else: fields.append(BooleanField(True, (455, 186), "", "20")) if child_2.included_in_application: fields.append(BooleanField(True, (52, 151), "", "21")) else: fields.append(BooleanField(True, (52, 133), "", "21")) else: fields.append(BooleanField(True, (299, 252), "", "13")) fields.append( Field(child_2.location, (398, 253), 10, False, "", "13")) Page.__init__(self, fields, "resources/i-589-page-11.pdf")
def __init__(self, apply_cat: bool, a_number: str, ssn: str, uscis_number: str, first_name: str, middle_name: str, last_name: str, other_names: List[str], res_st_number_and_name: str, res_apt_number: str, res_city: str, res_state: str, res_zipcode: str, res_area_code: str, res_phone_number: str, in_care_of: str, mail_area_code: str, mail_phone_number: str, mail_st_number_and_name: str, mail_apt_number: str, mail_city: str, mail_state: str, mail_zipcode: str, gender: Gender, marital_status: MaritalStatus, date_of_birth: str, city_birth: str, country_birth: str, present_nationality: str, birth_nationality: str, race_ethnic_tribal: str, religion: str, immigration_court_status: ImmigrationCourtStatus, last_left_country: str, i_94: str, most_recent_us_entry: UsEntry, passport_country: str, passport_expiration: str, native_language: str, english_fluency: bool, other_languages: List[str], passport_number: Optional[str] = None, travel_doc_number: Optional[str] = None, us_entry_2: Optional[UsEntry] = None, us_entry_3: Optional[UsEntry] = None): fields = [] fields.append(BooleanField(apply_cat, (76, 672), "", "")) fields.append(Field(a_number, (40, 625), 10, False, "A.I.", "1")) fields.append(Field(ssn, (237, 625), 10, False, "A.I.", "2")) fields.append(Field(uscis_number, (388, 625), 10, False, "A.I.", "3")) fields.append(Field(last_name, (40, 595), 10, False, "A.I.", "4")) fields.append(Field(first_name, (280, 595), 10, False, "A.I.", "5")) fields.append(Field(middle_name, (441, 595), 10, False, "A.I.", "6")) fields.append( Field(", ".join(other_names), (40, 565), 10, False, "A.I.", "7")) fields.append( Field(res_st_number_and_name, (40, 517), 10, False, "A.I.", "8")) fields.append(Field(res_apt_number, (405, 517), 10, False, "A.I.", "8")) fields.append(Field(res_city, (40, 487), 10, False, "A.I.", "8")) fields.append(Field(res_state, (220, 487), 10, False, "A.I.", "8")) fields.append(Field(res_zipcode, (352, 487), 10, False, "A.I.", "8")) fields.append(Field(res_area_code, (455, 487), 10, False, "A.I.", "8")) fields.append( Field(res_phone_number, (490, 487), 10, False, "A.I.", "8")) fields.append(Field(in_care_of, (40, 439), 10, False, "A.I.", "9")) fields.append( Field(mail_phone_number, (412, 439), 10, False, "A.I.", "9")) fields.append( Field(mail_phone_number, (447, 439), 10, False, "A.I.", "9")) fields.append( Field(mail_st_number_and_name, (40, 409), 10, False, "A.I.", "9")) fields.append( Field(mail_apt_number, (405, 409), 10, False, "A.I.", "9")) fields.append(Field(mail_city, (40, 379), 10, False, "A.I.", "9")) fields.append(Field(mail_state, (220, 379), 10, False, "A.I.", "9")) fields.append( Field(mail_apt_number, (405, 379), 10, False, "A.I.", "9")) fields.append(gender_fields[gender]) fields.append(marital_status_fields[marital_status]) fields.append(Field(date_of_birth, (40, 329), 10, False, "A.I.", "12")) fields.append( Field("%s, %s" % (city_birth, country_birth), (203, 329), 10, False, "A.I.", "13")) fields.append( Field(present_nationality, (40, 299), 10, False, "A.I.", "14")) fields.append( Field(birth_nationality, (203, 299), 10, False, "A.I.", "15")) fields.append( Field(race_ethnic_tribal, (347, 299), 10, False, "A.I.", "16")) fields.append(Field(religion, (477, 299), 10, False, "A.I.", "17")) fields.append(immigration_court_fields[immigration_court_status]) fields.append( Field(last_left_country, (260, 240), 10, False, "A.I.", "19")) fields.append(Field(i_94, (493, 240), 10, False, "A.I.", "19")) fields.append( Field(most_recent_us_entry.date, (72, 200), 10, False, "A.I.", "19")) fields.append( Field(most_recent_us_entry.place, (180, 200), 10, False, "A.I.", "19")) fields.append( Field(most_recent_us_entry.status, (325, 200), 10, False, "A.I.", "19")) fields.append( Field(most_recent_us_entry.expiration_date, (493, 200), 10, False, "A.I.", "19")) if us_entry_2: fields.append( Field(us_entry_2.date, (72, 182), 10, False, "A.I.", "19")) fields.append( Field(us_entry_2.place, (180, 182), 10, False, "A.I.", "19")) fields.append( Field(us_entry_2.status, (325, 182), 10, False, "A.I.", "19")) if us_entry_3: fields.append( Field(us_entry_3.date, (72, 164), 10, False, "A.I.", "19")) fields.append( Field(us_entry_3.place, (180, 164), 10, False, "A.I.", "19")) fields.append( Field(us_entry_3.status, (325, 164), 10, False, "A.I.", "19")) fields.append( Field(passport_country, (40, 125), 10, False, "A.I.", "20")) if passport_number: fields.append( Field(passport_number, (323, 145), 10, False, "A.I.", "21")) if travel_doc_number: fields.append( Field(travel_doc_number, (341, 125), 10, False, "A.I.", "21")) fields.append( Field(passport_expiration, (467, 125), 10, False, "A.I.", "22")) fields.append(Field(native_language, (40, 95), 10, False, "A.I.", "23")) if english_fluency: fields.append(BooleanField(True, (293, 96), "A.I.", "24")) else: fields.append(BooleanField(True, (341, 96), "A.I.", "24")) fields.append( Field(", ".join(other_languages), (395, 95), 10, False, "A.I.", "25")) Page.__init__(self, fields, "resources/i-589-page-1.pdf")
def __init__(self, last_address: AddressFields, fear_address: Optional[AddressFields], prev_address_1: Optional[AddressFields], prev_address_2: Optional[AddressFields], prev_address_3: Optional[AddressFields], prev_address_4: Optional[AddressFields], prev_address_5: Optional[AddressFields], school_1: Optional[SchoolFields], school_2: Optional[SchoolFields], school_3: Optional[SchoolFields], school_4: Optional[SchoolFields], employer_1: Optional[EmployerFields], employer_2: Optional[EmployerFields], employer_3: Optional[EmployerFields], mother: RelativeFields, father: RelativeFields, sibling_1: Optional[RelativeFields], sibling_2: Optional[RelativeFields], sibling_3: Optional[RelativeFields], sibling_4: Optional[RelativeFields] ): fields = [] fields.append(Field( "%s %s" % (last_address.house_number, last_address.street), (40, 648), 10, False, "A.III.", "1")) fields.append(Field( last_address.city, (173, 648), 10, False, "A.III.", "1")) fields.append(Field( last_address.state, (270, 648), 10, False, "A.III.", "1")) fields.append(Field( last_address.country, (389, 648), 10, False, "A.III.", "1")) fields.append(Field( last_address.start_date, (475, 648), 10, False, "A.III.", "1")) fields.append(Field( last_address.end_date, (530, 648), 10, False, "A.III.", "1")) if fear_address: fields.append(Field( "%s %s" % (fear_address.house_number, fear_address.street), (40, 630), 10, False, "A.III.", "1")) fields.append(Field( fear_address.city, (173, 630), 10, False, "A.III.", "1")) fields.append(Field( fear_address.state, (270, 630), 10, False, "A.III.", "1")) fields.append(Field( fear_address.country, (389, 630), 10, False, "A.III.", "1")) fields.append(Field( fear_address.start_date, (475, 630), 10, False, "A.III.", "1")) fields.append(Field( fear_address.end_date, (530, 630), 10, False, "A.III.", "1")) if prev_address_1: fields.append(Field( "%s %s" % (prev_address_1.house_number, prev_address_1.street), (40, 552), 10, False, "A.III.", "2")) fields.append(Field( prev_address_1.city, (173, 552), 10, False, "A.III.", "2")) fields.append(Field( prev_address_1.state, (270, 552), 10, False, "A.III.", "2")) fields.append(Field( prev_address_1.country, (389, 552), 10, False, "A.III.", "2")) fields.append(Field( prev_address_1.start_date, (475, 552), 10, False, "A.III.", "2")) fields.append(Field( prev_address_1.end_date, (530, 552), 10, False, "A.III.", "2")) if prev_address_2: fields.append(Field( "%s %s" % (prev_address_2.house_number, prev_address_2.street), (40, 534), 10, False, "A.III.", "2")) fields.append(Field( prev_address_2.city, (173, 534), 10, False, "A.III.", "2")) fields.append(Field( prev_address_2.state, (270, 534), 10, False, "A.III.", "2")) fields.append(Field( prev_address_2.country, (389, 534), 10, False, "A.III.", "2")) fields.append(Field( prev_address_2.start_date, (475, 534), 10, False, "A.III.", "2")) fields.append(Field( prev_address_2.end_date, (530, 534), 10, False, "A.III.", "2")) if prev_address_3: fields.append(Field( "%s %s" % (prev_address_3.house_number, prev_address_3.street), (40, 516), 10, False, "A.III.", "2")) fields.append(Field( prev_address_3.city, (173, 516), 10, False, "A.III.", "2")) fields.append(Field( prev_address_3.state, (270, 516), 10, False, "A.III.", "2")) fields.append(Field( prev_address_3.country, (389, 516), 10, False, "A.III.", "2")) fields.append(Field( prev_address_3.start_date, (475, 516), 10, False, "A.III.", "2")) fields.append(Field( prev_address_3.end_date, (530, 516), 10, False, "A.III.", "2")) if prev_address_4: fields.append(Field( "%s %s" % (prev_address_4.house_number, prev_address_4.street), (40, 498), 10, False, "A.III.", "2")) fields.append(Field( prev_address_4.city, (173, 498), 10, False, "A.III.", "2")) fields.append(Field( prev_address_4.state, (270, 498), 10, False, "A.III.", "2")) fields.append(Field( prev_address_4.country, (389, 498), 10, False, "A.III.", "2")) fields.append(Field( prev_address_4.start_date, (475, 498), 10, False, "A.III.", "2")) fields.append(Field( prev_address_4.end_date, (530, 498), 10, False, "A.III.", "2")) if prev_address_5: fields.append(Field( "%s %s" % (prev_address_5.house_number, prev_address_5.street), (40, 480), 10, False, "A.III.", "2")) fields.append(Field( prev_address_5.city, (173, 480), 10, False, "A.III.", "2")) fields.append(Field( prev_address_5.state, (270, 480), 10, False, "A.III.", "2")) fields.append(Field( prev_address_5.country, (389, 480), 10, False, "A.III.", "2")) fields.append(Field( prev_address_5.start_date, (475, 480), 10, False, "A.III.", "2")) fields.append(Field( prev_address_5.end_date, (530, 480), 10, False, "A.III.", "2")) if school_1: school_1.add_fields(fields, (40, 402), (203, 402), (329, 402), (475, 402), (530, 402)) if school_2: school_2.add_fields(fields, (40, 384), (203, 384), (329, 384), (475, 384), (530, 384)) if school_3: school_3.add_fields(fields, (40, 366), (203, 366), (329, 366), (475, 366), (530, 366)) if school_4: school_4.add_fields(fields, (40, 348), (203, 348), (329, 348), (475, 348), (530, 348)) if employer_1: employer_1.add_fields(fields, (40, 270), (316, 270), (475, 270), (530, 270)) if employer_2: employer_2.add_fields(fields, (40, 252), (316, 252), (475, 252), (530, 252)) if employer_3: employer_3.add_fields(fields, (40, 234), (316, 234), (475, 234), (530, 234)) mother.add_fields(fields, (70, 162), (203, 162), (450, 162), (401, 162)) father.add_fields(fields, (70, 144), (203, 144), (450, 144), (401, 144)) if sibling_1: sibling_1.add_fields(fields, (70, 126), (203, 126), (450, 126), (401, 126)) if sibling_2: sibling_2.add_fields(fields, (70, 108), (203, 108), (450, 108), (401, 108)) if sibling_3: sibling_3.add_fields(fields, (70, 90), (203, 90), (450, 90), (401, 90)) if sibling_4: sibling_4.add_fields(fields, (70, 72), (203, 72), (450, 72), (401, 72)) Page.__init__(self, fields, "resources/i-589-page-4.pdf")
def __init__(self, child_1: Optional[ChildFields], child_2: Optional[ChildFields], child_3: Optional[ChildFields]): fields = [] if child_1: fields.append( Field(child_1.a_number, (40, 712), 10, False, "A.II.", "1")) fields.append( Field(child_1.passport_number, (202, 712), 10, False, "A.II.", "2")) fields.append( Field(child_1.marital_status.value, (317, 712), 10, False, "A.II.", "3")) fields.append( Field(child_1.ssn, (454, 712), 10, False, "A.II.", "4")) fields.append( Field(child_1.last_name, (40, 682), 10, False, "A.II.", "5")) fields.append( Field(child_1.first_name, (197, 682), 10, False, "A.II.", "6")) fields.append( Field(child_1.middle_name, (317, 682), 10, False, "A.II.", "7")) fields.append( Field(child_1.date_of_birth, (454, 682), 10, False, "A.II.", "8")) fields.append( Field("%s, %s" % (child_1.city_birth, child_1.country_birth), (40, 652), 10, False, "A.II.", "9")) fields.append( Field(child_1.nationality, (197, 652), 10, False, "A.II.", "10")) fields.append( Field(child_1.race_ethnic_tribal, (317, 652), 10, False, "A.II.", "11")) fields.append(child_1_gender_fields[child_1.gender]) if child_1.in_us: fields.append(BooleanField(True, (154, 636), "A.II.", "13")) fields.append( Field(child_1.last_entry.place, (40, 599), 10, False, "A.II.", "14")) fields.append( Field(child_1.last_entry.date, (197, 599), 10, False, "A.II.", "15")) fields.append( Field(child_1.i_94, (317, 599), 10, False, "A.II.", "16")) fields.append( Field(child_1.last_entry.status, (454, 599), 10, False, "A.II.", "17")) fields.append( Field(child_1.current_status, (40, 564), 10, False, "A.II.", "18")) fields.append( Field(child_1.last_entry.expiration_date, (220, 564), 10, False, "A.II.", "19")) if child_1.in_immigration_court: fields.append(BooleanField(True, (397, 569), "A.II.", "20")) else: fields.append(BooleanField(True, (455, 569), "A.II.", "20")) if child_1.included_in_application: fields.append(BooleanField(True, (52, 534), "A.II.", "21")) else: fields.append(BooleanField(True, (52, 516), "A.II.", "21")) else: fields.append(BooleanField(True, (294, 636), "A.II.", "13")) fields.append( Field(child_1.location, (398, 636), 10, False, "A.II.", "13")) if child_2: fields.append( Field(child_2.a_number, (40, 479), 10, False, "A.II.", "1")) fields.append( Field(child_2.passport_number, (202, 479), 10, False, "A.II.", "2")) fields.append( Field(child_2.marital_status.value, (317, 479), 10, False, "A.II.", "3")) fields.append( Field(child_2.ssn, (454, 479), 10, False, "A.II.", "4")) fields.append( Field(child_2.last_name, (40, 449), 10, False, "A.II.", "5")) fields.append( Field(child_2.first_name, (197, 449), 10, False, "A.II.", "6")) fields.append( Field(child_2.middle_name, (317, 449), 10, False, "A.II.", "7")) fields.append( Field(child_2.date_of_birth, (454, 449), 10, False, "A.II.", "8")) fields.append( Field("%s, %s" % (child_2.city_birth, child_2.country_birth), (40, 419), 10, False, "A.II.", "9")) fields.append( Field(child_2.nationality, (197, 419), 10, False, "A.II.", "10")) fields.append( Field(child_2.race_ethnic_tribal, (317, 419), 10, False, "A.II.", "11")) fields.append(child_2_gender_fields[child_2.gender]) if child_2.in_us: fields.append(BooleanField(True, (154, 403), "A.II.", "13")) fields.append( Field(child_2.last_entry.place, (40, 366), 10, False, "A.II.", "14")) fields.append( Field(child_2.last_entry.date, (197, 366), 10, False, "A.II.", "15")) fields.append( Field(child_2.i_94, (317, 366), 10, False, "A.II.", "16")) fields.append( Field(child_2.last_entry.status, (454, 366), 10, False, "A.II.", "17")) fields.append( Field(child_2.current_status, (40, 331), 10, False, "A.II.", "18")) fields.append( Field(child_2.last_entry.expiration_date, (220, 331), 10, False, "A.II.", "19")) if child_2.in_immigration_court: fields.append(BooleanField(True, (397, 333), "A.II.", "20")) else: fields.append(BooleanField(True, (455, 333), "A.II.", "20")) if child_2.included_in_application: fields.append(BooleanField(True, (52, 301), "A.II.", "21")) else: fields.append(BooleanField(True, (52, 282), "A.II.", "21")) else: fields.append(BooleanField(True, (294, 403), "A.II.", "13")) fields.append( Field(child_2.location, (398, 403), 10, False, "A.II.", "13")) if child_3: fields.append( Field(child_3.a_number, (40, 244), 10, False, "A.II.", "1")) fields.append( Field(child_3.passport_number, (202, 244), 10, False, "A.II.", "2")) fields.append( Field(child_3.marital_status.value, (317, 244), 10, False, "A.II.", "3")) fields.append( Field(child_3.ssn, (454, 244), 10, False, "A.II.", "4")) fields.append( Field(child_3.last_name, (40, 214), 10, False, "A.II.", "5")) fields.append( Field(child_3.first_name, (197, 214), 10, False, "A.II.", "6")) fields.append( Field(child_3.middle_name, (317, 214), 10, False, "A.II.", "7")) fields.append( Field(child_3.date_of_birth, (454, 214), 10, False, "A.II.", "8")) fields.append( Field("%s, %s" % (child_3.city_birth, child_3.country_birth), (40, 184), 10, False, "A.II.", "9")) fields.append( Field(child_3.nationality, (197, 184), 10, False, "A.II.", "10")) fields.append( Field(child_3.race_ethnic_tribal, (317, 184), 10, False, "A.II.", "11")) fields.append(child_3_gender_fields[child_3.gender]) if child_3.in_us: fields.append(BooleanField(True, (155, 168), "A.II.", "13")) fields.append( Field(child_3.last_entry.place, (40, 131), 10, False, "A.II.", "14")) fields.append( Field(child_3.last_entry.date, (197, 131), 10, False, "A.II.", "15")) fields.append( Field(child_3.i_94, (317, 131), 10, False, "A.II.", "16")) fields.append( Field(child_3.last_entry.status, (454, 131), 10, False, "A.II.", "17")) fields.append( Field(child_3.current_status, (40, 96), 10, False, "A.II.", "18")) fields.append( Field(child_3.last_entry.expiration_date, (220, 96), 10, False, "A.II.", "19")) if child_3.in_immigration_court: fields.append(BooleanField(True, (397, 98), "A.II.", "20")) else: fields.append(BooleanField(True, (456, 98), "A.II.", "20")) if child_3.included_in_application: fields.append(BooleanField(True, (52, 66), "A.II.", "21")) else: fields.append(BooleanField(True, (52, 48), "A.II.", "21")) else: fields.append(BooleanField(True, (298, 168), "A.II.", "13")) fields.append( Field(child_3.location, (398, 168), 10, False, "A.II.", "13")) Page.__init__(self, fields, "resources/i-589-page-3.pdf")
def __init__(self, is_married: bool, spouse_a_number: str, spouse_passport_id: str, spouse_date_of_birth: str, spouse_ssn: str, spouse_last_name: str, spouse_first_name: str, spouse_middle_name: str, spouse_other_names: List[str], date_of_marriage: str, place_of_marriage: str, spouse_city_birth: str, spouse_country_birth: str, spouse_nationality: str, spouse_race_ethnic_tribal: str, spouse_gender: Gender, spouse_in_us: bool, spouse_location: Optional[str], spouse_last_entry: Optional[UsEntry], spouse_i94: str, spouse_current_status: str, spouse_in_immigration_court: bool, spouse_previous_arrival_date: str, spouse_included_in_application: bool, has_children: bool, num_children: Optional[int], child_1: Optional[ChildFields]): fields = [] fields.append(BooleanField(not is_married, (166, 708), "A.II.", "")) fields.append( Field(spouse_a_number, (40, 671), 10, False, "A.II.", "1")) fields.append( Field(spouse_passport_id, (203, 671), 10, False, "A.II.", "2")) fields.append( Field(spouse_date_of_birth, (333, 671), 10, False, "A.II.", "3")) fields.append(Field(spouse_ssn, (454, 671), 10, False, "A.II.", "4")) fields.append( Field(spouse_last_name, (40, 637), 10, False, "A.II.", "5")) fields.append( Field(spouse_first_name, (203, 637), 10, False, "A.II.", "6")) fields.append( Field(spouse_middle_name, (333, 637), 10, False, "A.II.", "7")) fields.append( Field(", ".join(spouse_other_names), (454, 637), 10, False, "A.II.", "8")) fields.append( Field(date_of_marriage, (40, 607), 10, False, "A.II.", "9")) fields.append( Field(place_of_marriage, (203, 607), 10, False, "A.II.", "10")) fields.append( Field("%s, %s" % (spouse_city_birth, spouse_country_birth), (377, 607), 10, False, "A.II.", "11")) fields.append( Field(spouse_nationality, (40, 577), 10, False, "A.II.", "12")) fields.append( Field(spouse_race_ethnic_tribal, (245, 577), 10, False, "A.II.", "13")) fields.append(spouse_gender_fields[spouse_gender]) if spouse_in_us: fields.append(BooleanField(True, (59, 546), "A.II.", "15")) else: fields.append(BooleanField(True, (203, 546), "A.II.", "15")) if spouse_location: fields.append( Field(spouse_location, (305, 547), 10, False, "A.II.", "15")) if spouse_in_us: fields.append( Field(spouse_last_entry.place, (40, 510), 10, False, "A.II.", "16")) fields.append( Field(spouse_last_entry.date, (172, 510), 10, False, "A.II.", "17")) fields.append( Field(spouse_i94, (311, 510), 10, False, "A.II.", "18")) fields.append( Field(spouse_last_entry.status, (439, 510), 10, False, "A.II.", "19")) fields.append( Field(spouse_current_status, (40, 474), 10, False, "A.II.", "20")) fields.append( Field(spouse_last_entry.expiration_date, (155, 474), 10, False, "A.II.", "21")) if spouse_in_immigration_court: fields.append(BooleanField(True, (325, 474), "A.II.", "22")) else: fields.append(BooleanField(True, (371, 474), "A.II.", "22")) fields.append( Field(spouse_previous_arrival_date, (439, 474), 10, False, "A.II.", "23")) if spouse_included_in_application: fields.append(BooleanField(True, (52, 444), "A.II.", "24")) else: fields.append(BooleanField(True, (52, 426), "A.II.", "24")) if has_children: fields.append(BooleanField(True, (40, 372), "A.II.", "25")) fields.append( Field(str(num_children), (250, 372), 10, False, "A.II.", "23")) else: fields.append(BooleanField(True, (40, 390), "A.II.", "25")) if child_1: fields.append( Field(child_1.a_number, (40, 310), 10, False, "A.II.", "1")) fields.append( Field(child_1.passport_number, (197, 310), 10, False, "A.II.", "2")) fields.append( Field(child_1.marital_status.value, (317, 310), 10, False, "A.II.", "3")) fields.append( Field(child_1.ssn, (454, 310), 10, False, "A.II.", "4")) fields.append( Field(child_1.last_name, (40, 280), 10, False, "A.II.", "5")) fields.append( Field(child_1.first_name, (197, 280), 10, False, "A.II.", "6")) fields.append( Field(child_1.middle_name, (317, 280), 10, False, "A.II.", "7")) fields.append( Field(child_1.date_of_birth, (454, 280), 10, False, "A.II.", "8")) fields.append( Field("%s, %s" % (child_1.city_birth, child_1.country_birth), (40, 250), 10, False, "A.II.", "9")) fields.append( Field(child_1.nationality, (197, 250), 10, False, "A.II.", "10")) fields.append( Field(child_1.race_ethnic_tribal, (317, 250), 10, False, "A.II.", "11")) fields.append(child_1_gender_fields[child_1.gender]) if child_1.in_us: fields.append(BooleanField(True, (155, 234), "A.II.", "13")) fields.append( Field(child_1.last_entry.place, (40, 197), 10, False, "A.II.", "14")) fields.append( Field(child_1.last_entry.date, (197, 197), 10, False, "A.II.", "15")) fields.append( Field(child_1.i_94, (317, 197), 10, False, "A.II.", "16")) fields.append( Field(child_1.last_entry.status, (454, 197), 10, False, "A.II.", "17")) fields.append( Field(child_1.current_status, (40, 162), 10, False, "A.II.", "18")) fields.append( Field(child_1.last_entry.expiration_date, (220, 162), 10, False, "A.II.", "19")) if child_1.in_immigration_court: fields.append(BooleanField(True, (397, 167), "A.II.", "20")) else: fields.append(BooleanField(True, (455, 167), "A.II.", "20")) if child_1.included_in_application: fields.append(BooleanField(True, (52, 132), "A.II.", "21")) else: fields.append(BooleanField(True, (52, 114), "A.II.", "21")) else: fields.append(BooleanField(True, (299, 234), "A.II.", "13")) fields.append( Field(child_1.location, (398, 234), 10, False, "A.II.", "13")) Page.__init__(self, fields, "resources/i-589-page-2.pdf")
from form import Field, Page, Form pages = [ Page(fields=[Field("hhhihihihhihhi", (50, 50), 50, False, "", "")], filename="resources/i-589-page-" + str(i) + ".pdf") for i in range(1, 13) ] form = Form(pages) output = form.assemble() with open("i-589-test.pdf", 'wb') as out: output.write(out)