diff --git a/backend/core/scripts/generate-ami-chart.sh b/backend/core/scripts/generate-ami-chart.sh index 81cddf2925..9ffc3adb0a 100755 --- a/backend/core/scripts/generate-ami-chart.sh +++ b/backend/core/scripts/generate-ami-chart.sh @@ -28,7 +28,7 @@ OUTPUT_FILE="$DIRECTORY/$FILENAME.ts" echo "Generating $OUTPUT_FILE" cat << EOF > $OUTPUT_FILE -import { AmiChartCreateDto } from "../../../ami-charts/dto/ami-chart.dto" +import { AmiChartCreateDto } from "../../src/ami-charts/dto/ami-chart.dto" import { BaseEntity } from "typeorm" // THIS FILE WAS AUTOMATICALLY GENERATED FROM $FILE. diff --git a/backend/core/scripts/script-data/MSHDA2024.ts b/backend/core/scripts/script-data/MSHDA2024.ts new file mode 100644 index 0000000000..af01ae8fa4 --- /dev/null +++ b/backend/core/scripts/script-data/MSHDA2024.ts @@ -0,0 +1,649 @@ +import { AmiChartCreateDto } from "../../src/ami-charts/dto/ami-chart.dto" +import { BaseEntity } from "typeorm" + +// THIS FILE WAS AUTOMATICALLY GENERATED FROM MSHDA2024.txt. +export const ami: Omit = { + name: "MSHDA 2024", + items: [ + { + percentOfAmi: 20, + householdSize: 1, + income: 13440, + }, + { + percentOfAmi: 20, + householdSize: 2, + income: 15360, + }, + { + percentOfAmi: 20, + householdSize: 3, + income: 17280, + }, + { + percentOfAmi: 20, + householdSize: 4, + income: 19180, + }, + { + percentOfAmi: 20, + householdSize: 5, + income: 20720, + }, + { + percentOfAmi: 20, + householdSize: 6, + income: 22260, + }, + { + percentOfAmi: 20, + householdSize: 7, + income: 23800, + }, + { + percentOfAmi: 20, + householdSize: 8, + income: 25320, + }, + { + percentOfAmi: 25, + householdSize: 1, + income: 16800, + }, + { + percentOfAmi: 25, + householdSize: 2, + income: 19200, + }, + { + percentOfAmi: 25, + householdSize: 3, + income: 21600, + }, + { + percentOfAmi: 25, + householdSize: 4, + income: 23975, + }, + { + percentOfAmi: 25, + householdSize: 5, + income: 25900, + }, + { + percentOfAmi: 25, + householdSize: 6, + income: 27825, + }, + { + percentOfAmi: 25, + householdSize: 7, + income: 29750, + }, + { + percentOfAmi: 25, + householdSize: 8, + income: 31650, + }, + { + percentOfAmi: 30, + householdSize: 1, + income: 20160, + }, + { + percentOfAmi: 30, + householdSize: 2, + income: 23040, + }, + { + percentOfAmi: 30, + householdSize: 3, + income: 25920, + }, + { + percentOfAmi: 30, + householdSize: 4, + income: 28770, + }, + { + percentOfAmi: 30, + householdSize: 5, + income: 31808, + }, + { + percentOfAmi: 30, + householdSize: 6, + income: 33390, + }, + { + percentOfAmi: 30, + householdSize: 7, + income: 35700, + }, + { + percentOfAmi: 30, + householdSize: 8, + income: 37980, + }, + { + percentOfAmi: 35, + householdSize: 1, + income: 23520, + }, + { + percentOfAmi: 35, + householdSize: 2, + income: 26880, + }, + { + percentOfAmi: 35, + householdSize: 3, + income: 30240, + }, + { + percentOfAmi: 35, + householdSize: 4, + income: 33565, + }, + { + percentOfAmi: 35, + householdSize: 5, + income: 36260, + }, + { + percentOfAmi: 35, + householdSize: 6, + income: 38955, + }, + { + percentOfAmi: 35, + householdSize: 7, + income: 41650, + }, + { + percentOfAmi: 35, + householdSize: 8, + income: 44310, + }, + { + percentOfAmi: 40, + householdSize: 1, + income: 26880, + }, + { + percentOfAmi: 40, + householdSize: 2, + income: 30720, + }, + { + percentOfAmi: 40, + householdSize: 3, + income: 34560, + }, + { + percentOfAmi: 40, + householdSize: 4, + income: 38360, + }, + { + percentOfAmi: 40, + householdSize: 5, + income: 41440, + }, + { + percentOfAmi: 40, + householdSize: 6, + income: 44520, + }, + { + percentOfAmi: 40, + householdSize: 7, + income: 47600, + }, + { + percentOfAmi: 40, + householdSize: 8, + income: 50640, + }, + { + percentOfAmi: 45, + householdSize: 1, + income: 30240, + }, + { + percentOfAmi: 45, + householdSize: 2, + income: 34560, + }, + { + percentOfAmi: 45, + householdSize: 3, + income: 38880, + }, + { + percentOfAmi: 45, + householdSize: 4, + income: 43155, + }, + { + percentOfAmi: 45, + householdSize: 5, + income: 46620, + }, + { + percentOfAmi: 45, + householdSize: 6, + income: 50085, + }, + { + percentOfAmi: 45, + householdSize: 7, + income: 53550, + }, + { + percentOfAmi: 45, + householdSize: 8, + income: 56970, + }, + { + 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: 55, + householdSize: 1, + income: 36960, + }, + { + percentOfAmi: 55, + householdSize: 2, + income: 42240, + }, + { + percentOfAmi: 55, + householdSize: 3, + income: 47520, + }, + { + percentOfAmi: 55, + householdSize: 4, + income: 52740, + }, + { + percentOfAmi: 55, + householdSize: 5, + income: 62160, + }, + { + percentOfAmi: 55, + householdSize: 6, + income: 66780, + }, + { + percentOfAmi: 55, + householdSize: 7, + income: 71400, + }, + { + percentOfAmi: 55, + householdSize: 8, + income: 75960, + }, + { + 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: 70, + householdSize: 1, + income: 47040, + }, + { + percentOfAmi: 70, + householdSize: 2, + income: 53760, + }, + { + percentOfAmi: 70, + householdSize: 3, + income: 60480, + }, + { + percentOfAmi: 70, + householdSize: 4, + income: 67130, + }, + { + percentOfAmi: 70, + householdSize: 5, + income: 72520, + }, + { + percentOfAmi: 70, + householdSize: 6, + income: 77910, + }, + { + percentOfAmi: 70, + householdSize: 7, + income: 83300, + }, + { + percentOfAmi: 70, + householdSize: 8, + income: 88620, + }, + { + percentOfAmi: 80, + householdSize: 1, + income: 53760, + }, + { + percentOfAmi: 80, + householdSize: 2, + income: 61440, + }, + { + percentOfAmi: 80, + householdSize: 3, + income: 69120, + }, + { + percentOfAmi: 80, + householdSize: 4, + income: 76720, + }, + { + percentOfAmi: 80, + householdSize: 5, + income: 82880, + }, + { + percentOfAmi: 80, + householdSize: 6, + income: 89040, + }, + { + percentOfAmi: 80, + householdSize: 7, + income: 95200, + }, + { + percentOfAmi: 80, + householdSize: 8, + income: 101280, + }, + { + percentOfAmi: 100, + householdSize: 1, + income: 67200, + }, + { + percentOfAmi: 100, + householdSize: 2, + income: 76800, + }, + { + percentOfAmi: 100, + householdSize: 3, + income: 86400, + }, + { + percentOfAmi: 100, + householdSize: 4, + income: 95900, + }, + { + percentOfAmi: 100, + householdSize: 5, + income: 103600, + }, + { + percentOfAmi: 100, + householdSize: 6, + income: 111300, + }, + { + percentOfAmi: 100, + householdSize: 7, + income: 119000, + }, + { + percentOfAmi: 100, + householdSize: 8, + income: 126600, + }, + { + percentOfAmi: 120, + householdSize: 1, + income: 80640, + }, + { + percentOfAmi: 120, + householdSize: 2, + income: 92160, + }, + { + percentOfAmi: 120, + householdSize: 3, + income: 103680, + }, + { + percentOfAmi: 120, + householdSize: 4, + income: 115080, + }, + { + percentOfAmi: 120, + householdSize: 5, + income: 124320, + }, + { + percentOfAmi: 120, + householdSize: 6, + income: 133560, + }, + { + percentOfAmi: 120, + householdSize: 7, + income: 142800, + }, + { + percentOfAmi: 120, + householdSize: 8, + income: 151920, + }, + { + percentOfAmi: 125, + householdSize: 1, + income: 84000, + }, + { + percentOfAmi: 125, + householdSize: 2, + income: 96000, + }, + { + percentOfAmi: 125, + householdSize: 3, + income: 108000, + }, + { + percentOfAmi: 125, + householdSize: 4, + income: 119875, + }, + { + percentOfAmi: 125, + householdSize: 5, + income: 129500, + }, + { + percentOfAmi: 125, + householdSize: 6, + income: 139125, + }, + { + percentOfAmi: 125, + householdSize: 7, + income: 148750, + }, + { + percentOfAmi: 125, + householdSize: 8, + income: 158250, + }, + { + percentOfAmi: 140, + householdSize: 1, + income: 94080, + }, + { + percentOfAmi: 140, + householdSize: 2, + income: 107520, + }, + { + percentOfAmi: 140, + householdSize: 3, + income: 120960, + }, + { + percentOfAmi: 140, + householdSize: 4, + income: 134260, + }, + { + percentOfAmi: 140, + householdSize: 5, + income: 145040, + }, + { + percentOfAmi: 140, + householdSize: 6, + income: 155820, + }, + { + percentOfAmi: 140, + householdSize: 7, + income: 166600, + }, + { + percentOfAmi: 140, + householdSize: 8, + income: 177240, + }, + { + percentOfAmi: 150, + householdSize: 1, + income: 100800, + }, + { + percentOfAmi: 150, + householdSize: 2, + income: 115200, + }, + { + percentOfAmi: 150, + householdSize: 3, + income: 129600, + }, + { + percentOfAmi: 150, + householdSize: 4, + income: 143850, + }, + { + percentOfAmi: 150, + householdSize: 5, + income: 155400, + }, + { + percentOfAmi: 150, + householdSize: 6, + income: 166950, + }, + { + percentOfAmi: 150, + householdSize: 7, + income: 178500, + }, + { + percentOfAmi: 150, + householdSize: 8, + income: 189900, + }, + ], +} diff --git a/backend/core/scripts/script-data/MSHDA2024.txt b/backend/core/scripts/script-data/MSHDA2024.txt new file mode 100644 index 0000000000..bb4bd57717 --- /dev/null +++ b/backend/core/scripts/script-data/MSHDA2024.txt @@ -0,0 +1,16 @@ +20 13,440 15,360 17,280 19,180 20,720 22,260 23,800 25,320 +25 16,800 19,200 21,600 23,975 25,900 27,825 29,750 31,650 +30 20,160 23,040 25,920 28,770 31,808 33,390 35,700 37,980 +35 23,520 26,880 30,240 33,565 36,260 38,955 41,650 44,310 +40 26,880 30,720 34,560 38,360 41,440 44,520 47,600 50,640 +45 30,240 34,560 38,880 43,155 46,620 50,085 53,550 56,970 +50 33,600 38,400 43,200 47,950 51,800 55,650 59,500 63,300 +55 36,960 42,240 47,520 52,740 62,160 66,780 71,400 75,960 +60 40,320 46,080 51,840 57,540 62,160 66,780 71,400 75,960 +70 47,040 53,760 60,480 67,130 72,520 77,910 83,300 88,620 +80 53,760 61,440 69,120 76,720 82,880 89,040 95,200 101,280 +100 67,200 76,800 86,400 95,900 103,600 111,300 119,000 126,600 +120 80,640 92,160 103,680 115,080 124,320 133,560 142,800 151,920 +125 84,000 96,000 108,000 119,875 129,500 139,125 148,750 158,250 +140 94,080 107,520 120,960 134,260 145,040 155,820 166,600 177,240 +150 100,800 115,200 129,600 143,850 155,400 166,950 178,500 189,900 diff --git a/backend/core/src/migration/1714773518348-mshda-ami-chart.ts b/backend/core/src/migration/1714773518348-mshda-ami-chart.ts new file mode 100644 index 0000000000..53cc64fa48 --- /dev/null +++ b/backend/core/src/migration/1714773518348-mshda-ami-chart.ts @@ -0,0 +1,17 @@ +import { MigrationInterface, QueryRunner } from "typeorm" +import { ami } from "../../scripts/script-data/MSHDA2024" + +export class mshdaAmiChart1714773518348 implements MigrationInterface { + 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 {} +}