update documentation

This commit is contained in:
Sam 2019-07-14 18:18:41 +02:00
parent 8b8d343864
commit 1a0955ff6a
11 changed files with 283 additions and 17 deletions

View File

@ -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

12
docs/source/api/auth.rst Normal file
View File

@ -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

13
docs/source/api/index.rst Normal file
View File

@ -0,0 +1,13 @@
API documentation
#################
.. toctree::
:maxdepth: 2
:caption: Endpoints:
activities
auth
records
sports
stats
users

View File

@ -0,0 +1,6 @@
Records
#######
.. autoflask:: fittrackee_api:create_app()
:endpoints:
records.get_records

View File

@ -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

View File

@ -0,0 +1,7 @@
Statistics
##########
.. autoflask:: fittrackee_api:create_app()
:endpoints:
stats.get_activities_by_sport,
stats.get_activities_by_time

View File

@ -0,0 +1,9 @@
Users
#####
.. autoflask:: fittrackee_api:create_app()
:endpoints:
users.get_users,
users.get_single_user,
users.get_picture,
users.ping_pong

53
docs/source/features.rst Normal file
View File

@ -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

View File

@ -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 <https://github.com/jonasoreland/runnerup>`__ (GPL v3)
| \* `ForRunners <https://gitlab.com/brvier/ForRunners>`__ (GPL v3)
| \* `AlpineQuest <https://www.alpinequest.net/>`__ (Proprietary, no
trackers according to `exodus privay
report <https://reports.exodus-privacy.eu.org/reports/2975/>`__)
| Maps are displayed using `Open Street
Map <https://www.openstreetmap.org>`__.
| It is also possible to add a workout without a gpx file.
| **Still under development (not ready for production).**
| (see `issues <https://github.com/SamR1/FitTrackee/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

View File

@ -0,0 +1,112 @@
Installation
############
This application is written in Python (API) and Javascript (client):
- API:
- Flask
- `gpxpy <https://github.com/tkrajina/gpxpy>`__ to parse gpx files
- `staticmap <https://github.com/komoot/staticmap>`__ to generate a static map image from gpx coordinates
- `python-forecast.io <https://github.com/ZeevG/python-forecast.io>`__ to fetch weather data from `Dark Sky <https://darksky.net>`__ (former forecast.io)
- Client:
- React/Redux
- `Leaflet <https://leafletjs.com/>`__ to display map
- `Recharts <https://github.com/recharts/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 <https://yarnpkg.com>`__ and
`serve <https://github.com/zeit/serve>`__
- API key from `ThunderForest <http://thunderforest.com>`__
- API key from `Dark Sky <https://darksky.net/dev>`__ [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``

View File

@ -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