LACMTA / metro-api-v2

Docs: https://lacmta.github.io/metro-api-v2/ Dev: https://dev-metro-api-v2.ofhq3vd1r7une.us-west-2.cs.amazonlightsail.com/docs
https://api.metro.net/docs
0 stars 3 forks source link

Refactor get_route_details and get_stop_times_by_route_code_and_agency functions #522

Closed albertkun closed 4 months ago

albertkun commented 4 months ago

This pull request refactors the get_route_details function in crud.py and the get_route_details endpoint. it is going from:

{
  "stop_times": [
    [
      "De Soto / Burbank",
      [
        "21:15:00",
        "21:35:00",
        "21:55:00"
      ],
      "6010003_DEC23"
    ],
    [
      "Burbank / Warner Ranch",
      [
        "21:16:00"
      ],
      "6010003_DEC23"
    ],

to

{
  "stop_times": [
    [
      "De Soto / Burbank",
      {
        "times": [
          "21:15:00"
        ],
        "shape_id": "6010001_DEC23"
      }
    ],
    [
      "De Soto / Burbank",
      {
        "times": [
          "21:35:00",
          "21:55:00",
        ],
        "shape_id": "6010003_DEC23"
      }
    ],

with more clearly labelled results.