aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--backup_DB.py6
-rw-r--r--justice_build.py2
-rw-r--r--todolist.html1
-rw-r--r--update_db.py18
4 files changed, 24 insertions, 3 deletions
diff --git a/backup_DB.py b/backup_DB.py
new file mode 100644
index 0000000..fb4d9a1
--- /dev/null
+++ b/backup_DB.py
@@ -0,0 +1,6 @@
+import shutil
+import os
+
+def backup_DB():
+ os.makedirs("backup", exist_ok=True)
+ shutil.move("justice.db", "backup/justice.db")
diff --git a/justice_build.py b/justice_build.py
index 380d32b..5850340 100644
--- a/justice_build.py
+++ b/justice_build.py
@@ -1,10 +1,12 @@
from db_creation import create_DB
from download_files import download_data, get_valid_filenames
from update_db import update_DB
+from backup_DB import backup_DB
import os
def main():
DB_name = "justice.db"
+ backup_DB()
create_DB(DB_name)
valid_files = get_valid_filenames()
os.makedirs("data", exist_ok=True)
diff --git a/todolist.html b/todolist.html
index c86b17f..11f618f 100644
--- a/todolist.html
+++ b/todolist.html
@@ -1,7 +1,6 @@
<ol>
<li>Add a feature to display other types of ownerhsip interests (joint onwership interest, vacant ownership interest).</li>
<li>Refactor excessive duplications in the main code.</li>
- <li>Check how to make diacritics work in searches.</li>
<li>Check if I can remove duplication in results when searching for legal or natural persons in a role.</li>
<li>Write some documentation :)</li>
</ol> \ No newline at end of file
diff --git a/update_db.py b/update_db.py
index 2f86c35..d69f777 100644
--- a/update_db.py
+++ b/update_db.py
@@ -528,8 +528,8 @@ def insert_individual_relations_v2(c, ICO, conn, primary_sql_key, zapis_datum, v
def find_fyzicka_osoba(c, ICO, elem, conn, relationship_table_key, element, adresa_id):
try:
- jmeno = str(get_prop(elem, "osoba/jmeno"))
- prijmeni = str(get_prop(elem, "osoba/prijmeni"))
+ jmeno = lower_names_chars(str(get_prop(elem, "osoba/jmeno")))
+ prijmeni = lower_names_chars(str(get_prop(elem, "osoba/prijmeni")))
datum_narozeni = str(get_prop(elem, "osoba/narozDatum"))
titulPred = str(get_prop(elem, "osoba/titulPred"))
titulZa = str(get_prop(elem, "osoba/titulZa"))
@@ -539,6 +539,20 @@ def find_fyzicka_osoba(c, ICO, elem, conn, relationship_table_key, element, adre
except:
pass
+def lower_names_chars(string_name):
+ updated_name = ""
+ previous_non_alpha = True
+ for elem in string_name:
+ if previous_non_alpha == True:
+ updated_name += elem
+ else:
+ updated_name += elem.lower()
+ if elem.isalpha() == True:
+ previous_non_alpha = False
+ else:
+ previous_non_alpha = True
+ return updated_name
+
def insert_fyzicka_osoba(c, titulPred, jmeno, prijmeni, titulZa, datum_narozeni, adresa_id):
try:
c.execute("INSERT into fyzicke_osoby (titul_pred, jmeno, prijmeni, titul_za, datum_naroz, adresa_id) VALUES (?,?,?,?,?,?)", (titulPred, jmeno, prijmeni, titulZa, datum_narozeni,adresa_id,))