|
@@ -97,6 +97,42 @@ class ParseMapping:
|
|
|
'''
|
|
|
'''
|
|
|
return self._get_info(key="date_format")
|
|
|
+
|
|
|
+ def get_internal_names(self) -> dict:
|
|
|
+ '''
|
|
|
+ '''
|
|
|
+
|
|
|
+ if all(["internal_name" in d for d in self._mapping]):
|
|
|
+ internal_names = [d["internal_name"] for d in self._mapping]
|
|
|
+
|
|
|
+ elif all(["internal_name" not in d for d in self._mapping]):
|
|
|
+ internal_names = list(range(len(self._mapping)))
|
|
|
+
|
|
|
+
|
|
|
+ else:
|
|
|
+ err = ("Incorrectly filled mapping. Internal names should "
|
|
|
+ "either be in all or in neither of the fields")
|
|
|
+ self._log.error(err)
|
|
|
+ raise Exception(err)
|
|
|
+
|
|
|
+ return internal_names
|
|
|
+
|
|
|
+ def get_mongo_names(self) -> dict:
|
|
|
+ '''
|
|
|
+ '''
|
|
|
+ if all(["mongo_name" in d for d in self._mapping]):
|
|
|
+ mongo_names = [d["mongo_name"] for d in self._mapping]
|
|
|
+
|
|
|
+ elif all(["mongo_name" not in d for d in self._mapping]):
|
|
|
+ mongo_names = list(range(len(self._mapping)))
|
|
|
+
|
|
|
+ else:
|
|
|
+ err = ("Incorrectly filled mapping. Mongo names should "
|
|
|
+ "either be in all or in neither of the fields")
|
|
|
+ self._log.error(err)
|
|
|
+ raise Exception(err)
|
|
|
+
|
|
|
+ return mongo_names
|
|
|
|
|
|
def get_types(self) -> dict:
|
|
|
'''
|
|
@@ -134,7 +170,7 @@ class ParseMapping:
|
|
|
else:
|
|
|
err = ("Incorrectly filled mapping. Column numbers should ",
|
|
|
"either in all or in neither of the fields")
|
|
|
- self.log.err(err)
|
|
|
+ self._log.err(err)
|
|
|
raise Exception(err)
|
|
|
|
|
|
return column_numbers
|