loop to get all princes' actes in db

main
jgenero 3 years ago
parent 1dd484fe03
commit 7926f233c1

@ -232,8 +232,7 @@ def _create_involved_in(folder: str):
@db_cli.command()
def init() -> None:
"""Initialization of the database"""
xml_folder = os.path.join(APPPATH, "static", "xml",
"Bourbon")
princes_houses = ["Berry", "Bourbon", "Anjou"]
print("Dropping existing DB...")
db.drop_tables([Institution, State, House, Intervention_type,
@ -247,10 +246,21 @@ def init() -> None:
_create_house(houses)
_create_interv_type(interventions)
_create_diplo_type(diplomatic_type)
_create_produc_place(xml_folder)
_create_doc(xml_folder)
_create_acte(xml_folder)
# check which names need to be add to the actors.csv
actors = [*__csv_indiv_infos("secret"), *__csv_indiv_infos("prince")]
_create_indiv(actors)
_create_involved_in(xml_folder)
for prince_house in princes_houses:
xml_folder = os.path.join(APPPATH, "static", "xml", prince_house)
print("\n\n**** HOUSE ", prince_house, " ****")
# check which names need to be add to the actors.csv
names_in_csv = [actor[0] for actor in actors]
names_in_xml = __find_indiv(xml_folder, "signatory")
for name in [x for x in names_in_xml if x not in names_in_csv]:
print("!! name " + name + " not found in /app/static/csv/actors.csv")
_create_produc_place(xml_folder)
_create_doc(xml_folder)
_create_acte(xml_folder)
for prince_house in princes_houses:
print("\n\n**** INVOLVED IN ", prince_house, " ****")
xml_folder = os.path.join(APPPATH, "static", "xml", prince_house)
_create_involved_in(xml_folder)

Loading…
Cancel
Save