Skip to content

Commit

Permalink
Merge pull request #1318 from cityofaustin/13561_peh_fl
Browse files Browse the repository at this point in the history
Create a new field peh_fl in the database for a Person Experiencing Homelessness
  • Loading branch information
roseeichelmann authored Nov 27, 2023
2 parents b9df151 + ba8f103 commit b594046
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE public.atd_txdot_person
DROP COLUMN IF EXISTS peh_fl;
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
alter table "public"."atd_txdot_person" add column "peh_fl" boolean
null;

COMMENT ON COLUMN public.atd_txdot_person.peh_fl IS 'Boolean flag that indicates whether the person was experiencing homelessness at the time of the crash.';
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE public.atd_txdot_primaryperson
DROP COLUMN IF EXISTS peh_fl;
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
alter table "public"."atd_txdot_primaryperson" add column "peh_fl" boolean
null;

COMMENT ON COLUMN public.atd_txdot_primaryperson.peh_fl IS 'Boolean flag that indicates whether the person was experiencing homelessness at the time of the crash.';
2 changes: 2 additions & 0 deletions atd-vze/src/queries/people.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export const GET_PEOPLE = gql`
ethnicity_desc
}
unit_nbr
peh_fl
}
atd_txdot_person(where: { crash_id: { _eq: $crashId } }) {
prsn_age
Expand All @@ -47,6 +48,7 @@ export const GET_PEOPLE = gql`
ethnicity_desc
}
unit_nbr
peh_fl
}
}
`;
Expand Down
17 changes: 17 additions & 0 deletions atd-vze/src/views/Crashes/RelatedRecordsTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ const RelatedRecordsTable = ({
if (typeof data[field] === "object") {
fieldValue =
data[field] && data[field][fieldConfig.fields[field].lookup_desc];
} else if (data[field] === true) {
fieldValue = "YES";
} else if (data[field] === false) {
fieldValue = "NO";
}

// Display null values as blanks, but allow 0
Expand Down Expand Up @@ -228,6 +232,19 @@ const RelatedRecordsTable = ({
})}
</Input>
)}
{uiType === "boolean" && (
<Input
defaultValue={row[field]}
type="select"
onChange={e =>
handleInputChange(e, updateFieldKey)
}
>
<option value={""}>NO DATA</option>
<option value={true}>YES</option>
<option value={false}>NO</option>
</Input>
)}
<div className="d-flex">
<Button
type="submit"
Expand Down
18 changes: 15 additions & 3 deletions atd-vze/src/views/Crashes/personDataMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ const getInjurySeverityColor = personRecord => {
case 4: // FATAL INJURY: red
return "danger";
case 99: // KILLED: red
return "secondary"
default: // Other cases: Not reported, Reported invalid, Not injured
return "secondary";
default:
// Other cases: Not reported, Reported invalid, Not injured
return "secondary";
}
};


export const primaryPersonDataMap = [
{
title: "Drivers/Primary People",
Expand Down Expand Up @@ -107,6 +107,12 @@ export const primaryPersonDataMap = [
label: "ZIP",
editable: false,
},
peh_fl: {
label: "Unhoused",
editable: true,
format: "boolean",
mutationVariableKey: "personId",
},
},
},
];
Expand Down Expand Up @@ -182,6 +188,12 @@ export const personDataMap = [
updateFieldKey: "prsn_ethnicity_id",
mutationVariableKey: "personId",
},
peh_fl: {
label: "Unhoused",
editable: true,
format: "boolean",
mutationVariableKey: "personId",
},
},
},
];

0 comments on commit b594046

Please sign in to comment.