Skip to content

monum/DiscoverBPS

 
 

Repository files navigation

#School Discovery App The School Discovery App is designed to help parents 1) identify the schools to which their children are eligible to apply and 2) understand the odds of their children getting admitted. To search for schools, parents enter an address and a grade level. The search engine logic works as follows:

  1. if no parameters are entered -> display a blank map and a welcome note (the default page)
  2. if a grade level and no address are entered -> display the default page with an alert message
  3. if a grade level and non-geocodeable address are entered -> display the default page with an alert message
  4. if a grade level and non-Boston address are entered -> display the default page with an alert message
  5. if a grade level and valid address are entered -> display the walk zone and assignment zone schools for that address
  6. if high school and a valid address are entered -> display the walk zone schools and all of the other high schools throughout the city

http://schoolselection.herokuapp.com/

git clone git@heroku.com:schoolselection.git

there are a couple of obstacles to hosting this app on heroku.

  1. You need to have a postgis-enabled database, which means that you need to have a private Heroku database, set up with "heroku addons:add heroku-postgresql postgis=true". Then promote it to your database with "heroku pg:promote"
  2. When pushing with "heroku db:push", the taps gem doesn't recognize the postgis type. You need to temporarily change your config/database.yml file to have the adapter read "postgres" (not "postgis"). You also need to change heroku's DATABASE_URL to postgres using "heroku config:add DATABASE_URL=postgres://..."
  3. taps doesn't seem to preserve geographic column type. You'll need to go into "heroku pg:psql" and run:

ALTER TABLE parcels ALTER geometry TYPE Geography('MULTIPOLYGON',-1) USING ST_GeogFromText(geometry); ALTER TABLE assignment_zones ALTER geometry TYPE Geography('MULTIPOLYGON',-1) USING ST_GeogFromText(geometry);

  1. RGeo spatial adapter needs the adapter name set to 'postgis' to load. you accomplish this by setting the heroku DATABASE_URL. run "heroku config", and look at DATABASE_URL NEW_URL is the existing DATABASE_URL, but with postgres:// replaced with postgis:// run "heroku config:add DATABASE_URL=NEW_URL", where NEW_URL is your current database url

  2. Run 'heroku restart', to make sure your app loads the database correctly.

[step 0 not necessarily applicable] [0.1 heroku db:pull*] [0.2 psql -d , \d

, confirm that geometry columns are now text.] [0.3 update column types locally - see below]

  1. become beta user.
  2. heroku addons:add spacialdb:test
  3. heroku pg:info, heroku config
  4. heroku config:add DATABASE_URL=postgres://(contents of SPATIALDB_URL) [why can't I pg:promote the spatial db? it's not on pg:info. why?]
  5. heroku db:push [this takes a long time. a long time. especially on spatial_ref_s. it failed once.]
  6. heroku pg:psql - can't. it's not a matching database.
  7. reread the email, and install spacialdb gem
  8. we don't need to create an account
  9. look at heroku:config to get username/password [dan:randomstring]
  10. except that username/password don't work.
  11. give up and connect directly with: "psql -d heroku_dan_4fb9 -h beta.spacialdb.com -p 9999 -U dan --password", using given password. it works.
  12. use \d to verify geometry is text update columns per 0.3 \d to verify geometry is geometry
  13. 'heroku run console', Parcel.first.geometry.class, to confirm need for postgis. update DATABASE_URL to use postgis:// (this resets app)
  14. visit site. test. see odd saved form fields . . . .

*requires setting config/database.yml back to postgres, and DATABASE_URL to postgress://

0.3a ALTER TABLE parcels ALTER geometry TYPE Geography('MULTIPOLYGON',-1) USING ST_GeogFromText(geometry); 0.3b ALTER TABLE assignment_zones ALTER geometry TYPE Geography('MULTIPOLYGON',-1) USING ST_GeogFromText(geometry);

postgres://dan:83d37cb80a@beta.spacialdb.com:9999/heroku_dan_4fb9

In the spirit of free software, everyone is encouraged to help improve this project.

Here are some ways you can contribute:

  • by using alpha, beta, and prerelease versions
  • by reporting bugs
  • by suggesting new features
  • by writing or editing documentation
  • by writing specifications
  • by writing code (no patch is too small: fix typos, add comments, clean up inconsistent whitespace)
  • by refactoring code
  • by resolving issues
  • by reviewing patches
  • financially

We use the GitHub issue tracker to track bugs and features. Before submitting a bug report or feature request, check to make sure it hasn't already been submitted. You can indicate support for an existing issuse by voting it up. When submitting a bug report, please include a Gist that includes a stack trace and any details that may be necessary to reproduce the bug, including your gem version, Ruby version, and operating system. Ideally, a bug report should include a pull request with failing specs.

  1. Fork the project.
  2. Create a topic branch.
  3. Implement your feature or bug fix.
  4. Add documentation for your feature or bug fix.
  5. Run bundle exec rake doc:yard. If your changes are not 100% documented, go back to step 4.
  6. Add specs for your feature or bug fix.
  7. Run bundle exec rake spec. If your changes are not 100% covered, go back to step 6.
  8. Commit and push your changes.
  9. Submit a pull request. Please do not include changes to the gemspec, version, or history file. (If you want to create your own version for some reason, please do so in a separate commit.)

Copyright © 2013, Mayor's Office of New Urban Mechanics, City of Boston. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

Neither the name of the City of Boston, the Mayor's Office of New Urban Mechanics, nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 53.0%
  • JavaScript 41.4%
  • Python 5.0%
  • CoffeeScript 0.6%