diff --git a/docs/source/api/activities.rst b/docs/source/api/activities.rst index c18caf60..51b82b2b 100644 --- a/docs/source/api/activities.rst +++ b/docs/source/api/activities.rst @@ -1,6 +1,14 @@ -FitTrackee API documentation -############################ +Activities +########## .. autoflask:: fittrackee_api:create_app() :endpoints: - activities.get_activities + activities.get_activities, + activities.get_activity, + activities.post_activity, + activities.post_activity_no_gpx, + activities.update_activity, + activities.delete_activity, + activities.get_map, + activities.get_activity_gpx, + activities.get_activity_chart_data diff --git a/docs/source/api/auth.rst b/docs/source/api/auth.rst new file mode 100644 index 00000000..c5c7dc6e --- /dev/null +++ b/docs/source/api/auth.rst @@ -0,0 +1,12 @@ +Authentication +############## + +.. autoflask:: fittrackee_api:create_app() + :endpoints: + auth.register_user, + auth.login_user, + auth.logout_user, + auth.get_user_status, + auth.edit_user, + auth.edit_picture, + auth.del_picture diff --git a/docs/source/api/index.rst b/docs/source/api/index.rst new file mode 100644 index 00000000..7806aad6 --- /dev/null +++ b/docs/source/api/index.rst @@ -0,0 +1,13 @@ +API documentation +################# + +.. toctree:: + :maxdepth: 2 + :caption: Endpoints: + + activities + auth + records + sports + stats + users diff --git a/docs/source/api/records.rst b/docs/source/api/records.rst new file mode 100644 index 00000000..c78be7c4 --- /dev/null +++ b/docs/source/api/records.rst @@ -0,0 +1,6 @@ +Records +####### + +.. autoflask:: fittrackee_api:create_app() + :endpoints: + records.get_records diff --git a/docs/source/api/sports.rst b/docs/source/api/sports.rst new file mode 100644 index 00000000..84a0b86c --- /dev/null +++ b/docs/source/api/sports.rst @@ -0,0 +1,10 @@ +Sports +###### + +.. autoflask:: fittrackee_api:create_app() + :endpoints: + sports.get_sports, + sports.get_sport, + sports.post_sport, + sports.update_sport, + sports.delete_sport diff --git a/docs/source/api/stats.rst b/docs/source/api/stats.rst new file mode 100644 index 00000000..0621d298 --- /dev/null +++ b/docs/source/api/stats.rst @@ -0,0 +1,7 @@ +Statistics +########## + +.. autoflask:: fittrackee_api:create_app() + :endpoints: + stats.get_activities_by_sport, + stats.get_activities_by_time diff --git a/docs/source/api/users.rst b/docs/source/api/users.rst new file mode 100644 index 00000000..09785889 --- /dev/null +++ b/docs/source/api/users.rst @@ -0,0 +1,9 @@ +Users +##### + +.. autoflask:: fittrackee_api:create_app() + :endpoints: + users.get_users, + users.get_single_user, + users.get_picture, + users.ping_pong diff --git a/docs/source/features.rst b/docs/source/features.rst new file mode 100644 index 00000000..250074de --- /dev/null +++ b/docs/source/features.rst @@ -0,0 +1,53 @@ +Features +######## + +Features list +~~~~~~~~~~~~~ +- Account creation (only standard user, not admin) +- 6 sports supported: + - Cycling (Sport) + - Cycling (Transport) + - Hiking + - Montain Biking + - Running + - Walking +- Activity creation by uploading a gpx file. An activity can even be created without gpx (the user must enter date, time, duration and distance) +- An activity can be displayed with map (if with gpx), weather (if the DarkSky API key is provided) and charts (speed and elevation) +- Activity edition and deletion. User can add a note +- Dashboard with month calendar displaying activities and record +- User statistics +- User records by sports: + - average speed + - farest distance + - longest duration + - maximum speed +- Activities list and filter + +**Notes:** +- only activity owner can see his activity +- no administration for now + + +Dashboard +~~~~~~~~~ + +.. figure:: ../../misc/images/fittrackee_screenshot-01.png + :alt: FitTrackee Dashboard + + +Activity/workout detail +~~~~~~~~~~~~~~~~~~~~~~~ +.. figure:: ../../misc/images/fittrackee_screenshot-02.png + :alt: FitTrackee Activity + + +Activities/workouts list +~~~~~~~~~~~~~~~~~~~~~~~~ +.. figure:: ../../misc/images/fittrackee_screenshot-03.png + :alt: FitTrackee Activities + + +Statistics +~~~~~~~~~~ +.. figure:: ../../misc/images/fittrackee_screenshot-04.png + :alt: FitTrackee Statistics diff --git a/docs/source/index.rst b/docs/source/index.rst index 9fcfe887..96f330a5 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -1,20 +1,56 @@ .. FitTrackee documentation master file, created by sphinx-quickstart on Sun Jul 14 14:43:43 2019. - You can adapt this file completely to your liking, but it should at least - contain the root `toctree` directive. -Welcome to FitTrackee's documentation! -====================================== + +FitTrackee +========== + +| |Python Version| |Flask Version| |React Version| +| |Codacy Badge| |Codacy Coverage Badge|\ 1 |Build Status| + + +| This web application allows you to track your outdoor activities from + gpx files and keep your data on your own server. +| No mobile app is developed yet, but several existing mobile apps can + store workouts data locally and export them into a gpx file. +| Examples (for Android): +| \* `Runner Up `__ (GPL v3) +| \* `ForRunners `__ (GPL v3) +| \* `AlpineQuest `__ (Proprietary, no + trackers according to `exodus privay + report `__) + +| Maps are displayed using `Open Street + Map `__. +| It is also possible to add a workout without a gpx file. + +| **Still under development (not ready for production).** +| (see `issues `__ for more information) + +.. figure:: ../../misc/images/fittrackee_screenshot-01.png + :alt: FitTrackee Dashboard + + +Table of contents +================= .. toctree:: :maxdepth: 2 - :caption: Contents: - api/activities + installation + features + api/index -Indices and tables -================== -* :ref:`genindex` -* :ref:`modindex` -* :ref:`search` +.. |Python Version| image:: https://img.shields.io/badge/python-3.7-brightgreen.svg + :target: https://python.org +.. |Flask Version| image:: https://img.shields.io/badge/flask-1.1-brightgreen.svg + :target: http://flask.pocoo.org/ +.. |React Version| image:: https://img.shields.io/badge/react-16.8-brightgreen.svg + :target: https://reactjs.org/ +.. |Codacy Badge| image:: https://api.codacy.com/project/badge/Grade/290a285f22e94132904dc13b4dd19d1d + :target: https://www.codacy.com/app/SamR1/FitTrackee +.. |Codacy Coverage Badge| image:: https://api.codacy.com/project/badge/Coverage/290a285f22e94132904dc13b4dd19d1d + :target: https://www.codacy.com/app/SamR1/FitTrackee +.. |Build Status| image:: https://travis-ci.org/SamR1/FitTrackee.svg?branch=master + :target: https://travis-ci.org/SamR1/FitTrackee diff --git a/docs/source/installation.rst b/docs/source/installation.rst new file mode 100644 index 00000000..190291c7 --- /dev/null +++ b/docs/source/installation.rst @@ -0,0 +1,112 @@ +Installation +############ + +This application is written in Python (API) and Javascript (client): + +- API: + - Flask + - `gpxpy `__ to parse gpx files + - `staticmap `__ to generate a static map image from gpx coordinates + - `python-forecast.io `__ to fetch weather data from `Dark Sky `__ (former forecast.io) +- Client: + - React/Redux + - `Leaflet `__ to display map + - `Recharts `__ to display charts with elevation and speed + +Sports and weather icons are made by Freepik from www.flaticon.com. + +Prerequisites +~~~~~~~~~~~~~ + +- PostgreSQL database (10+) +- Python 3.7+ +- `Yarn `__ and + `serve `__ +- API key from `ThunderForest `__ +- API key from `Dark Sky `__ [not mandatory] + + +Installation +~~~~~~~~~~~~ + +| The following steps describe an installation on Linux systems (tested + on Debian and Arch). +| On other OS, some issues can be encountered and adaptations may be + necessary. + +Dev environment +^^^^^^^^^^^^^^^ + +- Clone this repo: + +.. code:: bash + + $ git clone https://github.com/SamR1/FitTrackee.git + $ cd FitTrackee + +- Update **Makefile.config** file if needed and copy/paste the + **ThunderForest** and **Dark Sky** API keys value in + **Makefile.custom.config** file (see example) + +- Install Python virtualenv, React and all related packages and + initialize the database: + +.. code:: bash + + $ make install-dev + $ make install-db + +- Start the server and the client: + +.. code:: bash + + $ make serve + +Open http://localhost:3000 and login (the email is ``admin@example.com`` +and the password ``mpwoadmin``) or register + +Prod environment +^^^^^^^^^^^^^^^^ + +- Download the last release (for now it is the beta release v0.2.1): + +.. code:: bash + + $ wget https://github.com/SamR1/FitTrackee/archive/v0.2.1-beta.tar.gz + $ tar -xzf v0.1.1-beta.tar.gz + $ mv FitTrackee-0.1.1-beta FitTrackee + $ cd FitTrackee + +- Update **Makefile.config** file if needed and copy/paste the + **ThunderForest** and **Dark Sky** API keys value in + **Makefile.custom.config** file (see example) + +- Install Python virtualenv, React and all related packages and + initialize the database: + +.. code:: bash + + $ make install + $ make install-db + +- Build the client: + +.. code:: bash + + $ make build-client + +- Start the server and the client: + +.. code:: bash + + $ make run + +Open http://localhost:3000, log in as admin (the email is +``admin@example.com`` and the password ``mpwoadmin``) and change the +password + +Upgrade +~~~~~~~ + +``TODO`` + diff --git a/fittrackee_api/fittrackee_api/activities/activities.py b/fittrackee_api/fittrackee_api/activities/activities.py index 5bf1e55f..0491069b 100644 --- a/fittrackee_api/fittrackee_api/activities/activities.py +++ b/fittrackee_api/fittrackee_api/activities/activities.py @@ -38,7 +38,7 @@ def get_activities(auth_user_id): .. sourcecode:: http - GET /api/activities?&page=1&per_page=10&from=2019-07-02&to=2019-07-31&sport_id=1 HTTP/1.1 + GET /api/activities?from=2019-07-02&to=2019-07-31&sport_id=1 HTTP/1.1 **Example responses**: @@ -140,7 +140,7 @@ def get_activities(auth_user_id): :param integer auth_user_id: authenticate user id :query integer page: page if using pagination (default: 1) - :query integer per_page: number of activities returned per page (default: 5) + :query integer per_page: number of activities per page (default: 5) :query integer sport_id: sport id :query string from: start date (format: `%Y-%m-%d`) :query string to: end date (format: `%Y-%m-%d`) @@ -152,7 +152,7 @@ def get_activities(auth_user_id): :query float ave_speed_to: maximal average speed :query float max_speed_from: minimal max. speed :query float max_speed_to: maximal max. speed - :query string order: sorting order (default: 'desc') + :query string order: sorting order (default: `desc`) :reqheader Authorization: OAuth 2.0 Bearer Token