Skip to content

Commit

Permalink
Update dictionary with formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
camille-s committed Aug 27, 2024
1 parent 863f209 commit 51c32ef
Show file tree
Hide file tree
Showing 6 changed files with 103 additions and 3 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"d3-format": "^3.1.0",
"d3-scale": "^4.0.2",
"d3-scale-chromatic": "^3.1.0",
"html-react-parser": "^5.1.13",
"leaflet": "^1.9.4",
"lodash": "^4.17.21",
"prop-types": "^15.8.1",
Expand Down
90 changes: 90 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
makeChoroScale,
makeTooltip,
findLocation,
italicize,
} from './utils';

// library components
Expand Down Expand Up @@ -186,6 +187,7 @@ function App({ scheme }) {
towns={getCogTowns(cogRef, geoMeta.xwalk)}
cog={geoMeta.cogs[cogRef]}
dictionary={dictionary}
format={italicize}
{...notes}
/>
</Container>
Expand Down
2 changes: 1 addition & 1 deletion src/data/dictionary.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"source":"US Census Bureau American Community Survey 5-year estimates","variables":[{"indicator":"Latino population","detail":"In Census data, Latino is considered an ethnicity, not a racial category. The Latino population here is anyone of Latino ethnicity, regardless of race."},{"indicator":"White population","detail":"The white population here represents people who are white and not of Latino ethnicity."},{"indicator":"Black population","detail":"The Black population here represents people who are Black and not of Latino ethnicity."},{"indicator":"Other race population","detail":"The \"other race\" population here represents people who are not in the white or Black racial groups and are not of Latino ethnicity."},{"indicator":"Foreign-born population","detail":"In Census data, people are considered native-born if they were born in the US or its territories, or born abroad to US citizen parents. All other US residents are considered foreign-born."},{"indicator":"Cost-burdened households","detail":"Based on HUD guidelines, a household is considered cost-burdened if more than 30% of its income is spent on housing costs."},{"indicator":"Poverty status known","detail":"Because poverty status is based on total household income and the number of people in that household, not everyone's poverty status can be calculated. This variable gives the number of people in the area for whom poverty status can be calculated, and is the denominator for poverty and low-income rates."},{"indicator":"Population in poverty","detail":"Counts of people in poverty and poverty rates represent the number and percentage of people whose household incomes are below the federal poverty level."},{"indicator":"Low-income population","detail":"Counts of low-income people and low-income rates represent the number and percentage of people whose household incomes are below two times the federal poverty level."}]},{"source":"Questions on the DataHaven Community Wellbeing Survey","variables":[{"indicator":"Just getting by financially","detail":"How well would you say you are managing financially these days? (just getting by / finding it difficult / finding it very difficult)"},{"indicator":"Food insecure in past year","detail":"Have there been times in the past 12 months when you did not have enough money to buy food that you or your family needed?"},{"indicator":"Housing insecure in past year","detail":"In the last 12 months, have you not had enough money to provide adequate shelter or housing for you or your family?"},{"indicator":"Transportation insecure in past year","detail":"In the past 12 months, did you stay home when you needed or wanted to go someplace because you had no access to reliable transportation?"},{"indicator":"Access to a car","detail":"Do you have access to a car when you need it? (very often / fairly often)"},{"indicator":"Stores, banks, etc. are in walking distance","detail":"Many stores, banks, markets or places to go are within easy walking distance of my home (strongly agree / agree)"},{"indicator":"Safe places to bike in area","detail":"There are places to bicycle in or near my neighborhood that are safe from traffic, such as on the street or on special lanes, separate paths or trails (strongly agree / agree)"},{"indicator":"Local recreational facilities available","detail":"My neighborhood has several free or low cost recreation facilities such as parks, playgrounds, public swimming pools, etc (strongly agree / agree)"},{"indicator":"Feel safe walking at night","detail":"I do not feel safe to go on walks in my neighborhood at night (strongly disagree / disagree)"},{"indicator":"Trust neighbors","detail":"People in this neighborhood can be trusted (strongly agree / agree)"},{"indicator":"Local youth have positive role models","detail":"Children and youth in my town generally have the positive role models they need around here (strongly agree / agree)"},{"indicator":"Have some influence over local government","detail":"How would you describe your ability to influence local-government decision making? (great influence / moderate influence / a little influence)"},{"indicator":"Health is excellent or very good","detail":"How would you rate your overall health? (excellent / very good)"},{"indicator":"Satisfied with life","detail":"How satisfied are you with your life nowadays? (mostly / completely)"},{"indicator":"Mostly or completely happy","detail":"How happy did you feel yesterday? (mostly / completely)"},{"indicator":"Mostly or completely anxious","detail":"How anxious did you feel yesterday? (mostly / completely)"},{"indicator":"Have social and emotional support","detail":"How often do you get the social and emotional support you need? (always / usually)"},{"indicator":"Satisfied with area","detail":"Are you satisfied with the city or area where you live?"},{"indicator":"Local government is responsive","detail":"How responsive local government is to the needs of residents (excellent / good)"},{"indicator":"Local police keep residents safe","detail":"The job done by the police to keep residents safe (excellent / good)"},{"indicator":"Suitable work opportunities available","detail":"The ability of residents to obtain suitable employment (excellent / good)"},{"indicator":"Area is good to raise kids","detail":"As a place to raise children (excellent / good)"},{"indicator":"Parks are in good condition","detail":"The condition of public parks and other public recreational facilities (excellent / good)"},{"indicator":"Affordable quality produce is available","detail":"The availability of affordable, high-quality fruits and vegetables (excellent / good)"}]}]
[{"source":"General terms","variables":[{"term":"Council of governments (COG)","definition":"Connecticut's towns are organized into planning regions, each served by a council of governments (COG) made up of mayors and first selectmen from the region. Starting in 2023, COGs began replacing previous county designations for federal and state statistics. ","url":"https://portal.ct.gov/OPM/IGPP/ORG/Planning-Regions/Planning-Regions---Overview"}]},{"source":"US Census Bureau American Community Survey 5-year estimates","variables":[{"term":"Latino population","definition":"In Census data, Latino is considered an ethnicity, not a racial category. The Latino population here is anyone of Latino ethnicity, regardless of race."},{"term":"White population","definition":"The white population here represents people who are white and not of Latino ethnicity."},{"term":"Black population","definition":"The Black population here represents people who are Black and not of Latino ethnicity."},{"term":"Other race population","definition":"The \"other race\" population here represents people who are not in the white or Black racial groups and are not of Latino ethnicity."},{"term":"Foreign-born population","definition":"In Census data, people are considered native-born if they were born in the US or its territories, or born abroad to US citizen parents. All other US residents are considered foreign-born."},{"term":"Cost-burdened households","definition":"Based on HUD guidelines, a household is considered cost-burdened if more than 30% of its income is spent on housing costs."},{"term":"Poverty status known","definition":"Because poverty status is based on total household income and the number of people in that household, not everyone's poverty status can be calculated. This variable gives the number of people in the area for whom poverty status can be calculated, and is the denominator for poverty and low-income rates."},{"term":"Population in poverty","definition":"Counts of people in poverty and poverty rates represent the number and percentage of people whose household incomes are below the federal poverty level."},{"term":"Low-income population","definition":"Counts of low-income people and low-income rates represent the number and percentage of people whose household incomes are below two times the federal poverty level."}]},{"source":"Questions on the DataHaven Community Wellbeing Survey","variables":[{"term":"Just getting by financially","definition":"How well would you say you are managing financially these days? (just getting by / finding it difficult / finding it very difficult)"},{"term":"Food insecure in past year","definition":"Have there been times in the past 12 months when you did not have enough money to buy food that you or your family needed?"},{"term":"Housing insecure in past year","definition":"In the last 12 months, have you not had enough money to provide adequate shelter or housing for you or your family?"},{"term":"Transportation insecure in past year","definition":"In the past 12 months, did you stay home when you needed or wanted to go someplace because you had no access to reliable transportation?"},{"term":"Access to a car","definition":"Do you have access to a car when you need it? (very often / fairly often)"},{"term":"Stores, banks, etc. are in walking distance","definition":"Many stores, banks, markets or places to go are within easy walking distance of my home (strongly agree / agree)"},{"term":"Safe places to bike in area","definition":"There are places to bicycle in or near my neighborhood that are safe from traffic, such as on the street or on special lanes, separate paths or trails (strongly agree / agree)"},{"term":"Local recreational facilities available","definition":"My neighborhood has several free or low cost recreation facilities such as parks, playgrounds, public swimming pools, etc (strongly agree / agree)"},{"term":"Feel safe walking at night","definition":"I do not feel safe to go on walks in my neighborhood at night (strongly disagree / disagree)"},{"term":"Trust neighbors","definition":"People in this neighborhood can be trusted (strongly agree / agree)"},{"term":"Local youth have positive role models","definition":"Children and youth in my town generally have the positive role models they need around here (strongly agree / agree)"},{"term":"Have some influence over local government","definition":"How would you describe your ability to influence local-government decision making? (great influence / moderate influence / a little influence)"},{"term":"Health is excellent or very good","definition":"How would you rate your overall health? (excellent / very good)"},{"term":"Satisfied with life","definition":"How satisfied are you with your life nowadays? (mostly / completely)"},{"term":"Mostly or completely happy","definition":"How happy did you feel yesterday? (mostly / completely)"},{"term":"Mostly or completely anxious","definition":"How anxious did you feel yesterday? (mostly / completely)"},{"term":"Have social and emotional support","definition":"How often do you get the social and emotional support you need? (always / usually)"},{"term":"Satisfied with area","definition":"Are you satisfied with the city or area where you live?"},{"term":"Local government is responsive","definition":"How responsive local government is to the needs of residents (excellent / good)"},{"term":"Local police keep residents safe","definition":"The job done by the police to keep residents safe (excellent / good)"},{"term":"Suitable work opportunities available","definition":"The ability of residents to obtain suitable employment (excellent / good)"},{"term":"Area is good to raise kids","definition":"As a place to raise children (excellent / good)"},{"term":"Parks are in good condition","definition":"The condition of public parks and other public recreational facilities (excellent / good)"},{"term":"Affordable quality produce is available","definition":"The availability of affordable, high-quality fruits and vegetables (excellent / good)"}]}]
4 changes: 2 additions & 2 deletions src/main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ const theme = createTheme({
},
h2: {
fontWeight: 500,
fontSize: '1.2rem',
fontSize: '1.3rem',
},
h3: {
fontWeight: 500,
fontSize: '1.1rem',
fontSize: '1.2rem',
},
h4: {
fontWeight: 500,
Expand Down
7 changes: 7 additions & 0 deletions src/utils/strings.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import _ from 'lodash';
import { formatLocale } from 'd3-format';
import parse from 'html-react-parser';

// convert snakecase to title case
export const titleCase = (text) => {
Expand Down Expand Up @@ -54,4 +55,10 @@ export const wordsAnd = (x) => {

export const abbreviate = (max) => {
return (x) => abbr(x, max);
};

export const italicize = (x) => {
x = _.replace(x, '(', '<em>(');
x = _.replace(x, ')', ')</em>');
return parse(x);
};

0 comments on commit 51c32ef

Please sign in to comment.