Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grab development-level statistics for NYCHA buildings live from nycdb #447

Merged
merged 15 commits into from
Apr 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion client/src/components/APIDataTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export type SummaryResults = {
result: SummaryStatsRecord[];
};

// TYPES ASSOCIATED BUILDING INFO QUERY:
// TYPES ASSOCIATED WITH BUILDING INFO QUERY:

export type BuildingInfoRecord = {
boro: Borough;
Expand All @@ -120,6 +120,15 @@ export type BuildingInfoRecord = {
streetname: string;
bldgclass: string;
formatted_address: string;
/** The name of the NYCHA development (e.g. "SOTOMAYOR HOUSES").
* NULL if building is not part of NYCHA */
nycha_development: string | null;
/** Total executed residential evictions (since 2017) accross the building's entire NYCHA development.
* NULL values either mean 0 evictions took place across the development or building is not part of NYCHA. */
nycha_dev_evictions: number | null;
/** Total residential units accross the building's entire NYCHA development.
* NULL values either mean PLUTO listed 0 residential units across the development or building is not part of NYCHA. */
nycha_dev_unitsres: number | null;
Comment on lines +125 to +131
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@toolness I updated these comments to be more descriptive of what NULL values mean in each field here

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ohh nice that's great! Cool, you can disregard my other comment about having a nycha object then, thanks!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh ok!

};

export type BuildingInfoResults = {
Expand Down
19 changes: 6 additions & 13 deletions client/src/containers/NychaPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,12 @@ import { SocialShareForNotRegisteredPage } from "./NotRegisteredPage";
import { withMachineInStateProps } from "state-machine";
import Page from "components/Page";

export type NychaData = {
bbl: number;
development: string;
dev_evictions: string | number;
dev_unitsres: number;
};

type NychaPageProps = withMachineInStateProps<"nychaFound"> & withI18nProps;

const NychaPageWithoutI18n: React.FC<NychaPageProps> = (props) => {
const { i18n, state } = props;

const { searchAddrParams, searchAddrBbl, nychaData: nycha, buildingInfo } = state.context;
const { searchAddrParams, searchAddrBbl, buildingInfo } = state.context;
const { boro, block, lot } = Helpers.splitBBL(searchAddrBbl);

const bblDash = (
Expand Down Expand Up @@ -91,7 +84,7 @@ const NychaPageWithoutI18n: React.FC<NychaPageProps> = (props) => {
<div className="HomePage__content">
<div className="HomePage__search">
<h5 className="mt-10 text-center text-bold text-large">
{nycha.development}: <Trans>Public Housing Development</Trans>
{buildingInfo.nycha_development}: <Trans>Public Housing Development</Trans>
</h5>
<h6 className="mt-10 text-center text-bold text-large">
<Trans>This building is owned by the NYC Housing Authority (NYCHA)</Trans>
Expand All @@ -110,15 +103,15 @@ const NychaPageWithoutI18n: React.FC<NychaPageProps> = (props) => {
)}
>
<Trans render="label">Units</Trans>
{nycha.dev_unitsres}
{buildingInfo.nycha_dev_unitsres || 0}
</div>
<div
title={i18n._(
t`Evictions executed in this development by NYC Marshals in 2019. ANHD and the Housing Data Coalition cleaned, geocoded, and validated the data, originally sourced from DOI.`
t`Evictions executed in this development by NYC Marshals since 2017. ANHD and the Housing Data Coalition cleaned, geocoded, and validated the data, originally sourced from DOI.`
)}
>
<Trans render="label">2019 Evictions</Trans>
{nycha.dev_evictions}
<Trans render="label">Evictions</Trans>
{buildingInfo.nycha_dev_evictions || 0}
</div>
</div>
</div>
Expand Down
Loading