jlyon / blue-guide

A complete system to visualize healthcare providers on a standalone searchable, filterable map. Includes mobile responsive version. For a live demo, go to http://blueguide.cohealthinitiative.org.
GNU General Public License v2.0
1 stars 3 forks source link

Using blue-guide to import data.json from another Google spreadsheet #2

Open ninajlu opened 10 years ago

ninajlu commented 10 years ago

Hi, I was hoping to use blue-guide as a template for a similar website to help people find healthcare providers in another state. How could I import data from a different Google spreadsheet into the same format as the current data.json file?

sc456a commented 9 years ago

Nina: Did you ever find a way to do this? We've been looking at this as well. Thanks!

jlyon commented 9 years ago

Hi Nina and Scott,

Nina, sorry I didn't see this issue until a full year later. I hope you were able to figure it out.

Scott, I updated the instructions in the README file. Here they are below as well. I also shared the Google Doc with you (and the public). Let me know if you run into any issues, or if anything doesn't work for you.

Thanks, Jeff

2. Load in your data

Now we need to go back to the Google Spreadsheet and export the data to a JSON file (data.json). We want to export the Google Spreadsheet data into its own local file to decrease load and processing time, and ensure that we don't run up against Google quota limits.

Unfortunately the current method requires some trickery. If you are interested in helping clean this process up, either with development help or financial contributions, please create in issue in the issue queue. Here are the steps: 1) On your computer, install node.js, run npm install, and start grunt:

cd ./blue-guide/.grunt
npm install
grunt

2) Share (File > Share) and Publish (File > Publish) your Google Doc. Copy the key for your Spreadsheet (look in the url, ?key=0AlaP5UvLJD2wdG1JdFBxbHl5YTVxb0RYOUZBYlhYNUE)

3) Update the rev revision number in Replace the key on line 3 of main.coffee.

4) Replace the key on line 10 of GoogleSpreadsheetsQuery.coffee, with your key.

5) In main.coffee, move the comment on line 30 to line 42 so that it looks like this revision. If you would like to continue pulling your data from Google Spreadsheets permanently, you can stop here.

6) Go to your site (http://localhost/blue-guide) in Chrome, open up the Console (Inspect Element > Console tab), and enter these Javascript commands:

$('<textarea id="txt"></textarea>').prependTo('#filters');
$('#txt').text(JSON.stringify(query.data))

A textarea will appear with JSON code. Select all of the JSON code, copy and paste it into ./json/data.json, replacing the contents.

7) Undo your change in step #5. If everything went right, you should be able to see your points and filter based on your categories right out of the box.

jlyon commented 9 years ago

Also, make sure you are on the gh-pages branch. I had the default branch set to master previously by mistake.

sc456a commented 9 years ago

Jeff: Thanks for the update. I'm still unable to get updated data into the json file but that's a bit of a moot point since the process is far too complicated for an end user to be able to perform on a regular basis. Have you folks created any custom solutions for data entry/management, perhaps a back-end interface of some sort?

jlyon commented 9 years ago

If your dataset is small, I could probably set you up with a version that pulls directly from Google Docs. Send your doc id and I can take a look at setting this up. The Blue Guide dataset was too big to make this feasible.

I think it would be pretty easy to decouple all of the Google Doc import logic into a node.js script that would be simple to run (just one command from the terminal that would include the doc id). Probably around 5-10 hours of work.

We primarily work with the Drupal Content Management system. It would be well suited for the data entry/management end of this. We would make it export a JSON feed that the map app could run. If you're interested in learning more, send us an email at contact@albatrossdigital.com.