Skip to content

Commit

Permalink
fix: add home ami chart (#1666)
Browse files Browse the repository at this point in the history
  • Loading branch information
ColinBuyck authored Dec 4, 2024
1 parent 5213138 commit 61cb989
Show file tree
Hide file tree
Showing 3 changed files with 192 additions and 0 deletions.
169 changes: 169 additions & 0 deletions backend/core/scripts/script-data/HOME2024.ts
Original file line number Diff line number Diff line change
@@ -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<AmiChartCreateDto, keyof BaseEntity | "jurisdiction"> = {
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,
},
],
}
4 changes: 4 additions & 0 deletions backend/core/scripts/script-data/HOME2024.txt
Original file line number Diff line number Diff line change
@@ -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
19 changes: 19 additions & 0 deletions backend/core/src/migration/1732654757266-home-ami-chart.ts
Original file line number Diff line number Diff line change
@@ -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<void> {
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<void> {}
}

0 comments on commit 61cb989

Please sign in to comment.