Skip to content
This repository has been archived by the owner on Sep 17, 2024. It is now read-only.

Adding Interactive Map with cases #14

Closed
wants to merge 12 commits into from
Closed

Adding Interactive Map with cases #14

wants to merge 12 commits into from

Conversation

ellisonleao
Copy link
Contributor

Ref #5

Questions:

  • Are the lat/lng numbers going to be added on the base spreadsheet or should we get them inside the serialize_cases function?
  • Are we going to use custom marker icons ?
  • What information should the marker popups have?

I've opened the pull request with some already things changed, which includes:

  • creating new /map route
  • added a link to the map route on top of the cases list
  • created initial map (no markers yet)

@cuducos
Copy link
Collaborator

cuducos commented Oct 11, 2018

Are the lat/lng numbers going to be added on the base spreadsheet or should we get them inside the serialize_cases function?

By now I think we could get them when processing the spreadsheet — unless until we find a better solution. My rational for that is that converting city names to geo-coordinates is a task that looks like more proper for machines (serialize_cases) than humans. The alternative would be to have a third tab/spreadsheet with all the coordinates of all Brazilian cities. What do you think, @turicas?

Are we going to use custom marker icons ?

Not at this point, but we can implement it later ; )

What information should the marker popups have?

Suggestion: the headline of case.main_story?


One more suggestion: I see no need for victims/static/map.css – This coded could be inside victims/static/styles.css with no harm IMHO ; )

* upstream/master: (25 commits)
  Add codecov.yml
  Add meta tags for social media
  Add codcov Python package
  Enhance visibility for footer logos
  Format Python code with Black
  Strong the order
  Fix when sort (reverse)
  Run black
  Add paragraph
  Randomize stories inside each case
  Round robin cases by aggressor_side
  Add agressor_side to Case
  fix footer
  Mobile styles
  Typo: gray -> grey
  Add success message to clear cache script
  Fix quotes on Google Analytics code
  Move other project links to about page
  Add about page
  Add tag color
  ...
* upstream/master:
  Add Docker for production
  Small tweak for big displays
  Simplify font-size
  add font math thanks to https://css-tricks.com/snippets/css/fluid-typography/
  Transform flex istead of changing to block on footer style
* upstream/master:
  Use HTTP in metatags
  Fix og:image (full URL)
  Fix og:image
  Makes Sanic enforce HTTPS
  Change FOSS messge at the bottom
  Remove Agência Pública's spreadsheet link
* upstream/master:
  Add sample spreadsheet
  Cleanup
  Refactor Data class
  Escape HTML chars
@ellisonleao
Copy link
Contributor Author

ellisonleao commented Oct 11, 2018

@cuducos the changes you've asked are already made, i am just waiting for the new spreadsheet template so i can update the data model and add the markers on frontend.

Also, i am not sure if it would be better to squash all commits into a single one at the end.

@turicas
Copy link
Contributor

turicas commented Oct 11, 2018

@ellisonleao you can just add a column called "latlon" to "Casos" spreadsheet and collect data from there (it's going to be a list of floats on the model).

* upstream/master:
  Add links to the about page
  Format Python code with Black
  Update methodology
@ellisonleao
Copy link
Contributor Author

ellisonleao commented Oct 12, 2018

@turicas are we going to use | as separator for the float numbers, just like we have for tags? e.g:-12.12|5.34

@turicas
Copy link
Contributor

turicas commented Oct 12, 2018

@ellisonleao I think the best would be "," because:
1- Numbers will not have "," inside them (but tags could have) since the decimal separator is "."; and
2- A lot of geolocation systems use "," so we can easily copy and paste.

@ellisonleao
Copy link
Contributor Author

ellisonleao commented Oct 12, 2018

@cuducos @turicas i've added the markers code and the serialization of the latlon field. What extra information do you think we need on the maps page? Right now there is only the map and the button for the cases form.

One probably issue is that we will need to group the cases by city/state in order for all them to show if we have multiple cases in the same city. Maybe a property function in the Cases data model could take care of getting that data correct

@ellisonleao ellisonleao changed the title (Do not merge) Adding Interactive Map with cases Adding Interactive Map with cases Oct 12, 2018
@cuducos
Copy link
Collaborator

cuducos commented Oct 15, 2018

Maybe a property function in the Cases data model could take care of getting that data correct

I think this sounds like a good way of implementing it.

I tried to run your branch but it throws a NameError: name 'cached' is not defined in victims/__init__.py and there are some tests failing. So I'm afraid I can test anything further ATM. But let me know if you need anything else.

* master:
  limit story description. Ref #24
  Force close Redis connections
  Replace aiocache by aioredis
  Remove REDIS_DB envvar
- adding latlon column on cases fixtur
# serializing latitude and longitude
data["latlng"] = data["latlng"].strip() or ""
data["latlng"] = data["latlng"].split(",")
data["latlng"] = list(map(float, data["latlng"]))
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this is slightly more readable, what do you think?

Suggested change
data["latlng"] = list(map(float, data["latlng"]))
data["latlng"] = [float(coord) for coord in data["latlng"]]

Copy link
Collaborator

Choose a reason for hiding this comment

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

BTW if this column is empty this line breaks the app… we might need something for this edge case ; )

Copy link
Contributor Author

@ellisonleao ellisonleao Oct 17, 2018

Choose a reason for hiding this comment

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

Yes! I've started by adding some try/exceptions for ValueError exceptions but i am not sure what you guys prefer.

@ellisonleao
Copy link
Contributor Author

ellisonleao commented Oct 18, 2018

I think this sounds like a good way of implementing it.

actually i am not sure right now if adding a function over there will be the best. Is there a unique element that we can use as the aggregator for same city cases (latlng, city, etc) ? What about just adding that logic to aggregate the cases by city in the map route function for now?

@baralhao
Copy link

hi guys

I made a dashboard with map and some informations. I will appreciate your feedback.

cya
eduardo medeiros

http://bit.ly/VitimasIntolerancia

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants