call eligibility tools

This commit is contained in:
Johan Le Baut 2022-04-13 11:04:48 +02:00
parent e6d6ba013b
commit b02881720d
2 changed files with 93 additions and 2 deletions

View file

@ -1,4 +1,4 @@
from flask import Flask, request, render_template from flask import Flask, request, render_template, redirect
from typing import TypedDict from typing import TypedDict
import configparser import configparser
@ -76,3 +76,13 @@ def getEligData():
return {"buildings": buildings} return {"buildings": buildings}
else: else:
return "Invalid bounding box coordinates", 400 return "Invalid bounding box coordinates", 400
@app.route("/eligtest/ftth", methods=["GET"])
def testFtth():
args = request.args
idImm=args['idImm']
codePostal=args['codePostal']
axioneOk=args['axione']
liazoOk=args['liazo']
pto_url = f"https://tools.aquilenet.fr/cgi-bin/recherchepto.cgi?refimmeuble={idImm}&cp={codePostal}&axione={axioneOk}&liazo={liazoOk}"
return redirect(pto_url)

View file

@ -1,4 +1,75 @@
const minZoomForRequest = 17; const minZoomForRequest = 17;
const urlADSL='https://tools.aquilenet.fr/cgi-bin/recherchend.cgi'
const streetTypeConversion = new Map();
streetTypeConversion.set("aire", "aire")
streetTypeConversion.set("allée", "all")
streetTypeConversion.set("allee", "all")
streetTypeConversion.set("avenue", "av")
streetTypeConversion.set("base", "base")
streetTypeConversion.set("boulevard", "bd")
streetTypeConversion.set("cami", "cami")
streetTypeConversion.set("carrefour", "car")
streetTypeConversion.set("chemin", "che")
streetTypeConversion.set("cheminement", "chem")
streetTypeConversion.set("chaussée", "chs")
streetTypeConversion.set("cité", "cite")
streetTypeConversion.set("cite", "cite")
streetTypeConversion.set("clos", "clos")
streetTypeConversion.set("coin", "coin")
streetTypeConversion.set("corniche", "cor")
streetTypeConversion.set("cote", "cote")
streetTypeConversion.set("cour", "cour")
streetTypeConversion.set("cours", "crs")
streetTypeConversion.set("domaine", "dom")
streetTypeConversion.set("descente", "dsc")
streetTypeConversion.set("ecart", "eca")
streetTypeConversion.set("esplanade", "esp")
streetTypeConversion.set("faubourg", "fg")
streetTypeConversion.set("gare", "gare")
streetTypeConversion.set("grande rue", "gr")
streetTypeConversion.set("hameau", "ham")
streetTypeConversion.set("halle", "hle")
streetTypeConversion.set("ilôt", "ilot")
streetTypeConversion.set("impasse", "imp")
streetTypeConversion.set("lieu dit", "ld")
streetTypeConversion.set("lotissement", "lot")
streetTypeConversion.set("marché", "mar")
streetTypeConversion.set("montée", "mte")
streetTypeConversion.set("parc", "parc")
streetTypeConversion.set("passage", "pas")
streetTypeConversion.set("place", "pl")
streetTypeConversion.set("plan", "plan")
streetTypeConversion.set("plaine", "pln")
streetTypeConversion.set("plateau", "plt")
streetTypeConversion.set("pont", "pont")
streetTypeConversion.set("port", "port")
streetTypeConversion.set("promenade", "pro")
streetTypeConversion.set("parvis", "prv")
streetTypeConversion.set("quartier", "qua")
streetTypeConversion.set("quai", "quai")
streetTypeConversion.set("résidence", "res")
streetTypeConversion.set("residence", "res")
streetTypeConversion.set("ruelle", "rle")
streetTypeConversion.set("rocade", "roc")
streetTypeConversion.set("rond point", "rpt")
streetTypeConversion.set("route", "rte")
streetTypeConversion.set("rue", "rue")
streetTypeConversion.set("sentier", "sen")
streetTypeConversion.set("sente", "sen")
streetTypeConversion.set("square", "sq")
streetTypeConversion.set("tour", "tour")
streetTypeConversion.set("terre-plein", "tpl")
streetTypeConversion.set("traverse", "tra")
streetTypeConversion.set("villa", "vla")
streetTypeConversion.set("village", "vlge ")
streetTypeConversion.set("voie", "voie")
streetTypeConversion.set("zone artisanale", "za")
streetTypeConversion.set("zone d'aménagement concerté", "zac")
streetTypeConversion.set("zone d'aménagement différé", "zad")
streetTypeConversion.set("zone industrielle", "zi")
streetTypeConversion.set("zone", "zone")
let markers = []; let markers = [];
function initMap(btn) { function initMap(btn) {
// Init map position/zoom. Potentially using what's in the URL search string. // Init map position/zoom. Potentially using what's in the URL search string.
@ -74,7 +145,7 @@ function updateEligData(map, eligData) {
addrImm += ` (Bat ${building.bat_info})` addrImm += ` (Bat ${building.bat_info})`
} }
let messageElig = `` let messageElig = ``
eligTestApi=`testeligibilite/immeuble?idImm=${building.idImm}&codePostal=${building.codePostal}` eligTestApi=`eligtest/ftth?idImm=${building.idImm}&codePostal=${building.codePostal}&axione=${building.aquilenetEligStatus.isEligible}&liazo=${building.fdnEligStatus.isEligible}`
if (building.aquilenetEligStatus.isEligible) { if (building.aquilenetEligStatus.isEligible) {
messageElig = `<p class=deployeeAquilenet>Fibre deployee !` messageElig = `<p class=deployeeAquilenet>Fibre deployee !`
messageElig += `<br/><a href=${eligTestApi}>Tester l'eligibilite par Aquilenet` messageElig += `<br/><a href=${eligTestApi}>Tester l'eligibilite par Aquilenet`
@ -89,6 +160,16 @@ function updateEligData(map, eligData) {
messageElig = `<p class=deployeeAutres>Fibre deployee mais non eligible Aquilenet, desole :(</p>` messageElig = `<p class=deployeeAutres>Fibre deployee mais non eligible Aquilenet, desole :(</p>`
} else { } else {
messageElig = `<p class=nonDeployee>Fibre non deployee :(</p>` messageElig = `<p class=nonDeployee>Fibre non deployee :(</p>`
zip=encodeURIComponent(building.codePostal);
comm=encodeURIComponent(building.commune);
convertType = streetTypeConversion.get(building.typeVoieImm.toLowerCase());
if (! convertType) {
convertType = building.typeVoieImm;
}
street=encodeURIComponent(`${convertType} ${building.nomVoieImm}`)
street_nb=encodeURIComponent(building.numVoieImm)
messageElig += `<br/><a href=${urlADSL}?zip=${zip}&city=${comm}&street=${street}&street_nb=${street_nb}&gps=&do=1&submit=Valider`
+ `>Tester ADSL a cette adresse</a>`
if (building.othersEligStatus.reasonNotEligible != "") { if (building.othersEligStatus.reasonNotEligible != "") {
messageElig += `<br/><br/>Status general ARCEP: ${building.othersEligStatus.reasonNotEligible}` messageElig += `<br/><br/>Status general ARCEP: ${building.othersEligStatus.reasonNotEligible}`
} }