Skip to content

Commit 2c771ee

Browse files
committed
PR fixes
1 parent bc66a2b commit 2c771ee

10 files changed

+139
-1689
lines changed
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
# Documentation for "Mobilité douce" made by Smart/Origin
2+
3+
This documentation concerns the **"Public Transport Access"** box code, which appears on the camp to camp routes
4+
5+
⚠️ S/O added a .env to the backend.
6+
7+
```sh
8+
v6_api/.env.template #rename it into .env
9+
```
10+
If you haven't already, update the database with Alembic (this will create the missing tables and fields) :
11+
```bash
12+
docker-compose exec api .build/venv/bin/alembic upgrade head
13+
```
14+
15+
16+
17+
18+
## "Show Nearby Stops" section
19+
20+
This section is used to search for public transport stops around 'access' waypoints.
21+
The public transport data comes from an external API called Navitia, which is stored in the CamptoCamp database.
22+
23+
**IF YOU DON'T HAVE ANY RESULT ON THE "Public Transports Access" section** : this means that your imported database does not contain Navitia data.
24+
To have visible results, **you must launch the script "get_public_transports_from_France.bm.sh" in the backend (see backend documentation)**
25+
26+
Warning ⚠️ : it takes a while (~3h, see other option below)
27+
```
28+
(on api_v6/ )
29+
sh get_public_transports_from_France.sh
30+
```
31+
32+
If you just want to work with the Isère department for local dev, you can run this script instead (~18 minutes):
33+
```
34+
(on api_v6/ )
35+
sh get_public_transports_from_Isere.sh
36+
```
37+
38+
### Files created / used for this section :
39+
40+
FRONT-END :
41+
42+
`c2c_ui/src/views/document/utils/boxes/TransportsBox.vue` => Parent view of the section
43+
44+
45+
`c2c_ui/src/views/document/RouteView.vue`=> View that call TransportsBox and IsReachableByPublicTransportsBox
46+
47+
`c2c_ui/src/views/document/utils/boxes/NearbyStopsSection.vue` => Features for nearby stops
48+
49+
`c2c_ui/src/views/document/utils/boxes/IsReachableByPublicTransportsBox.vue`=> Displays the small card on the left to indicate if there is at least one transport uploaded by the database for this route
50+
51+
`c2c_ui/src/components/map/OlMap.vue` => Map-related features
52+
53+
`c2c_ui/src/components/map/map-utils.vue` => Map Objects Style
54+
55+
`c2c_ui/src/js/apis/transport-service.js` => Calls the backend to get results from the database
56+
57+
`c2c_ui/src/assets/img/boxes/...` => Images
58+
59+
<br/>
60+
BACK-END :
61+
62+
`v6_api/c2corg_api/models/waypoint_stoparea.py` => waypoint_stoparea class
63+
64+
`v6_api/c2corg_api/models/stoparea.py` => stoparea class
65+
66+
`v6_api/c2corg_api/views/waypoint_stoparea.py` => waypoint_stoparea endpoints
67+
68+
`v6_api/c2corg_api/views/stoparea.py` => stoparea waypoints
69+
70+
`v6_api/c2corg_api/__init__.py` => add a event : after each access waypoint created on C2C, the nearby stops are requested
71+
72+
`v6_api/alembic_migration/versions/bb61456d557f_create_stops_and_waypoints_stops.py`=> Creates the stops and waypoints_stops tables
73+
74+
`v6_api/c2corg_api/__init__.py`=> sqlalchemy event (it's like db trigger) : after each access waypoint insert, we request Navitia
75+
76+
77+
## "Plan a trip" section
78+
79+
This section is used to plan a trip by calling the Navitia API.
80+
Unlike the previous section, we don't store the results in the database; we query Navitia directly by launching a query from the backend.
81+
This section uses the calculated_duration attribute, **which is calculated with the calcul_duration_for_routes.sh script in the backend (see backend documentation)**
82+
83+
If you need to update the calculated duration of itineraries, you can run this :
84+
85+
1) Go on `v6_api/c2corg_api/views/document.py` and put the LIMIT_MAX to 100000 :
86+
```python
87+
# the maximum number of documents that can be returned in a request
88+
LIMIT_MAX = 100000
89+
```
90+
91+
92+
2) Run the script
93+
```
94+
(on api_v6/ )
95+
sh calcul_duration_for_routes.sh
96+
```
97+
3) Put the limit back to 100
98+
```python
99+
# the maximum number of documents that can be returned in a request
100+
LIMIT_MAX = 100
101+
```
102+
103+
Files created / used :
104+
105+
FRONT-END :
106+
107+
`c2c_ui/src/views/document/utils/boxes/TransportsBox.vue` => Parent view of the section
108+
109+
`c2c_ui/src/views/document/utils/boxes/PlanATripSection.vue` => Features for planning a trip
110+
111+
`c2c_ui/src/js/apis/navitia-service.js` => Navitia's call on the back
112+
113+
`c2c_ui/src/components/map/OlMap.vue` => Map-related features
114+
115+
`c2c_ui/src/components/map/map-utils.vue` => Map Objects Style
116+
117+
`c2c_ui/src/assets/img/boxes/... (images)` => Images
118+
119+
<br/>
120+
BACK-END :
121+
122+
`v6_api/c2corg_api/views/navitia.py` => Call Navitia API
123+
124+
`v6_api/c2corg_api/__init__.py` => add a event : after each route created on C2C, the calculated_duration is calculed
125+
126+
`v6_api/alembic_migration/versions/6b40cb9c7c3d_add_calculated_duration_to_routes.py` => Add calculated_duration in DB, on routes objects
127+
128+
`v6_api/c2corg_api/__init__.py`=> sqlalchemy event (it's like db trigger) : after each route insert, we calculate the duration
129+
130+
131+
## Lot 3

scripts/navitia/get_public_transports_from_France.bm.sh

Lines changed: 0 additions & 191 deletions
This file was deleted.

0 commit comments

Comments
 (0)