https://github.com/corymccartan/neighborhood-survey

https://github.com/corymccartan/neighborhood-survey

Science Score: 39.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 2 DOI reference(s) in README
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.8%) to scientific vocabulary
Last synced: 10 months ago · JSON representation

Repository

Basic Info
Statistics
  • Stars: 14
  • Watchers: 2
  • Forks: 1
  • Open Issues: 0
  • Releases: 0
Created almost 6 years ago · Last pushed about 2 years ago
Metadata Files
Readme License

README.md

Neighborhood Survey Collection Tool

An web map on which survey participants can draw a region, embeddable in Qualtrics, as described in "Measuring and Modeling Neighborhoods".

Looking for the R package to fit a model to collected neighborhoods? See CoryMcCartan/nbhdmodel.

To Create Your Own Map

First, open R/make_tileset.R and edit the first few lines to specify the state (STATE) and counties (COUNTIES) you wish to generate a map for, a short name (TILESET_ID) for the generated map, and your Mapbox username (MAPBOX_USERNAME) and secret key with uploads permissions set (MAPBOX_SECRET_TOKEN).

Then run the entire file. This will take a long time, especially if the map area is large. Ultimately, a tileset will be uploaded to Mapbox containing the Census blocks and associated variables. The script will also produce a JSON file containing the appropriate specification for the embedded map, and an adjacency graph. Both will be outputted to the assets/ folder.

Second, host the adjacency graph and specification JSON online. Running npm run build will build a mockup embedded map and associated files into the docs/ directory, which can be hosted on GitHub free of charge. (Go to the Settings tab and select the option to host from the docs/ directory). You will need the URLs to both of these files to embed the map into a Qualtrics survey.

To Embed in Qualtrics

First, add the following lines in HTML mode to your survey header (under "Look and Feel > General > Header > edit"):

html <script src="https://api.mapbox.com/mapbox-gl-js/v1.11.1/mapbox-gl.js"></script> <script src="https://cdn.jsdelivr.net/gh/CoryMcCartan/neighborhood-survey/docs/embedded.js"></script>

Second, under "Look and Feel > Style > External CSS", paste: https://cdn.jsdelivr.net/gh/CoryMcCartan/neighborhood-survey/docs/embedded.css

Third, in the question you'd like to have the map appear in, edit the question HTML and paste: ```html

Enter your address

Draw your neighborhood

Use the brush tool to draw your neighborhood, and the eraser to make corrections.

``` You may add additional instructions where indicated.

Fourth, go to src/qualtrics-basic.js and edit the top few lines to include your Mapbox API token and the URLs to your map and ajacency graph: ```js var map;

var MAPBOXTOKEN = ""; var SPECIFICATION = ""; var ADJACENCYGRAPH = ""; `` Then copy the code in the entire file into the JavaScript section of the map question. The user's address will be saved in thehome_addressfield, and the selected block group IDs will be saved in theneighborhood` field.

Finally, go to "Survey Flow" and add a "Set Embedded Data" element before the question with the map. Inside, add a field for neighborhood and one for home_address.

Other Options

The code in src/qualtrics-advanced.js provides more options, which may be customized using Qualtrics embedded data (which can in turn be set by URL parameters, for example, ?overlay=true&overlay_type=partisan&start_zoom=13).

The supported options are:

  • Set overlay to true/false to turn on and off a colored overlay
  • Set overlay_type to partisan or race to show a partisan or race overlay. The code in qualtrics-advanced.js may need to be customized so that the demographic variable names match those expected. Additional types can also be added, and are implemented using Mapbox styling expressions. We provide the helper functions BivariateOverlay and UnivariateOverlay to create styling functions; look at src/views/embedded.js.
  • Set city_group to the name of the city you'd like to use (this requires that you have appropriate tilesets and adjancency graphs uploaded).
  • Set start_zoom to set the original zoom level. The default is 14.

Owner

  • Name: Cory McCartan
  • Login: CoryMcCartan
  • Kind: user
  • Company: New York University

Faculty Fellow at NYU's Center for Data Science, working on computational social science problems and open-source R software.

GitHub Events

Total
  • Watch event: 3
Last Year
  • Watch event: 3

Issues and Pull Requests

Last synced: about 1 year ago

All Time
  • Total issues: 0
  • Total pull requests: 10
  • Average time to close issues: N/A
  • Average time to close pull requests: 7 months
  • Total issue authors: 0
  • Total pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 0.8
  • Merged pull requests: 2
  • Bot issues: 0
  • Bot pull requests: 10
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
  • dependabot[bot] (10)
Top Labels
Issue Labels
Pull Request Labels
dependencies (10)