Giter Site home page Giter Site logo

mobility_pipeline's People

Contributors

andyjin2000 avatar laikhtewari avatar u8nwxd avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mobility_pipeline's Issues

Write Code to Validate Input Datafiles

We should have code that at minimum spot-checks the data files to give some assurance they are in the expected format. We should validate:

  • Mobility data file
  • Country shapefile
  • Towers data file
  • Voronoi file

Shapely type hinting

MyPy does not appear to support type hinting shapely, so for now we will tell mypy to ignore shapely with # type: ignore at the end of the import statement. Ideally, we will somehow add type hinting support for shapely by providing stub files. Related to #1.

Write matrix multiplication function

Write a function to make the admin-to-admin matrix from:

  • tower-to-tower mobility matrix
  • admin-to-tower overlap matrix
  • tower-to-admin overlap matrix

The main purpose of this function is for clarity and documentation, not code reuse. Matrix multiplication can be done with numpy. Assume all input matrices are numpy matrices.

Introductory Documentation

Write introductory documentation for our project to introduce developers to our codebase. Write in restructured text.

Example:

The documentation should include:

  • What the code is capable of doing
  • General organization and layout of the code
  • Terms and technical paradigm
  • Where to get the datasets
  • How to use utility code (e.g. plotting)
  • How to use the program

Find what Layer IDs Are

Add console.log() statements to the setVisibleLayers action to figure out what the IDs are. Specifically, we are looking for how the IDs relate to the contents of the JSON file.

Fix Filepaths and Import Paths

Loading data from filepaths and importing modules should work no matter how the script is run (i.e. from terminal or through PyCharm, from inside or outside the directory)

Toggle Layer Visibility on Click

Pick some layer that is already in the JSON and make it visible when any admin region is clicked. This might be possible by adding the layer ID to the list of currently visible layers (probably stored in state) and passing the new list to setVisibleLayers.

Compute Polygon Overlap

Write a function to compute the overlap between one polygon and a list of polygons

Parameters:

  • enclosing: A MultiPolygon
  • polygons: A list of MultiPolygon objects, each of which may overlap with enclosing

Return: A list of percentages such that the percentage at index i is the percent area of polygons[i] that is within enclosing.

Allow Saving Tower-to-Admin and Admin-to-Tower Matrices

It will be common for a user to want to compute admin-to-admin matrices for many days, but the current code requires that they re-compute the admin-to-tower and tower-to-admin matrices each time. This is the most inefficient part, and it only needs to happen once per country. The program should save off those files and let the user specify (or auto-detect) when they have already been generated.

Create one script to run once per country, which would:

  • Takes command-line args: identifier shapefile_path_prefix voronoi_path
    • shapefile_path_prefix: The .shp and .dbf files should be at [shapefile_path_prefix].shp and [shapefile_path_prefix].dbf
      • If user specifies full path to .shp or .dbf files, should strip extension
  • Convert shapefile to JSON
    • Save as [identifier]-shape.json
  • Compute tower-to-admin
    • Save as [identifier]-tower-to-admin.csv
  • Compute admin-to-tower
    • Save as [identifier]-admin-to-tower.csv

And a second script to run once for each day, which would:

  • Takes command-line args: identifier tower_prefix mobility_path
  • Reads in tower-to-admin and admin-to-tower using identifier and searching DATA_PATH for the filenames defined above
  • Compute admin-to-admin, save as [identifier]-admin-to-admin.csv

All paths relative to the DATA_PATH constant, except for command-line args.

Finally, create a wrapper script that caches the outputs from the first script

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.