I am trying to create a website in which a visitor can click a state in the US map and it gives you a statistics and information about the candidate that ran in the state's election in a given year. I already have a image map and I will add a java script function that takes year and the race's district as arguments.
I am trying to do this in django and Google App Engine and I mainly code in python.
I have put gathered and put together those data in .json file thinking that I can do something similar toopen("path.json", "r")
in python and just pass the data. But I am not quiet sure how do it to and whether its even possible to do such thing. As I did some googling, I am starting to wonder if I need to use database. Should I use database and if I have to, RDB or NoSQL? In addition, how should I feed the data in json to the database.
json file looks like this
{
"AL": {
"api_version": "1.0",
"pagination": {
"count": 7,
"pages": 1,
"per_page": 100,
"page": 1
},
"results": [
{
"party": "REP",
"last_f2_date": "2015-12-09",
"election_districts": [
"00"
],
"load_date": "2018-02-17T09:16:20+00:00",
"party_full": "REPUBLICAN PARTY",
"first_file_date": "2015-12-09",
"office": "S",
"incumbent_challenge": "C",
"district_number": 0,
"office_full": "Senate",
"candidate_status": "N",
"active_through": 2016,
"candidate_id": "S6AL00336",
"state": "AL",
"election_years": [
2016
],
"federal_funds_flag": false,
"incumbent_challenge_full": "Challenger",
"flags": "S6AL00336",
"district": "00",
"cycles": [
2016,
2018
],
"last_file_date": "2015-12-09",
"has_raised_funds": true,
"name": "BOWMAN, MARCUS",
"operating_expenditure": 770.0,
"primary_votes": "[19707]",
"primary_sahre": "[0.0253026573760578]",
"general_votes": "[' ']",
"general_sahre": "[' ']"
},
{
"party": "DEM",
"last_f2_date": "2015-04-03",
"election_districts": [
"00"
],
"load_date": "2018-02-17T09:16:20+00:00",
"party_full": "DEMOCRATIC PARTY",
"first_file_date": "2015-04-03",
"office": "S",
"incumbent_challenge": "C",
"district_number": 0,
"office_full": "Senate",
"candidate_status": "P",
"active_through": 2016,
"candidate_id": "S6AL00302",
"state": "AL",
"election_years": [
2016
],
"federal_funds_flag": false,
"incumbent_challenge_full": "Challenger",
"flags": "S6AL00302",
"district": "00",
"cycles": [
2016,
2018,
2020
],
"last_file_date": "2015-04-03",
"has_raised_funds": true,
"name": "CRUMPTON, RONALD (RON) STEVEN",
"operating_expenditure": 33668.0,
"primary_votes": "[153897]",
"primary_sahre": "[0.560802119355885]",
"general_votes": "[748709.0]",
"general_sahre": "[0.358672615888139]"
},
Aucun commentaire:
Enregistrer un commentaire