Skip to content
This repository has been archived by the owner on Jan 9, 2025. It is now read-only.

Commit

Permalink
Merge pull request #11 from tsdataclinic/yuanyuan
Browse files Browse the repository at this point in the history
UI Revamp
  • Loading branch information
kaushik12 authored Apr 26, 2019
2 parents e2a4509 + 9d41bbc commit 3353582
Show file tree
Hide file tree
Showing 13 changed files with 835 additions and 240 deletions.
155 changes: 155 additions & 0 deletions newerhoods/components.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
header_nav <- withTags(
header(class ="header",
div(class="content col-xs-11",
div(class="navbar-wrapper",
a(href="https://www.twosigma.com/about/data-clinic/", target="_blank",
div(class="navbar-title", "NewerHoods"),
div(class="navbar-subtitle", "FROM TWO SIGMA DATA CLINIC")
)
)
)
)
)
### Modals
modal_features <-
bsModal(
id = "modal_features",
title="Getting started with NewerHoods",
body= includeMarkdown("markdowns/tutorial.md"),
size="medium",
trigger = "Help"
)

modal_plots <-
bs_modal(
id = "modal_plots",
title="Interpreting Plots",
body= includeMarkdown("markdowns/plots.md"),
size="medium"
)

modal_credits <-
bsModal(
id = "modal_credits",
title="NewerHoods",
body= includeMarkdown("markdowns/intro.md"),
size="medium",
trigger = "Credits"
)

modal_feedback <-
bsModal(
id = "modal_feedback",
title="Feedback",
body= includeMarkdown("markdowns/appendix.md"),
size="medium",
trigger = "Feedback"
)

### Info
info <-
div(class="text",
div("Choose characteristics to draw neighborhoods.")
)


### Inputs
input_housing <- checkboxGroupInput(
inputId = 'housing',label="HOUSING",
choices=c("Age of buildings"="bldg_age","Median Sale Price"="sale_price"),
selected = "bldg_age"
)

input_housing_sales <- conditionalPanel(condition="input.housing.includes('sale_price')",
radioButtons(
inputId = 'sales_features',label="",
choices=c("1y Average"="med_price_1y|sd_price_1y",
"3y Average"="med_price_3y|sd_price_3y",
"5y Average"="med_price_5y|sd_price_5y"
),selected = NULL))


input_crime <-
checkboxGroupInput(
inputId = 'crime_features', label="CRIME",
c("Violations"="violation_rate",
"Felonies"="felony_rate",
"Misdemeanors"="misdemeanor_rate"
)
)

input_noise <-
checkboxGroupInput(
inputId = 'call_features',label="311 COMPLAINTS",
c("Ice Cream truck"="icecream_rate",
"Barking Dog"="animal_rate",
"Loud Music/party"="party_rate"
)
)

input_clusters <-
sliderInput("num_clusters",
label="Number of neighborhoods",
ticks = FALSE,
min = 5,
max = 200,
value = 100)

input_enable_heatmap <-
materialSwitch(inputId = "enable_heatmap", label = "Cluster map", status = "info")

# info_plot_type <- shiny_iconlink() %>%
# bs_attach_modal(id_modal = "modal_plots")

info_plot_type <- shiny_iconlink() %>%
bs_embed_tooltip(title="The cluster map shows the city divided into the selected neighborhoods.
The colors are only to differentiate clusters from one another.
The heatmap shows the relative value for clusters averaged over the
chosen characteristics.",
placement = "top")

input_baseline <-
selectInput('baseline',label='Compare against',
choices=list("None"="none",
"Community Districts (59)"="cds",
"Public use Microdata Areas (55)"="pumas",
"Neighborhood Tabulation Areas (195)"="ntas",
"Police Precincts (77)"="precincts",
"School Districts (33)"="school_dists"),
selected = "none")

map_control_panel <- div(
class="flex flex-between map-control",
div(class="xsflex",
input_clusters,
input_baseline
),
div(
class="flex flex-end auto heatmap-group",
input_enable_heatmap,
div(class="heat-map-label", "Heat map"),
info_plot_type
)
)

help_link <- actionLink(inputId = "Help",label="Help")
feedback_link <- actionLink(inputId = 'Feedback',label="Feedback")
credits_link <- actionLink(inputId = 'Credits',label="About")

intro_links <-
div(class="links flex",
div(class="mainlink",credits_link),
div(class="mainslink",help_link),
div(class="mainslink",feedback_link)
)

footer <-
div(class="footer",
div(class="content flex-between col-xs-11 xsflex",
div(class="links", a(href="https://www.twosigma.com/about/data-clinic/", "© 2019 Data Clinic. All rights reserved.")),
div(class="flex",
div(class="links", a(href="https://www.twosigma.com/legal-disclosure/", "Legal Disclosure", target="_blank")),
div(class="slink links", a(href="https://www.twosigma.com/legal-disclosure/privacy-policy/", "Privacy Policy", target="_blank"))
)
)
)
17 changes: 1 addition & 16 deletions newerhoods/markdowns/appendix.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,2 @@
#### Data Sources

1. [NYC Annualized Property Sales Data (2012-2017)](https://www1.nyc.gov/site/finance/taxes/property-annualized-sales-update.page)
2. [MapPLUTO (18v1)](https://www1.nyc.gov/site/planning/data-maps/open-data/dwn-pluto-mappluto.page)
3. [Geoclient API v1.1](https://developer.cityofnewyork.us/api/geoclient-api)
4. [Property Assessment Roll Archives](https://www1.nyc.gov/site/finance/taxes/property-assessment-roll-archives.page)
5. [NYPD Complaint Data Historic](https://data.cityofnewyork.us/Public-Safety/NYPD-Complaint-Data-Historic/qgea-i56i)
6. [311 Service Requests from 2010 to Present](https://data.cityofnewyork.us/Social-Services/311-Service-Requests-from-2010-to-Present/erm2-nwe9)

#### References

1. [ClustGeo: an R package for hierarchical clustering with spatial constraints](https://arxiv.org/abs/1707.03897)
2. [Making Neighborhoods - Understanding New York City Transitions 2000-2010](http://chpcny.org/assets/MakingNeighborhoodsPaper.pdf)

#### Have questions, feedback or wish to contribute?
![GitHub Logo](../images/GitHub-Mark-32px.png) [GitHub](https://github.com/tsdataclinic/new-neighborhoods)

We invite [feedback](https://airtable.com/shr2sLGHHIiLY6BUC) on the tool and encourage users to contribute via NewerHoods’ [Github repository](https://github.com/tsdataclinic/newerhoods). To contact Data Clinic about NewerHoods, please email us at dataclinic@twosigma.com.
24 changes: 11 additions & 13 deletions newerhoods/markdowns/intro.html
Original file line number Diff line number Diff line change
Expand Up @@ -372,17 +372,17 @@
</div>


<div id="newerhoods" class="section level3">
<h3>NewerHoods</h3>
<div id="redefining-nyc-neighborhood-boundaries-using-open-data-and-machine-learning" class="section level4">
<h4><em>Redefining NYC neighborhood boundaries using open data and machine learning</em></h4>
<div id="redefining-nyc-neighborhood-boundaries-using-open-data-and-machine-learning" class="section level5">
<h5><em>Redefining NYC neighborhood boundaries using open data and machine learning</em></h5>
<p>By <a href="https://www.twosigma.com/about/data-clinic/">Data Clinic</a> ___</p>
<p><strong>Purpose:</strong></p>
</div>
<div id="purpose" class="section level4">
<h4>Purpose</h4>
<p>New York City’s (NYC’s) neighborhoods are a driving force in the lives of New Yorkers—their identities are closely intertwined and a source of pride. However, the history and evolution of NYC’s neighborhoods don’t follow the rigid, cold lines of statistical and administrative boundaries. Instead, the neighborhoods we live and work in are the result of a more organic confluence of factors.</p>
<p>Data Clinic developed NewerHoods with the goal of helping individuals and organizations better advocate for their communities by enabling them to tailor insights to meet their specific needs. NewerHoods is an interactive web-app that uses open data to generate localized features at the census tract-level and machine learning to create homogeneous clusters. Users are able to select characteristics of interest (currently open data on housing, crime, and 311 complaints), visualize NewerHood clusters on an interactive map, find similar neighborhoods, and compare them against existing administrative boundaries. The tool is designed to enable users without in-depth data expertise to compare and incorporate these redefined neighborhoods into their work and life.</p>
<p>We invite <a href="https://airtable.com/shr2sLGHHIiLY6BUC">feedback</a> on the tool and encourage users to contribute via NewerHoods’ <a href="https://github.com/tsdataclinic/newerhoods">Github repository</a>. To contact Data Clinic about NewerHoods, please email us at <a href="mailto:dataclinic@twosigma.com">dataclinic@twosigma.com</a>.</p>
<div id="data-sources" class="section level5">
<h5>Data Sources</h5>
</div>
<div id="data-sources" class="section level4">
<h4>Data Sources</h4>
<ol style="list-style-type: decimal">
<li><a href="https://www1.nyc.gov/site/finance/taxes/property-annualized-sales-update.page">NYC Annualized Property Sales Data (2012-2017)</a></li>
<li><a href="https://www1.nyc.gov/site/planning/data-maps/open-data/dwn-pluto-mappluto.page">MapPLUTO (18v1)</a></li>
Expand All @@ -392,18 +392,16 @@ <h5>Data Sources</h5>
<li><a href="https://data.cityofnewyork.us/Social-Services/311-Service-Requests-from-2010-to-Present/erm2-nwe9">311 Service Requests from 2010 to Present</a></li>
</ol>
</div>
<div id="references" class="section level5">
<h5>References</h5>
<div id="references" class="section level4">
<h4>References</h4>
<ol style="list-style-type: decimal">
<li><a href="https://arxiv.org/abs/1707.03897">ClustGeo: an R package for hierarchical clustering with spatial constraints</a></li>
<li><a href="http://chpcny.org/assets/MakingNeighborhoodsPaper.pdf">Making Neighborhoods - Understanding New York City Transitions 2000-2010</a></li>
</ol>
</div>
</div>
<div id="have-questions-feedback-or-wish-to-contribute" class="section level4">
<h4>Have questions, feedback or wish to contribute?</h4>
<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyRpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoTWFjaW50b3NoKSIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDpFNTE3OEEyQTk5QTAxMUUyOUExNUJDMTA0NkE4OTA0RCIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDpFNTE3OEEyQjk5QTAxMUUyOUExNUJDMTA0NkE4OTA0RCI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjpp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psaVI0g2LInpOsNFUud1rhxSV+fzC9Woz2EZkWQuja7/B+jUrgtIMpy9YCW4n4K41YfzRneW5E1KJTe4B2Zq1Q5EHEtj4U3AfEzR5SVY4l7QYQPJdN2as7RKBF0BPZqqH4VgMAMBL8Byxr7y8zCZiDlnOcEKIPmUpgB5Z2ww5RdOiiRiNajUmWda5IG6WbhsyY2fx6m8gLcoJDJFkH219M3We1+cnda93pfycZpIJEL/s/wSYADmOAwAQgdpBAAAAABJRU5ErkJggg==" alt="GitHub Logo" /> <a href="https://github.com/tsdataclinic/new-neighborhoods">GitHub</a></p>
</div>
<p>We invite <a href="https://airtable.com/shr2sLGHHIiLY6BUC">feedback</a> on the tool and encourage users to contribute via NewerHoods’ <a href="https://github.com/tsdataclinic/newerhoods">Github repository</a>. To contact Data Clinic about NewerHoods, please email us at <a href="mailto:dataclinic@twosigma.com">dataclinic@twosigma.com</a>.</p>
</div>


Expand Down
11 changes: 4 additions & 7 deletions newerhoods/markdowns/intro.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
### NewerHoods
#### *Redefining NYC neighborhood boundaries using open data and machine learning*
##### *Redefining NYC neighborhood boundaries using open data and machine learning*
By [Data Clinic](https://www.twosigma.com/about/data-clinic/)
___

##### Purpose
#### Purpose

New York City’s (NYC’s) neighborhoods are a driving force in the lives of New Yorkers—their identities are closely intertwined and a source of pride. However, the history and evolution of NYC’s neighborhoods don’t follow the rigid, cold lines of statistical and administrative boundaries. Instead, the neighborhoods we live and work in are the result of a more organic confluence of factors.

Data Clinic developed NewerHoods with the goal of helping individuals and organizations better advocate for their communities by enabling them to tailor insights to meet their specific needs. NewerHoods is an interactive web-app that uses open data to generate localized features at the census tract-level and machine learning to create homogeneous clusters. Users are able to select characteristics of interest (currently open data on housing, crime, and 311 complaints), visualize NewerHood clusters on an interactive map, find similar neighborhoods, and compare them against existing administrative boundaries. The tool is designed to enable users without in-depth data expertise to compare and incorporate these redefined neighborhoods into their work and life.

##### Data Sources
#### Data Sources

1. [NYC Annualized Property Sales Data (2012-2017)](https://www1.nyc.gov/site/finance/taxes/property-annualized-sales-update.page)
2. [MapPLUTO (18v1)](https://www1.nyc.gov/site/planning/data-maps/open-data/dwn-pluto-mappluto.page)
Expand All @@ -18,10 +17,8 @@ Data Clinic developed NewerHoods with the goal of helping individuals and organi
5. [NYPD Complaint Data Historic](https://data.cityofnewyork.us/Public-Safety/NYPD-Complaint-Data-Historic/qgea-i56i)
6. [311 Service Requests from 2010 to Present](https://data.cityofnewyork.us/Social-Services/311-Service-Requests-from-2010-to-Present/erm2-nwe9)

##### References
#### References

1. [ClustGeo: an R package for hierarchical clustering with spatial constraints](https://arxiv.org/abs/1707.03897)
2. [Making Neighborhoods - Understanding New York City Transitions 2000-2010](http://chpcny.org/assets/MakingNeighborhoodsPaper.pdf)

#### Have questions, feedback or wish to contribute?
We invite [feedback](https://airtable.com/shr2sLGHHIiLY6BUC) on the tool and encourage users to contribute via NewerHoods’ [Github repository](https://github.com/tsdataclinic/newerhoods). To contact Data Clinic about NewerHoods, please email us at dataclinic@twosigma.com.
Loading

0 comments on commit 3353582

Please sign in to comment.