diff --git a/backend/core/scripts/script-data/HOME2024.ts b/backend/core/scripts/script-data/HOME2024.ts new file mode 100644 index 0000000000..8aec7f08b0 --- /dev/null +++ b/backend/core/scripts/script-data/HOME2024.ts @@ -0,0 +1,169 @@ +import { AmiChartCreateDto } from "../../src/ami-charts/dto/ami-chart.dto" +import { BaseEntity } from "typeorm" + +// THIS FILE WAS AUTOMATICALLY GENERATED FROM HOME2024.txt. +export const ami: Omit = { + name: "HOME 2024", + items: [ + { + percentOfAmi: 30, + householdSize: 1, + income: 20150, + }, + { + percentOfAmi: 30, + householdSize: 2, + income: 23000, + }, + { + percentOfAmi: 30, + householdSize: 3, + income: 25900, + }, + { + percentOfAmi: 30, + householdSize: 4, + income: 28750, + }, + { + percentOfAmi: 30, + householdSize: 5, + income: 31050, + }, + { + percentOfAmi: 30, + householdSize: 6, + income: 33350, + }, + { + percentOfAmi: 30, + householdSize: 7, + income: 35650, + }, + { + percentOfAmi: 30, + householdSize: 8, + income: 37950, + }, + { + percentOfAmi: 50, + householdSize: 1, + income: 33600, + }, + { + percentOfAmi: 50, + householdSize: 2, + income: 38400, + }, + { + percentOfAmi: 50, + householdSize: 3, + income: 43200, + }, + { + percentOfAmi: 50, + householdSize: 4, + income: 47950, + }, + { + percentOfAmi: 50, + householdSize: 5, + income: 51800, + }, + { + percentOfAmi: 50, + householdSize: 6, + income: 55650, + }, + { + percentOfAmi: 50, + householdSize: 7, + income: 59500, + }, + { + percentOfAmi: 50, + householdSize: 8, + income: 63300, + }, + { + percentOfAmi: 60, + householdSize: 1, + income: 40320, + }, + { + percentOfAmi: 60, + householdSize: 2, + income: 46080, + }, + { + percentOfAmi: 60, + householdSize: 3, + income: 51840, + }, + { + percentOfAmi: 60, + householdSize: 4, + income: 57540, + }, + { + percentOfAmi: 60, + householdSize: 5, + income: 62160, + }, + { + percentOfAmi: 60, + householdSize: 6, + income: 66780, + }, + { + percentOfAmi: 60, + householdSize: 7, + income: 71400, + }, + { + percentOfAmi: 60, + householdSize: 8, + income: 75960, + }, + { + percentOfAmi: 80, + householdSize: 1, + income: 53700, + }, + { + percentOfAmi: 80, + householdSize: 2, + income: 61400, + }, + { + percentOfAmi: 80, + householdSize: 3, + income: 69050, + }, + { + percentOfAmi: 80, + householdSize: 4, + income: 76700, + }, + { + percentOfAmi: 80, + householdSize: 5, + income: 82850, + }, + { + percentOfAmi: 80, + householdSize: 6, + income: 89000, + }, + { + percentOfAmi: 80, + householdSize: 7, + income: 95150, + }, + { + percentOfAmi: 80, + householdSize: 8, + income: 101250, + }, + ], +} diff --git a/backend/core/scripts/script-data/HOME2024.txt b/backend/core/scripts/script-data/HOME2024.txt new file mode 100644 index 0000000000..d2f93d1b9e --- /dev/null +++ b/backend/core/scripts/script-data/HOME2024.txt @@ -0,0 +1,4 @@ +30 20150 23000 25900 28750 31050 33350 35650 37950 +50 33600 38400 43200 47950 51800 55650 59500 63300 +60 40320 46080 51840 57540 62160 66780 71400 75960 +80 53700 61400 69050 76700 82850 89000 95150 101250 diff --git a/backend/core/src/migration/1732654757266-home-ami-chart.ts b/backend/core/src/migration/1732654757266-home-ami-chart.ts new file mode 100644 index 0000000000..59fffb7c32 --- /dev/null +++ b/backend/core/src/migration/1732654757266-home-ami-chart.ts @@ -0,0 +1,19 @@ +import { MigrationInterface, QueryRunner } from "typeorm" +import { ami } from "../../scripts/script-data/HOME2024" + +export class homeAmiChart1732654757266 implements MigrationInterface { + name = "homeAmiChart1732654757266" + + public async up(queryRunner: QueryRunner): Promise { + const [{ id: juris }] = await queryRunner.query( + `SELECT id FROM jurisdictions WHERE name = 'Detroit'` + ) + await queryRunner.query(` + INSERT INTO ami_chart + (name, items, jurisdiction_id) + VALUES ('${ami.name}', '${JSON.stringify(ami.items)}', '${juris}') + `) + } + + public async down(queryRunner: QueryRunner): Promise {} +}