Coverage for apps/client_needs/management/commands/seed_document_classifications.py: 100%

11 statements  

« prev     ^ index     » next       coverage.py v7.17.0, created at 2026-11-04 17:24 +0000

1"""Seed the 152 built-in document classifications. Idempotent: safe to re-run. 

2 

3Ported from the deleted ``domain/document_classifications.py`` 

4(add-document-classification-db-config) — same codes, names, and categories, 

5transcribed from the user-supplied ARIVE/Tireless document taxonomy. 

6""" 

7 

8from django.core.management.base import BaseCommand 

9from django.db import transaction 

10 

11from apps.client_needs.models import DocumentClassification 

12 

13# (code, name, category) 

14SEED_CLASSIFICATIONS = [ 

15 # Asset 

16 ("BANK_DEPOSIT_SLIP", "Bank Deposit Slip", "Asset"), 

17 ("BANK_STATEMENTS", "Bank Statements", "Asset"), 

18 ("EARNEST_MONEY_EMD_RECEIPT", "Earnest Money / EMD Receipt", "Asset"), 

19 ("GIFT_CHECK_COPY", "Gift Check Copy", "Asset"), 

20 ("GIFT_LETTER", "Gift Letter", "Asset"), 

21 ("INVESTMENT_ACCOUNT_STATEMENTS", "Investment Account Statements", "Asset"), 

22 ("IRA_401K_STATEMENTS", "IRA / 401K Statements", "Asset"), 

23 ("LIFE_INSURANCE_POLICY", "Life Insurance Policy", "Asset"), 

24 ("MISC_ASSET", "Misc Asset", "Asset"), 

25 ("PROOF_OF_LIQUIDATION", "Proof of Liquidation", "Asset"), 

26 ("TRUST_AGREEMENT", "Trust Agreement", "Asset"), 

27 ("TRUST_CERTIFICATION", "Trust Certification", "Asset"), 

28 ("VERIFICATION_OF_DEPOSIT_VOD_ASSET", "Verification of Deposit - VOD", "Asset"), 

29 ("VOA", "VOA", "Asset"), 

30 # Borrower Info 

31 ("CERTIFICATE_OF_ELIGIBILITY", "Certificate of Eligibility", "Borrower Info"), 

32 ("CERTIFICATE_OF_HOUSING_COUNSELING", "Certificate of Housing Counseling", "Borrower Info"), 

33 ("COURT_DOCUMENTS", "Court Documents", "Borrower Info"), 

34 ("DIVORCE_DECREE", "Divorce Decree", "Borrower Info"), 

35 ("DRIVERS_LICENSE", "Drivers License", "Borrower Info"), 

36 ("GOVERNMENT_ISSUED_ID", "Government Issued Id", "Borrower Info"), 

37 ("MISC_BORROWER_INFO", "Misc Borrower Info", "Borrower Info"), 

38 ("PASSPORT", "Passport", "Borrower Info"), 

39 ("POWER_OF_ATTORNEY", "Power of Attorney", "Borrower Info"), 

40 ("PROOF_OF_OCCUPANCY", "Proof of Occupancy", "Borrower Info"), 

41 ("RESIDENT_ALIEN_CARD", "Resident Alien Card", "Borrower Info"), 

42 ( 

43 "SOCIAL_SECURITY_ADMINISTRATION_SSA_89", 

44 "Social Security Administration - SSA-89", 

45 "Borrower Info", 

46 ), 

47 ("SOCIAL_SECURITY_CARD", "Social Security Card", "Borrower Info"), 

48 ("WORK_VISA_EAD_CARD", "Work Visa/EAD Card", "Borrower Info"), 

49 # Credit 

50 ("BANKRUPTCY_DISCHARGE_NOTICE", "Bankruptcy Discharge Notice", "Credit"), 

51 ("BANKRUPTCY_FILING", "Bankruptcy Filing", "Credit"), 

52 ("CREDIT_REPORT", "Credit Report", "Credit"), 

53 ("CREDIT_SUPPLEMENTS", "Credit Supplements", "Credit"), 

54 ("EVIDENCE_OF_PAYMENT", "Evidence of Payment", "Credit"), 

55 ("MISC_CREDIT", "Misc Credit", "Credit"), 

56 ("PAYMENT_HISTORY", "Payment History", "Credit"), 

57 ("SOFT_CREDIT_REPORT", "Soft Credit Report", "Credit"), 

58 ("STATEMENT_OF_ACCOUNT", "Statement of Account", "Credit"), 

59 ("VERIFICATION_OF_MORTGAGE", "Verification of Mortgage", "Credit"), 

60 ("VERIFICATION_OF_RENT", "Verification of Rent", "Credit"), 

61 # Disclosures 

62 ("1003_LOAN_APPLICATION_URLA", "1003 Loan Application - URLA", "Disclosures"), 

63 ("1003_LOAN_APPLICATION_URLA_ADDENDUM", "1003 Loan Application - URLA Addendum", "Disclosures"), 

64 ( 

65 "4506_C_REQUEST_FOR_TRANSCRIPT_OF_TAX_RETURN", 

66 "4506-C Request for Transcript of Tax Return", 

67 "Disclosures", 

68 ), 

69 ( 

70 "4506_T_REQUEST_FOR_TRANSCRIPT_OF_TAX_RETURNS", 

71 "4506-T Request for Transcript of Tax Returns", 

72 "Disclosures", 

73 ), 

74 ( 

75 "AFFILIATED_BUSINESS_ARRANGEMENT_DISCLOSURE_ABA", 

76 "Affiliated Business Arrangement Disclosure ABA", 

77 "Disclosures", 

78 ), 

79 ("ANTI_STEERING_DISCLOSURE", "Anti Steering Disclosure", "Disclosures"), 

80 ( 

81 "APPRAISAL_ORDER_AND_PAYMENT_AUTHORIZATION", 

82 "Appraisal Order & Payment Authorization", 

83 "Disclosures", 

84 ), 

85 ("APPRAISAL_REPORT_DISCLOSURE", "Appraisal Report Disclosure", "Disclosures"), 

86 ("BORROWER_CERT_AND_AUTH", "Borrower Cert & Auth", "Disclosures"), 

87 ("CHANGE_OF_CIRCUMSTANCE", "Change of Circumstance", "Disclosures"), 

88 ("CLOSING_DISCLOSURE_CD", "Closing Disclosure (CD)", "Disclosures"), 

89 ("CLOSING_DISCLOSURE_PACKAGE", "Closing Disclosure Package", "Disclosures"), 

90 ("CONDITIONAL_LOAN_APPROVAL", "Conditional Loan Approval", "Disclosures"), 

91 ("ECOA_NOTICE", "ECOA Notice", "Disclosures"), 

92 ("ECONSENT_AUTHORIZATION", "eConsent Authorization", "Disclosures"), 

93 ("ENERGY_EFFICIENT_MORTGAGES", "Energy-Efficient Mortgages", "Disclosures"), 

94 ("FHA_NOTICE_TO_HOMEOWNER", "FHA - Notice to Homeowner", "Disclosures"), 

95 ("FHA_92561_HOTEL_TRANSIENT_USE", "FHA 92561 Hotel Transient Use", "Disclosures"), 

96 ("FHA_AMENDATORY_STATEMENT", "FHA Amendatory Statement", "Disclosures"), 

97 ("FHA_APPRAISED_VALUE", "FHA Appraised Value", "Disclosures"), 

98 ("HAZARD_INS_AUTHORIZATION", "Hazard Ins Authorization", "Disclosures"), 

99 ("HOME_INSPECTION", "Home Inspection", "Disclosures"), 

100 ("HOME_LOAN_TOOLKIT", "Home Loan Toolkit", "Disclosures"), 

101 ("HUD_ADDENDUM_92900_A", "HUD Addendum 92900 A", "Disclosures"), 

102 ("HUD_VA_ADDENDUM_92900_A", "HUD/VA Addendum 92900 A", "Disclosures"), 

103 ("IDENTITY_DISCLOSURE", "Identity Disclosure", "Disclosures"), 

104 ("IMPORTANT_NOTICE_TO_HOMEBUYERS", "Important Notice to Homebuyers", "Disclosures"), 

105 ("INITIAL_DISCLOSURE_PACKAGE", "Initial Disclosure Package", "Disclosures"), 

106 ("INTENT_TO_PROCEED", "Intent to Proceed", "Disclosures"), 

107 ("LOAN_ESTIMATE_LE", "Loan Estimate (LE)", "Disclosures"), 

108 ( 

109 "LOAN_ORIGINATION_AGREEMENT_AND_FEE_DISCLOSURE", 

110 "Loan Origination Agreement & Fee Disclosure", 

111 "Disclosures", 

112 ), 

113 ("LOCK_IN_DISCLOSURE", "Lock-in Disclosure", "Disclosures"), 

114 ("MISC_DISCLOSURES", "Misc Disclosures", "Disclosures"), 

115 ("MORTGAGE_LOAN_ORIGINATION_AGREEMENT", "Mortgage Loan Origination Agreement", "Disclosures"), 

116 ("NET_TANGIBLE_BENEFIT", "Net Tangible Benefit", "Disclosures"), 

117 ("NOTICE_REGARDING_HOUSING_COUNSELING", "Notice Regarding Housing Counseling", "Disclosures"), 

118 ("PATRIOT_ACT_DISCLOSURE", "Patriot Act Disclosure", "Disclosures"), 

119 ("PRIVACY_NOTICE", "Privacy Notice", "Disclosures"), 

120 ("REQUEST_FOR_CERT_OF_VETERAN_STATUS", "Request for Cert of Veteran Status", "Disclosures"), 

121 ("SERVICING_DISCLOSURE_STATEMENT", "Servicing Disclosure Statement", "Disclosures"), 

122 ( 

123 "VA_26_1880_CERTIFICATE_OF_ELIGIBILITY", 

124 "VA 26-1880 - Certificate of Eligibility", 

125 "Disclosures", 

126 ), 

127 ( 

128 "VA_26_8937_VERIFICATION_OF_VA_BENEFITS", 

129 "VA 26-8937 Verification of VA Benefits", 

130 "Disclosures", 

131 ), 

132 ("VA_CHILD_CARE_STATEMENT", "VA Child Care Statement", "Disclosures"), 

133 ("VA_NEAREST_LIVING_RELATIVE", "VA Nearest Living Relative", "Disclosures"), 

134 ( 

135 "VA_26_1880_REQUEST_OF_CERT_ELIGIBILITY_VA_FHA", 

136 "VA 26-1880 - Request of Cert Eligibility VA/FHA", 

137 "Disclosures", 

138 ), 

139 ( 

140 "VERIFICATION_OF_DEPOSIT_VOD_DISCLOSURES", 

141 "Verification of Deposit VOD", 

142 "Disclosures", 

143 ), 

144 ("WET_SIGNATURE_PACKAGE", "Wet Signature Package", "Disclosures"), 

145 ( 

146 "YOUR_CREDIT_SCORE_AND_THE_PRICE_YOU_PAY_FOR_CREDIT", 

147 "Your Credit Score And The Price You Pay For Credit", 

148 "Disclosures", 

149 ), 

150 # Income/Employment 

151 ( 

152 "1040_INDIVIDUAL_FEDERAL_TAX_RETURN", 

153 "1040 Individual Federal Tax Return", 

154 "Income/Employment", 

155 ), 

156 ("1120_CORPORATE_TAX_RETURN", "1120 - Corporate Tax Return", "Income/Employment"), 

157 ("1120_S_S_CORPORATION_TAX_RETURN", "1120-S - S Corporation Tax Return", "Income/Employment"), 

158 ("1065_PARTNERSHIP_TAX_RETURN", "1065 - Partnership Tax Return", "Income/Employment"), 

159 ("1099_FORM", "1099 Form", "Income/Employment"), 

160 ("ALIMONY_INCOME_VERIFICATION", "Alimony Income Verification", "Income/Employment"), 

161 ("ARTICLES_OF_INCORPORATION", "Articles of Incorporation", "Income/Employment"), 

162 ( 

163 "BUSINESS_EXISTENCE_CPA_LTR_BUS_LIC", 

164 "Business Existence (CPA Ltr / Bus Lic)", 

165 "Income/Employment", 

166 ), 

167 ("CORPORATE_RESOLUTION", "Corporate Resolution", "Income/Employment"), 

168 ("DD_FORM_214", "DD Form 214", "Income/Employment"), 

169 ("DISABILITY_AWARD_LETTER", "Disability Award Letter", "Income/Employment"), 

170 ("DISABILITY_INCOME_VERIFICATION", "Disability Income Verification", "Income/Employment"), 

171 ("EMPLOYMENT_OFFER_LETTER", "Employment Offer Letter", "Income/Employment"), 

172 ("K_1_SCHEDULE_1065_1120S", "K-1 Schedule (1065/1120S)", "Income/Employment"), 

173 ( 

174 "MILITARY_LEAVE_AND_EARNING_STATEMENT_LES", 

175 "Military Leave and Earning Statement (LES)", 

176 "Income/Employment", 

177 ), 

178 ("MISC_INCOME_EMPLOYMENT", "Misc Income/Employment", "Income/Employment"), 

179 ("NOTE_INCOME_VERIFICATION", "Note Income Verification", "Income/Employment"), 

180 ("PAY_STUBS", "Pay Stubs", "Income/Employment"), 

181 ( 

182 "PROFIT_AND_LOSS_STATEMENT_BALANCE_SHEET", 

183 "Profit and Loss Statement-Balance Sheet", 

184 "Income/Employment", 

185 ), 

186 ("RENTAL_OR_LEASE_AGREEMENT", "Rental or Lease Agreement", "Income/Employment"), 

187 ("RETIREE_ACCOUNT_STATEMENT_RAS", "Retiree Account Statement RAS", "Income/Employment"), 

188 ("RETIREMENT_PENSION_AWARD_LETTER", "Retirement / Pension Award Letter", "Income/Employment"), 

189 ("SOCIAL_SECURITY_AWARD_LETTER", "Social Security Award Letter", "Income/Employment"), 

190 ("TRANSCRIPTS_OF_1099", "Transcripts of 1099", "Income/Employment"), 

191 ("TRANSCRIPTS_OF_TAX_RETURNS", "Transcripts of Tax Returns", "Income/Employment"), 

192 ("TRANSCRIPTS_OF_W2", "Transcripts of W2", "Income/Employment"), 

193 ("TRUST_FEDERAL_TAX_RETURN", "Trust Federal Tax Return", "Income/Employment"), 

194 ("UNSECURED_NOTE", "Unsecured Note", "Income/Employment"), 

195 ("VA_BENEFITS_AWARD_LETTER", "VA Benefits Award Letter", "Income/Employment"), 

196 ( 

197 "VA_DD_214_CERTIFICATE_OF_RELEASE_OR_DISCHARGE", 

198 "VA DD-214 - Certificate of Release or Discharge", 

199 "Income/Employment", 

200 ), 

201 ("VERIFICATION_OF_INCOME_VOI", "Verification of Income (VOI)", "Income/Employment"), 

202 ("VVOE", "VVOE", "Income/Employment"), 

203 ("W2_FORM", "W2 Form", "Income/Employment"), 

204 ("WVOE", "WVOE", "Income/Employment"), 

205 # Property 

206 ("ADDRESS_VERIFICATION_THROUGH_USPS_COM", "Address Verification through USPS.COM", "Property"), 

207 ("APPRAISAL_NOTICE_OF_VALUE", "Appraisal Notice of Value", "Property"), 

208 ("APPRAISAL_REPORT", "Appraisal Report", "Property"), 

209 ("APPRAISAL_REVIEW", "Appraisal Review", "Property"), 

210 ("APPRAISAL_SUPPLEMENTS", "Appraisal Supplements", "Property"), 

211 ("AVM", "AVM", "Property"), 

212 ("BUILDING_PERMITS", "Building Permits", "Property"), 

213 ("CLOSING_PROTECTION_LETTER_CPL", "Closing Protection Letter (CPL)", "Property"), 

214 ("FLOOD_CERTIFICATION", "Flood Certification", "Property"), 

215 ("FLOOD_INSURANCE_POLICY", "Flood Insurance Policy", "Property"), 

216 ("HOA_CERTIFICATION", "HOA Certification", "Property"), 

217 ("HOA_DUES_STATEMENT_WITH_CONTACT_INFO", "HOA Dues Statement with Contact Info", "Property"), 

218 ("HOMEOWNER_S_INSURANCE", "Homeowner's Insurance", "Property"), 

219 ("HOMEOWNER_S_INSURANCE_QUOTE", "Homeowner's Insurance Quote", "Property"), 

220 ( 

221 "MASTER_INSURANCE_POLICY_FOR_CONDOMINIUM", 

222 "Master Insurance Policy for Condominium", 

223 "Property", 

224 ), 

225 ("MISC_PROPERTY", "Misc Property", "Property"), 

226 ("MORTGAGE_NOTE", "Mortgage Note", "Property"), 

227 ("MORTGAGE_STATEMENT", "Mortgage Statement", "Property"), 

228 ("PACE_SOLAR_FINANCING_OR_LEASE", "PACE / Solar Financing or Lease", "Property"), 

229 ("PAYOFF_DEMANDS", "Payoff Demands", "Property"), 

230 ("PRELIM_REPORT", "Prelim Report", "Property"), 

231 ("PROPERTY_PROFILE", "Property Profile", "Property"), 

232 ("PROPERTY_SURVEY", "Property Survey", "Property"), 

233 ("PROPERTY_TAX_BILL", "Property Tax Bill", "Property"), 

234 ("PURCHASE_AGREEMENT", "Purchase Agreement", "Property"), 

235 ("SELLER_S_AUTHORIZATION", "Seller's Authorization", "Property"), 

236 ("SETTLEMENT_STATEMENT", "Settlement Statement", "Property"), 

237 ("TERMITE_COMPLETION", "Termite Completion", "Property"), 

238 ("TERMITE_REPORT", "Termite Report", "Property"), 

239 ("TITLE_SUPPLEMENTS", "Title Supplements", "Property"), 

240 ("WARRANTY_DEED", "Warranty Deed", "Property"), 

241] 

242 

243 

244class Command(BaseCommand): 

245 help = "Seed the 152 built-in document classifications. Idempotent: safe to re-run." 

246 

247 @transaction.atomic 

248 def handle(self, *args, **options): 

249 for code, name, category in SEED_CLASSIFICATIONS: 

250 DocumentClassification.objects.update_or_create( 

251 code=code, 

252 defaults={"name": name, "category": category, "system": True, "is_active": True}, 

253 ) 

254 self.stdout.write( 

255 self.style.SUCCESS(f"Seeded {len(SEED_CLASSIFICATIONS)} document classifications.") 

256 )