An application where you can view journey details and station details generated by bikes in Helsinki Capital area.
Dataset is downloaded from here:
- https://dev.hsl.fi/citybikes/od-trips-2021/2021-05.csv
- https://dev.hsl.fi/citybikes/od-trips-2021/2021-06.csv
- https://dev.hsl.fi/citybikes/od-trips-2021/2021-07.csv
License and Other helpful info:
- Dataset: https://opendata.arcgis.com/datasets/726277c507ef4914b0aec3cbcfcbfafc_0.csv
- License and information: https://www.avoindata.fi/data/en/dataset/hsl-n-kaupunkipyoraasemat/resource/a23eef3a-cc40-4608-8aa2-c730d17e8902
- List journeys data.
- For each journey departure and return stations, covered distance in kilometers and duration in minutes has been shown
- Pagination
- Ordering per column
- Searching
- Filtering
- List all the stations
- Pagination
- Searching
- Station name
- Station address
- Total number of journeys starting from the station
- Total number of journeys ending at the station
- Station location on the map
- The average distance of a journey starting from the station
- The average distance of a journey ending at the station
- Top 5 most popular return stations for journeys starting from the station
- Top 5 most popular departure stations for journeys ending at the station
- Endpoints to store new bicycle stations after authenticating
- Dockerization of app
- Authentication
- Implemented E2E tests
- UI for Adding bicycle stations
- Station deletion by user who created it
Project has been deployed using fly.io Live URL: https://helsinki-city-bike.fly.dev/
CI pipeline has been setup using github actions: https://github.com/sirbh/helsinki-city-bike/actions
Docker can be used to setup the dev environment. Make sure you have docker installed and running.
Sql script is present in db/init.sql
which perform validation on data before presenting.
First copy following files in db/files
of project root.
- https://dev.hsl.fi/citybikes/od-trips-2021/2021-05.csv
- https://dev.hsl.fi/citybikes/od-trips-2021/2021-06.csv
- https://dev.hsl.fi/citybikes/od-trips-2021/2021-07.csv
- https://opendata.arcgis.com/datasets/726277c507ef4914b0aec3cbcfcbfafc_0.csv (rename this file to stations.csv)
To start dev server simply run the following command in terminal opened in root of project directory:-
docker compose -f docker-compose.dev.yml up
after running the above command the app will be live on http://localhost:3000/
- stop and rerun backend container if app shows error message.
For testing separate docker file has been created. To run the test simply run the following command in the root.
docker compose -f docker-compose.test.yml up -d
The above command will setup the test environment in docker
To run test start container backend-test
in interactive mode using following command
docker exec -it backend-test bash
After running above command you can access the terminal to the already running backend server
- Unit test can be run by
npm run test
- End-to-end test can be run by
npm run test:e2e
There is a sql file in test-db/init.sql
which add few records of data required for testing.
Output of both the test command can also be viewed on github action page.
-https://github.com/sirbh/helsinki-city-bike/blob/master/timeKeeping.md
I plan to further enhance this application; however, I have already invested over 175 hours in its development, and therefore, I am submitting it.
- Functionality to add stations with help of GooglePlaces API.
- Functionality to add journeys.
- Cypress test can be moved into its own folder.
- Performance can be improved using hooks like
useMemo
anduseCallback
. - Adding authentication so that only some privileged user can add stations and journeys.
- More validations can be added to database.
- Relations can be added to database.
- Swagger can be added for API management.
- API security can be added as at the moment anyone can access the API.