Coder Social home page Coder Social logo

commuter-network's People

Contributors

sdmccabe avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

commuter-network's Issues

clean up paths throughout code

  1. They're ugly.
  2. They'll present compatibility problems on Windows.

Ideally, rename state_fips_mapping.py to something like definitions.py, then use pathlib throughout to define directories.

SerialisationError when constructing tract network on macOS

Traceback (most recent call last):
  File "construct_tract_network.py", line 128, in <module>
    main(args)
  File "construct_tract_network.py", line 95, in main
    nx.write_graphml(G, f"data/derived/{args.output}/tract_commuter_flows.graphml")
  File "</Users/larock/miniconda3/envs/commuter_nets/lib/python3.8/site-packages/decorator.py:decorator-gen-658>", line 2, in write_graphml_lxml
  File "/Users/larock/miniconda3/envs/commuter_nets/lib/python3.8/site-packages/networkx/utils/decorators.py", line 240, in _open_file
    result = func_to_be_decorated(*new_args, **kwargs)
  File "/Users/larock/miniconda3/envs/commuter_nets/lib/python3.8/site-packages/networkx/readwrite/graphml.py", line 150, in write_graphml_lxml
    writer.dump()
  File "/Users/larock/miniconda3/envs/commuter_nets/lib/python3.8/site-packages/networkx/readwrite/graphml.py", line 696, in dump
    self._xml_base.__exit__(None, None, None)
  File "src/lxml/serializer.pxi", line 1347, in lxml.etree.xmlfile.__exit__
  File "src/lxml/serializer.pxi", line 1685, in lxml.etree._IncrementalFileWriter._close
  File "src/lxml/serializer.pxi", line 1691, in lxml.etree._IncrementalFileWriter._handle_error
  File "src/lxml/serializer.pxi", line 199, in lxml.etree._raiseSerialisationError
lxml.etree.SerialisationError: unknown error -1628709398

It seemed to produce valid output, despite the error.

Tools for directly reading metadata

Since this code downloads a bunch of very useful metadata, it would be nice if there were some basic functionality (or even just examples) of how to read that data. It is possible to learn from digging in to the scripts that construct the commuter networks, but maybe there could be a utilities.py that has functions like read_dfs in it to centralize reading in metadata and face those functions to the user.

handle aux files better in tract (and block?) networks

The aux files (people working in one state but residing in another) cause a boundary problem. The cleanest way is to have --states define the boundary, i.e., -s ma,me means only people residing and working in MA and ME. This is not the current behavior.

Ideas for making repo more useful and generic

The existing repository provides a series of scripts for downloading the data necessary for constructing the commuter network. It's fine but has major limitations:

  1. the CLI is a little finnicky.
  2. it's not naturally extensible (what about constructing the adjacency network,
    or the airline flow network, or whatever)?

This doesn't really need to be a command-line script; it's fine to run interactively, since you really only need to run it once to construct the edgelist. What would be better would be something like the following:

  1. define something like a SpatialNetworkConstructor class. It has three methods: download the relevant data, construct the relevant network,write the resulting network. (Actually, if construct returned a networkx object, we could just lean on its write_* functions).
  2. subclass the SpatialNetworkConstructor with a CommuterNetworkConstructor that implements the existing logic.
  3. create other subclasses that do the same thing, for other spatial network representations. Then, they have a consistent API.

The class object can store the relevant configuration information, like spatial resolution, the path the files get downloaded to, thresholding rules, etc.

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.