Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Models for Lokniti Data #20

Merged
merged 31 commits into from
May 14, 2024
Merged

Models for Lokniti Data #20

merged 31 commits into from
May 14, 2024

Conversation

vaeyias
Copy link
Contributor

@vaeyias vaeyias commented May 13, 2024

Main Changes:

  • increase width of competitiveness map
    image

  • added models for codebook, responders, and responses

    • the Codebook and Responders are working by themselves, but the load_responses function requires changes to be made to the Responders for it to work
    • Also added an endpoint that can be used to grab all Responders by a specific election year and constituency
  • started creating a map of the most prominent caste in each constituency during each election year, the data being displayed onClick and onHover is accurate, but the color assignments on the map are not accurate
    image

  • made the GradientLegend more generalized (replacing variables specific to the competitiveness map with props)

To-do

  • Implementing the rest of load_responders for load_responses to work
    • after that, new visualizations for party vote distribution based on caste and vice versa
  • (If we actually want the map of caste distributions) Finish implementing the caste distribution map by debugging the color assignment code in CasteMap.js (fetchMoreFeatures and getColor functions).

vaeyias and others added 14 commits April 30, 2024 11:43
- load_responders in progress
-load_responses in progress
- added a col name to the first col of every lokniti data file representing an entry number

-renamed each data file for convenience
- created one load command that can be used for all election year files

-fix typo in 2019 codebook

-change income from float to char field

- add ps_id attribute to responders
-accidentally removed in last commit (oops)
- made the getColor function and some other variables props
- added an api endpoint to retrieve a responder sbased on constituency and year
- INCOMPLETE

- started implementing a map that colors each constituency based on what caste is the most prevalent in that constiutency during that year.

- general logic is completed, but coloring seems inaccurate for some entries

- the data being displayed on click and hover is accurate.
@vaeyias vaeyias linked an issue May 13, 2024 that may be closed by this pull request
3 tasks
@vaeyias vaeyias requested a review from JusticeV452 May 13, 2024 21:58
@JusticeV452
Copy link
Member

Thanks for getting this in! Since we're wrapping up and I need to redeploy the site, I'll make edits and leave comments if I see anything I think should be changed rather than requesting changes.

- Also changed load_responders to check if responder is a duplicate before saving
-
- Response does not need respondent_no and election year since they are accessible through Responder foreign key
- Also adjusted views to work with model change (removing election_year as Response attribute)
- Also added update_config for loading responders and responses
- Also removed deprecated attributes from Responses serializer
@vaeyias
Copy link
Contributor Author

vaeyias commented May 14, 2024

I think there could be some state names that don't match the exact state names in the 2014/2019 files and that is why a lot of the data is missing.

I put whatever caste data we currently have into two files on the backend so that the map loads faster. However, the data currently displayed especially for 2014/2019 looks incomplete.

@JusticeV452
Copy link
Member

Okay, thanks. We might be able to resolve that later by using what looks like the unique state id in the state_name string.

Copy link
Member

@JusticeV452 JusticeV452 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for getting this last visualization in, especially considering the tight timeline! I'm not sure what caused the map colors to be inconsistent with the data for you, but it looks fine on my end. A few things, particularly the MapBase/MapBaseCaste, could be refactored to reduce duplicate code, but that's something people working on the project in the future can address.

@JusticeV452 JusticeV452 merged commit 1d93229 into main May 14, 2024
4 checks passed
@JusticeV452 JusticeV452 deleted the lokniti-data branch May 14, 2024 22:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Making database models for the Lokniti question data
3 participants