|
|
|
@ -5,10 +5,11 @@ from pathlib import Path
|
|
|
|
from typing import Dict
|
|
|
|
from typing import Dict
|
|
|
|
|
|
|
|
|
|
|
|
from mongoengine import connect
|
|
|
|
from mongoengine import connect
|
|
|
|
from mongoengine import Document, StringField
|
|
|
|
from mongoengine import Document, StringField, DictField
|
|
|
|
|
|
|
|
|
|
|
|
from kedro.framework.session import KedroSession
|
|
|
|
from kedro.framework.session import KedroSession
|
|
|
|
from kedro.extras.datasets.yaml import YAMLDataSet
|
|
|
|
from kedro.extras.datasets.yaml import YAMLDataSet
|
|
|
|
|
|
|
|
from kedro.extras.datasets.json import JSONDataSet
|
|
|
|
|
|
|
|
|
|
|
|
from actesdataset import JSONDataSetCollection
|
|
|
|
from actesdataset import JSONDataSetCollection
|
|
|
|
|
|
|
|
|
|
|
|
@ -16,6 +17,10 @@ from actesdataset import JSONDataSetCollection
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Helpers(Document):
|
|
|
|
|
|
|
|
house_trigram = DictField()
|
|
|
|
|
|
|
|
prince_bigram = DictField()
|
|
|
|
|
|
|
|
|
|
|
|
# Database schemas
|
|
|
|
# Database schemas
|
|
|
|
class House(Document):
|
|
|
|
class House(Document):
|
|
|
|
"_id is the name"
|
|
|
|
"_id is the name"
|
|
|
|
@ -36,6 +41,7 @@ class Acte(Document):
|
|
|
|
ref_acte = StringField(required=True, max_length=100)
|
|
|
|
ref_acte = StringField(required=True, max_length=100)
|
|
|
|
xmlcontent = StringField(required=True) # no max_length
|
|
|
|
xmlcontent = StringField(required=True) # no max_length
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# pipeline functions
|
|
|
|
# pipeline functions
|
|
|
|
def populate_mongo(jsondoc: JSONDataSetCollection, storage_ip: str, db_name: str, db_collection_name: str, mongodb_admin: str, mongodb_password: str) -> None:
|
|
|
|
def populate_mongo(jsondoc: JSONDataSetCollection, storage_ip: str, db_name: str, db_collection_name: str, mongodb_admin: str, mongodb_password: str) -> None:
|
|
|
|
|
|
|
|
|
|
|
|
@ -94,3 +100,8 @@ def load_houses(yamldoc: YAMLDataSet, storage_ip: str, db_name: str, mongodb_adm
|
|
|
|
#myclient.close()
|
|
|
|
#myclient.close()
|
|
|
|
|
|
|
|
|
|
|
|
return
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def load_helpers(house_trigram: JSONDataSet, prince_bigram: JSONDataSet) -> None:
|
|
|
|
|
|
|
|
helper_entry = Helpers(house_trigram=house_trigram, prince_bigram=prince_bigram)
|
|
|
|
|
|
|
|
helper_entry.save()
|
|
|
|
|
|
|
|
|
|
|
|
|