From 7059f2cb9b32552bc72bd8ccc334961e41945067 Mon Sep 17 00:00:00 2001 From: Yazeed Loonat Date: Wed, 15 Nov 2023 11:16:51 -0700 Subject: [PATCH] feat: emeryville ami chart (#651) * feat: emeryville ami chart * fix: update to ami chart name --- .../ami-chart-import-files/emeryville-2023.ts | 83 +++++++++++++++++++ .../emeryville-2023.txt | 3 + ...1699486370874-emeryville-2023-ami-chart.ts | 20 +++++ 3 files changed, 106 insertions(+) create mode 100644 backend/core/scripts/ami-chart-import-files/emeryville-2023.ts create mode 100644 backend/core/scripts/ami-chart-import-files/emeryville-2023.txt create mode 100644 backend/core/src/migration/1699486370874-emeryville-2023-ami-chart.ts diff --git a/backend/core/scripts/ami-chart-import-files/emeryville-2023.ts b/backend/core/scripts/ami-chart-import-files/emeryville-2023.ts new file mode 100644 index 0000000000..649b31a70f --- /dev/null +++ b/backend/core/scripts/ami-chart-import-files/emeryville-2023.ts @@ -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 = { + 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, + }, + ], +} diff --git a/backend/core/scripts/ami-chart-import-files/emeryville-2023.txt b/backend/core/scripts/ami-chart-import-files/emeryville-2023.txt new file mode 100644 index 0000000000..77a5c0991c --- /dev/null +++ b/backend/core/scripts/ami-chart-import-files/emeryville-2023.txt @@ -0,0 +1,3 @@ +32 33152 37888 42624 47328 51136 +37 38332 43808 49284 54723 59126 +42 43512 49728 55944 62118 67166 diff --git a/backend/core/src/migration/1699486370874-emeryville-2023-ami-chart.ts b/backend/core/src/migration/1699486370874-emeryville-2023-ami-chart.ts new file mode 100644 index 0000000000..2d7e8e9ed2 --- /dev/null +++ b/backend/core/src/migration/1699486370874-emeryville-2023-ami-chart.ts @@ -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 { + 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 {} +}