Giter Club home page Giter Club logo

gmnspy's Introduction

GMNSpy

Python tool for General Modeling Network Specification (GMNS) developed by Zephyr Foundation for Travel Analysis.

Installation

git clone https://github.com/e-lo/GMNSpy.git
cd GMNSpy
pip install .

Usage

Read a single file

Returns a dataframe that conforms to the specified schema and have been validated.

df = gmnspy.in_out.read_gmns_csv(data_filename, schema_file=schemafilename)

Read a network

Returns a dictionary of dataframes that conform to the specified schema and have been validated.

Checks foreign keys between files.

net = gmnspy.in_out.read_gmns_network(data_directory, config: "gmns.spec.json")

GMNS specification

A copy of the GMNS specification is kept in the /spec sub-directory as a series of JSON tables.

Data Table schemas

Data table schemas are specified in JSON and are compatible with the frictionless data table schema standards.

Example:

{
    "primaryKey": "segment_id",
    "missingValues": ["NaN",""],
    "fields": [
        {
            "name": "segment_id",
            "type": "any",
            "description": "Primary key.",
            "constraints": {
              "required": true,
              "unique": true
              }
        },
        {
            "name": "road_link_id",
            "type": "any",
            "description": "Required. Foreign key to road_links. The link that the segment is located on.",
            "foreign_key": "link.link_id",
            "constraints": {
              "required": true
              }
        },
        {
            "name": "ref_node_id",
            "type": "any",
            "description": "Required. Foreign key to node.",
            "foreign_key": "node.node_id",
            "constraints": {
              "required": true
              }
        },
        {
            "name": "start_lr",
            "type": "number",
            "description": "Required. Distance from ref_node_id.",
            "constraints": {
              "required": true,
              "minimum": 0
              }
        },
        {
            "name": "end_lr",
            "type": "number",
            "description": "Required. Distance from ref_node_id.",
            "constraints": {
              "required": true,
              "minimum": 0
              }
          }
    ]
}

Network Data Config

Network data schemas are specified in JSON and are compatible with the frictionless data data package standards.

Example:

{
  "profile": "gmns-data-package",
  "profile_version":0.0,
  "name": "my-dataset",
  "resources": [
   {
     "name":"link",
     "path": "link.csv",
     "schema": "link.schema.json",
     "required": true
   },
   {
     "name":"node",
     "path": "node.csv",
     "schema": "node.schema.json",
     "required": true
   }
 ]
}

Issues

Please add issues, bugs, and feature requests to Github.

Roadmap

Current feature roadmap includes:

  • conversion tools from open street map
  • network connectivity checks
  • auto documentation of schema to markdown files
  • tests tests tests

Feel free to submit pull requests for consideration. See CONTRIBUTING for more detailed instructions.

Credits

Primary Author: Elizabeth Sall, UrbanLabs LLC

Contributing authors and code maintainers:

  • Pedro Carmago, OuterLoop Consulting
  • Ian Berg, Volpe Center

See all in CONTRIBUTORS.md

License to Use

The code herein is licensed under the Apache License 2.0 as defined in file.

gmnspy's People

Contributors

e-lo avatar ianberg-volpe avatar pedrocamargo avatar jamiecook avatar

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.