Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🗃️(api) make location address/coordinates unique together #329

Closed

Conversation

jmaupetit
Copy link
Member

Purpose

Instead of having a unique Localisation.adresse_station field, let's be less pedantic and allow address to be unique while combined with specific coordinates. This allows to define a sparse address for a station with precise coordinates. Two stations located in the same area with a partial address will have two separated Localisation entries when their coordinates differ.

Proposal

  • add localisation_adresse_station_coordonneesXY_key constraint to the Localisation table
  • add database migration

@jmaupetit jmaupetit self-assigned this Jan 9, 2025
@jmaupetit jmaupetit added improvement schema Discussions around data schemas API Item related to the API service labels Jan 9, 2025
@jmaupetit jmaupetit linked an issue Jan 9, 2025 that may be closed by this pull request
Copy link

github-actions bot commented Jan 9, 2025

Current benchmark

Type Name Request Count Failure Count Median Response Time Average Response Time Min Response Time Max Response Time Average Content Size Requests/s Failures/s 50% 66% 75% 80% 90% 95% 98% 99% 99.9% 99.99% 100% git timestamp version
GET /auth/whoami 8 0 350.0 476.633075125001 17.129057999994757 970.2996970000016 160.0 0.5446031703858366 0.0 560 590 970 970 970 970 970 970 970 970 970 972c990 2025-01-09 16:59:37.028802+00:00 0.16.0
POST /dynamique/session/ 19 0 310.0 378.1079905263162 3.8164110000025175 1203.4654349999985 45.0 1.293432529666362 0.0 310 530 620 650 970 1200 1200 1200 1200 1200 1200 972c990 2025-01-09 16:59:37.028802+00:00 0.16.0
POST /dynamique/session/bulk 7 0 470.0 697.4443191428544 23.101502999992363 1481.9896669999937 411.0 0.476527774087607 0.0 470 940 1200 1200 1500 1500 1500 1500 1500 1500 1500 972c990 2025-01-09 16:59:37.028802+00:00 0.16.0
GET /dynamique/status/ 10 0 180.0 440.8748281999948 5.84153699998069 1052.5211850000176 285.0 0.6807539629822958 0.0 420 540 710 990 1100 1100 1100 1100 1100 1100 1100 972c990 2025-01-09 16:59:37.028802+00:00 0.16.0
POST /dynamique/status/ 8 0 180.0 383.98091762500286 22.430726999999703 1484.7502279999958 45.0 0.5446031703858366 0.0 350 470 490 490 1500 1500 1500 1500 1500 1500 1500 972c990 2025-01-09 16:59:37.028802+00:00 0.16.0
GET /dynamique/status/FRALLEGO002006P3 14 0 470.0 483.0577029285743 19.8266550000028 957.6654530000042 283.0 0.953055548175214 0.0 590 650 750 860 860 960 960 960 960 960 960 972c990 2025-01-09 16:59:37.028802+00:00 0.16.0
GET /dynamique/status/FRALLEGO002006P3/history 6 0 40.0 429.776465166673 6.725560000006681 1669.7545179999906 17821.0 0.4084523777893775 0.0 220 220 630 630 1700 1700 1700 1700 1700 1700 1700 972c990 2025-01-09 16:59:37.028802+00:00 0.16.0
POST /dynamique/status/bulk 11 0 320.0 435.8481029999966 19.33929700001613 1143.3358539999858 411.0 0.7488293592805254 0.0 320 490 740 740 950 1100 1100 1100 1100 1100 1100 972c990 2025-01-09 16:59:37.028802+00:00 0.16.0
POST /statique/ 12 5 360.0 538.9584046666704 29.31601599999567 1419.640089000012 53.91666666666666 0.816904755578755 0.3403769814911479 530 680 930 930 1100 1400 1400 1400 1400 1400 1400 972c990 2025-01-09 16:59:37.028802+00:00 0.16.0
GET /statique/?limit=10 12 0 320.0 538.9191634166602 17.563324999997576 1679.5237149999878 13826.166666666666 0.816904755578755 0.0 360 500 1100 1100 1200 1700 1700 1700 1700 1700 1700 972c990 2025-01-09 16:59:37.028802+00:00 0.16.0
GET /statique/?limit=100 15 0 580.0 586.4705462666658 143.20013500000073 1484.2702290000034 129006.2 1.0211309444734438 0.0 580 740 770 940 1200 1500 1500 1500 1500 1500 1500 972c990 2025-01-09 16:59:37.028802+00:00 0.16.0
PUT /statique/FR073EP7QU5233 10 0 360.0 457.0218304000008 32.70919499999536 1540.5699330000004 1371.0 0.6807539629822958 0.0 370 490 510 860 1500 1500 1500 1500 1500 1500 1500 972c990 2025-01-09 16:59:37.028802+00:00 0.16.0
GET /statique/FRALLEGO002006P3 7 0 580.0 403.2573452857094 24.46577699998897 702.6593909999974 1202.0 0.476527774087607 0.0 580 650 650 650 700 700 700 700 700 700 700 972c990 2025-01-09 16:59:37.028802+00:00 0.16.0
POST /statique/bulk 15 0 940.0 910.298061400001 491.0425999999859 1451.574743000009 1123.0666666666666 1.0211309444734438 0.0 940 1000 1100 1100 1200 1500 1500 1500 1500 1500 1500 972c990 2025-01-09 16:59:37.028802+00:00 0.16.0
Aggregated 154 5 470.0 521.2642707532463 3.8164110000025175 1679.5237149999878 14702.954545454546 10.483611029927356 0.3403769814911479 480 650 770 940 1100 1400 1500 1700 1700 1700 1700 972c990 2025-01-09 16:59:37.028802+00:00 0.16.0

Comparison with the latest previous benchmark

A lower (negative) value means the current version performs better than the previous one.

Type Name Request Count Failure Count Median Response Time Average Response Time Min Response Time Max Response Time Average Content Size Requests/s
GET /auth/whoami
POST /dynamique/session/
POST /dynamique/session/bulk
GET /dynamique/status/
POST /dynamique/status/
GET /dynamique/status/FRALLEGO002006P3
GET /dynamique/status/FRALLEGO002006P3/history
POST /dynamique/status/bulk
POST /statique/
GET /statique/?limit=10
GET /statique/?limit=100
PUT /statique/FR073EP7QU5233
GET /statique/FRALLEGO002006P3
POST /statique/bulk
Aggregated

Instead of having a unique `Localisation.adresse_station` field, let's
be less pedantic and allow address to be unique while combined with
specific coordinates. This allows to define a sparse address for a
station with precise coordinates. Two stations located in the same area
with a partial address will have two separated Localisation entries when
their coordinates differ.
@jmaupetit jmaupetit force-pushed the api-remove-localisation-adresse-field-uniqueness branch from 9a29c19 to e630945 Compare January 10, 2025 10:11
@jmaupetit
Copy link
Member Author

We've decided to keep the alternative implementation proposed in #330

@jmaupetit jmaupetit closed this Jan 14, 2025
@jmaupetit jmaupetit deleted the api-remove-localisation-adresse-field-uniqueness branch January 14, 2025 10:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Item related to the API service improvement schema Discussions around data schemas
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Localisation.adresse field should not be unique
1 participant