GithubHelp home page GithubHelp logo

giladpomer / railway-interlocking-service Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 89 KB

A Node.js web service implementing the central functionality of a railway interlocking.

JavaScript 100.00%

railway-interlocking-service's Introduction

Railway Interlocking Web Service

A Node.js web service implementing the central functionality of a railway interlocking.

The service checks for conflicts while assuming the worst case scenario:

  • It is possible to travel in all directions between track points.
  • Trains can travel in both directions, but only one track exists between the two points. so if a section is occupied, it's considered to be occupied in both directions.

Try it now!

Please note that the web service sleeps when it's not frequently called. Calling an endpoint will start the service (this can take around 40 seconds for the first call)

The web service is available at https://railway-interlocking-service.onrender.com/

Calling the service

There is currently only one endpoint available /check_conflicts

Please call the service in the same structure described below:

curl -X POST https://railway-interlocking-service.onrender.com/check_conflicts \
 -H 'content-type: application/json' -d \
'
{
        "station_graph": [
            { "start": "Station West", "end": "Entry Signal West" },
            { "start": "Entry Signal West", "end": "Point 1" },
            { "start": "Point 1", "end": "Exit Signal West 1" },
            { "start": "Point 1", "end": "Exit Signal West 2" },
            { "start": "Exit Signal West 1", "end": "Exit Signal East 1" },
            { "start": "Exit Signal West 2", "end": "Exit Signal East 2" },
            { "start": "Exit Signal East 1", "end": "Point 2" },
            { "start": "Exit Signal East 2", "end": "Point 2" },
            { "start": "Point 2", "end": "Entry Signal East" },
            { "start": "Entry Signal East", "end": "Station East" }
        ],
        "routes": [
            { "start": "Entry Signal West", "end": "Exit Signal East 1", "occupied": false },
            { "start": "Entry Signal West", "end": "Exit Signal East 2", "occupied": false },
            { "start": "Exit Signal East 1", "end": "Station East", "occupied": false },
            { "start": "Exit Signal East 2", "end": "Station East", "occupied": false },
            { "start": "Entry Signal East", "end": "Exit Signal West 1", "occupied": false },
            { "start": "Entry Signal East", "end": "Exit Signal West 2", "occupied": false },
            { "start": "Exit Signal West 1", "end": "Station West", "occupied": true },
            { "start": "Exit Signal West 2", "end": "Station West", "occupied": false }
        ],
        "check_route": {
            "start": "Entry Signal West",
            "end": "Exit Signal East 2"
        }
}
'

Continuous Integration (CI)

All jest unit tests will automatically run on every push to this GitHub repository before trying to deploy.

Continuous Deployment (CD)

The repository is automatically deployed on every successful push (all tests passing) to this GitHub repository using render.

External Packages

railway-interlocking-service's People

Contributors

giladpomer avatar

Watchers

 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.