diff --git a/requirements.txt b/requirements.txt index 3572227e93..bc06d8a2ff 100644 --- a/requirements.txt +++ b/requirements.txt @@ -12,3 +12,4 @@ Werkzeug>=2.0.1 statsmodels==0.14.0 PyPDF2>=2.5.0 pyarrow>=14.0.1 +scikit-learn>1.3.0 \ No newline at end of file diff --git a/setup.py b/setup.py index 1a1836b9f8..0c49a280fe 100755 --- a/setup.py +++ b/setup.py @@ -98,6 +98,7 @@ def dir_this_file(): "statsmodels==0.14.0", "PyPDF2>=2.5.0", "pyarrow>=14.0.1", + "scikit-learn>1.3.0" ], tests_require=["nose", "flake8"], extras_require=dict(), diff --git a/sysdata/mongodb/mongo_temporary_override.py b/sysdata/mongodb/mongo_temporary_override.py index 9b4b26916c..f4ca22716d 100644 --- a/sysdata/mongodb/mongo_temporary_override.py +++ b/sysdata/mongodb/mongo_temporary_override.py @@ -1,3 +1,4 @@ +from syscore.exceptions import missingData from syscore.constants import arg_not_supplied from sysdata.production.temporary_override import temporaryOverrideData @@ -5,6 +6,8 @@ from sysobjects.production.override import Override from sysdata.mongodb.mongo_generic import mongoDataWithSingleKey from syslogging.logger import get_logger +from sysobjects.production.override import DEFAULT_OVERRIDE + TEMPORARY_OVERRIDE_COLLECTION = "temporary_override_collection" KEY = "instrument_code" @@ -27,7 +30,10 @@ def mongo_data(self): return self._mongo_data def get_stored_override_for_instrument(self, instrument_code: str) -> Override: - override_as_dict = self.mongo_data.get_result_dict_for_key(instrument_code) + try: + override_as_dict = self.mongo_data.get_result_dict_for_key(instrument_code) + except missingData: + return DEFAULT_OVERRIDE return from_dict_to_override(override_as_dict)