|
|
|
|
@ -17,9 +17,11 @@ main = Blueprint("main", __name__, url_prefix="/")
|
|
|
|
|
username = urllib.parse.quote_plus(dbadmin)
|
|
|
|
|
password = urllib.parse.quote_plus(dbpassword)
|
|
|
|
|
dbclient = MongoClient(f'mongodb://{username}:{password}@{server_ip}:27017')
|
|
|
|
|
# database
|
|
|
|
|
actesdb = dbclient["actesdb"]
|
|
|
|
|
#
|
|
|
|
|
# collections
|
|
|
|
|
housecol = actesdb["house"]
|
|
|
|
|
# the acte collection is the most important collection
|
|
|
|
|
actecol = actesdb["acte"]
|
|
|
|
|
helpers = actesdb["helpers"]
|
|
|
|
|
#folium_map = actesdb["folium_map"]
|
|
|
|
|
@ -48,7 +50,7 @@ def bigram_prince(prince):
|
|
|
|
|
def trigram_house(house):
|
|
|
|
|
return house_trigram[house]
|
|
|
|
|
|
|
|
|
|
# TODO: write tests in the datascience project
|
|
|
|
|
# TODO: write tests in the datascience project `datascience/tests`
|
|
|
|
|
#print(bigram_prince("Agnes"))
|
|
|
|
|
#print(bigram_prince("Arthur"))
|
|
|
|
|
#print(bigram_prince("Bernard"))
|
|
|
|
|
@ -87,13 +89,25 @@ def actes(house):
|
|
|
|
|
"""actes route
|
|
|
|
|
|
|
|
|
|
shows the princes in the selected house
|
|
|
|
|
|
|
|
|
|
:param: the house in the url is the house name
|
|
|
|
|
with a capital letter at the beginning
|
|
|
|
|
example: `house = "Berry"`
|
|
|
|
|
"""
|
|
|
|
|
#house = "Berry"
|
|
|
|
|
# FIXME faire des princes correspondant à la maison (house) sélectionnée
|
|
|
|
|
# Corpus > Bourbon
|
|
|
|
|
princes = [("Charles Ier de Bourbon", 36), ("Agnès de Bourgogne", 38),
|
|
|
|
|
("Marie de Berry", 39)]
|
|
|
|
|
return render_template("corpus.html", house=house, princes=princes)
|
|
|
|
|
#for code in actecol.distinct('prince_code'):
|
|
|
|
|
# print(code)
|
|
|
|
|
# house in the store shall be in lower case, but let's force it, just in case
|
|
|
|
|
house = house.lower()
|
|
|
|
|
# [(prince_name, prince_code)] means for example:
|
|
|
|
|
# [("Charles Ier de Bourbon", "Ch_i"), ("Agnès de Bourgogne", "Agn_i")]
|
|
|
|
|
princes = []
|
|
|
|
|
for act in actecol.find({"house":house}):
|
|
|
|
|
prince_name = act['prince_name'].capitalize()
|
|
|
|
|
prince_code = act['prince_code'].capitalize()
|
|
|
|
|
if (prince_name, prince_code) not in princes:
|
|
|
|
|
princes.append((prince_name, prince_code))
|
|
|
|
|
|
|
|
|
|
return render_template("corpus.html", house=house.capitalize(), princes=princes)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@main.route("/actes/<house>/<prince>") # don't put a slash at the end
|
|
|
|
|
@ -135,7 +149,7 @@ def geoloc():
|
|
|
|
|
folium.Marker(
|
|
|
|
|
location=[place['latitude'], place['longitude']],
|
|
|
|
|
popup=place['name'],
|
|
|
|
|
#icon=folium.Icon(icon="cloud")
|
|
|
|
|
icon=folium.Icon(color='lightgray', icon="circle", prefix='fa')
|
|
|
|
|
#icon=folium.Icon(color='lightgray', icon='home', prefix='fa')
|
|
|
|
|
).add_to(m)
|
|
|
|
|
geolocalisation = m._repr_html_()
|
|
|
|
|
|