Skip to content

Commit

Permalink
feat: emeryville ami chart (#651)
Browse files Browse the repository at this point in the history
* feat: emeryville ami chart

* fix: update to ami chart name
  • Loading branch information
YazeedLoonat authored Nov 15, 2023
1 parent 764dce1 commit 7059f2c
Show file tree
Hide file tree
Showing 3 changed files with 106 additions and 0 deletions.
83 changes: 83 additions & 0 deletions backend/core/scripts/ami-chart-import-files/emeryville-2023.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
import { AmiChartCreateDto } from "../../src/ami-charts/dto/ami-chart.dto"
import { BaseEntity } from "typeorm"
// THIS FILE WAS AUTOMATICALLY GENERATED FROM emeryville-2023.txt.
export const ami: Omit<AmiChartCreateDto, keyof BaseEntity | "jurisdiction"> = {
name: "Emeryville 2023",
items: [
{
percentOfAmi: 32,
householdSize: 1,
income: 33152,
},
{
percentOfAmi: 32,
householdSize: 2,
income: 37888,
},
{
percentOfAmi: 32,
householdSize: 3,
income: 42624,
},
{
percentOfAmi: 32,
householdSize: 4,
income: 47328,
},
{
percentOfAmi: 32,
householdSize: 5,
income: 51136,
},
{
percentOfAmi: 37,
householdSize: 1,
income: 38332,
},
{
percentOfAmi: 37,
householdSize: 2,
income: 43808,
},
{
percentOfAmi: 37,
householdSize: 3,
income: 49284,
},
{
percentOfAmi: 37,
householdSize: 4,
income: 54723,
},
{
percentOfAmi: 37,
householdSize: 5,
income: 59126,
},
{
percentOfAmi: 42,
householdSize: 1,
income: 43512,
},
{
percentOfAmi: 42,
householdSize: 2,
income: 49728,
},
{
percentOfAmi: 42,
householdSize: 3,
income: 55944,
},
{
percentOfAmi: 42,
householdSize: 4,
income: 62118,
},
{
percentOfAmi: 42,
householdSize: 5,
income: 67166,
},
],
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
32 33152 37888 42624 47328 51136
37 38332 43808 49284 54723 59126
42 43512 49728 55944 62118 67166
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { MigrationInterface, QueryRunner } from "typeorm"
import { ami } from "../../scripts/ami-chart-import-files/emeryville-2023"

export class emeryville2023AmiChart1699486370874 implements MigrationInterface {
name = "emeryville2023AmiChart1699486370874"

public async up(queryRunner: QueryRunner): Promise<void> {
const [{ id: juris }] = await queryRunner.query(
`SELECT id FROM jurisdictions WHERE name = 'Alameda'`
)

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 7059f2c

Please sign in to comment.