{"id":16740253,"url":"https://github.com/evansiroky/gtfs-sequelize","last_synced_at":"2025-03-23T15:31:03.405Z","repository":{"id":57256483,"uuid":"37239092","full_name":"evansiroky/gtfs-sequelize","owner":"evansiroky","description":"A model of the static GTFS using sequelize.","archived":false,"fork":false,"pushed_at":"2018-01-15T19:13:11.000Z","size":154,"stargazers_count":19,"open_issues_count":2,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-18T21:50:58.172Z","etag":null,"topics":["gtfs","sequelize"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/evansiroky.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-06-11T04:23:02.000Z","updated_at":"2024-10-15T02:07:18.000Z","dependencies_parsed_at":"2022-08-25T02:30:50.145Z","dependency_job_id":null,"html_url":"https://github.com/evansiroky/gtfs-sequelize","commit_stats":null,"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evansiroky%2Fgtfs-sequelize","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evansiroky%2Fgtfs-sequelize/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evansiroky%2Fgtfs-sequelize/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evansiroky%2Fgtfs-sequelize/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/evansiroky","download_url":"https://codeload.github.com/evansiroky/gtfs-sequelize/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245122713,"owners_count":20564360,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gtfs","sequelize"],"created_at":"2024-10-13T00:57:16.649Z","updated_at":"2025-03-23T15:31:03.159Z","avatar_url":"https://github.com/evansiroky.png","language":"JavaScript","funding_links":[],"categories":["Producing Data","Uncategorized"],"sub_categories":["GTFS","Uncategorized"],"readme":"# gtfs-sequelize\n\n[![npm version](https://badge.fury.io/js/gtfs-sequelize.svg)](http://badge.fury.io/js/gtfs-sequelize) [![Build Status](https://travis-ci.org/evansiroky/gtfs-sequelize.svg?branch=master)](https://travis-ci.org/evansiroky/gtfs-sequelize) [![Dependency Status](https://david-dm.org/evansiroky/gtfs-sequelize.svg)](https://david-dm.org/evansiroky/gtfs-sequelize) [![Test Coverage](https://codeclimate.com/github/evansiroky/gtfs-sequelize/badges/coverage.svg)](https://codeclimate.com/github/evansiroky/gtfs-sequelize/coverage)\n\nA model of the static GTFS using [sequelize.js](http://sequelizejs.com/).\n\nCurrently works only with PostgreSQL (including PostGIS), MySQL (with spatial capabilities) and sqlite (but NOT spatialite).\n\n## Table of Contents\n\n* [Installation](#installation)\n* [API](#api)\n\n## Installation\n\nIn order to use this library, you must also install the additional libraries in your project depending on the database that you use.\n\n### PostgreSQL\n\n    npm install pg --save\n    npm install pg-copy-streams --save\n    npm install pg-query-stream --save\n    npm install pg-hstore --save\n\n#### With pg and node v0.10.x\n\nYou must also install the package `promise-polyfill` and write additional code.  See [here](https://github.com/brianc/node-postgres/issues/1057) for more details.\n\n### MySQL\n\n    npm install mysql --save\n    npm install streamsql --save\n\n### SQLite\n\n    npm install sqlite3 --save\n    npm install streamsql --save\n\nUsage with SQLite requires that sqlite is installed and is available via a unix command line.\n\n## API:\n\n### GTFS(options)\n\nCreate a new GTFS API.\n\nExample:\n\n```js\nvar GTFS = require('gtfs-sequelize');\n\nvar pgConfig = {\n  database: 'postgres://gtfs_sequelize:gtfs_sequelize@localhost:5432/gtfs-sequelize-test',\n  downloadsDir: 'downloads',\n  gtfsFileOrFolder: 'google_transit.zip',\n  spatial: true,\n  sequelizeOptions: {\n    logging: false\n  }\n}\n\nvar gtfs = GTFS(pgConfig);\ngtfs.loadGtfs(function() {\n  //database loading has finished callback\n});\n```\n\n#### options\n\n| Key | Value |\n| -- | -- |\n| database | A database connection string.  You must specify a user and a database in your connection string.  The database must already exist, but the tables within the db do not need to exist. |\n| downloadsDir | The directory where you want the feed zip fils downloaded to or where you're going to read the feed read from. |\n| gtfsFileOrFolder | The (zip) file or folder to load the gtfs from |\n| interpolateStopTimes | Default is undefined.  If true, after loading the stop_times table, all stop_times with undefined arrival and departure times will be updated to include interpolated arrival and departure times. |\n| sequelizeOptions | Options to pass to sequelize.  Note: to use a specific schema you'll want to pass something like this: `{ schema: 'your_schema' }` |\n| spatial | Default is undefined.  If true, spatial tables for the shapes and stops will be created. |\n\n### gtfs.connectToDatabase()\n\nReturn a sequelize api of the database.\n\nExample:\n\n```js\nvar db = gtfs.connectToDatabase()\n\ndb.stop.findAll()\n  .then(stops =\u003e {\n    console.log(stops)\n  })\n```\n\n### gtfs.downloadGtfs(callback)\n\nIf a url is provided, the feed will be attempted to be downloaded.  Works with `http`, `https` and `ftp`.\n\n### gtfs.interpolateStopTimes(callback)\n\nInterpolate stop_times with undefined arrival and departure times.  If you load a gtfs with the `interpolateStopTimes` flag set to true, you don't need to call this.\n\n### gtfs.loadGtfs(callback)\n\nLoad the gtfs into the database.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevansiroky%2Fgtfs-sequelize","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fevansiroky%2Fgtfs-sequelize","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevansiroky%2Fgtfs-sequelize/lists"}