Ejemplo n.º 1
0
 def post(self, request, *args, **kwargs):
     """
     Create or update App Variables\n
         Params:
             key1: val1,
             key2: val2, etc
     """
     data = request.data
     for var_name, value in data.items():
         AppVar.set('Common', var_name, value)
     return Response('Application settings updated successfully.')
Ejemplo n.º 2
0
    def delete(self, request, *args, **kwargs):
        """
        Delete specific App Variable by name
            Param:
                - name: str
        """
        var_name = request.data.get('name')

        if not var_name:
            raise APIException('Provide variable name to delete')

        AppVar.clear(var_name)
        return Response('OK')
Ejemplo n.º 3
0
 def get(self, request, *args, **kwargs):
     """
     Retrieve App Variable(s)\n
         Params:
             - name: str - retrieve specific variable
     """
     var_name = request.GET.get('name')
     if var_name:
         result = AppVar.get(var_name)
         if not result:
             return Response(status=404)
     else:
         result = list(AppVar.objects.values('name', 'value'))
         result = {i['name']: i['value'] for i in result}
     return Response(result)
Ejemplo n.º 4
0
    def make_connection_config() -> BaseEmailBackend:
        from apps.notifications.app_vars import APP_VAR_EMAIL_HOST, APP_VAR_EMAIL_USE_TLS, \
            APP_VAR_EMAIL_PORT, APP_VAR_EMAIL_HOST_USER, APP_VAR_EMAIL_HOST_PASSWORD
        from apps.common.models import AppVar

        cache_vars = AppVar.get_values_by_category(AppVar.MAIL_CATEGORY)
        backend_class = APP_VAR_EMAIL_BACKEND.get_cached_value(cache_vars)
        ctor = MailServerConfig.import_class(backend_class)

        return ctor(
            host=APP_VAR_EMAIL_HOST.get_cached_value(cache_vars),
            port=APP_VAR_EMAIL_PORT.get_cached_value(cache_vars),
            username=APP_VAR_EMAIL_HOST_USER.get_cached_value(cache_vars),
            password=APP_VAR_EMAIL_HOST_PASSWORD.get_cached_value(cache_vars),
            use_tls=APP_VAR_EMAIL_USE_TLS.get_cached_value(cache_vars),
            fail_silently=False)
Ejemplo n.º 5
0
# Project imports
from apps.common import redis
from apps.common.models import AppVar

__author__ = "ContraxSuite, LLC; LexPredict, LLC"
__copyright__ = "Copyright 2015-2020, ContraxSuite, LLC"
__license__ = "https://github.com/LexPredict/lexpredict-contraxsuite/blob/1.7.0/LICENSE"
__version__ = "1.7.0"
__maintainer__ = "LexPredict, LLC"
__email__ = "*****@*****.**"

# add App vars for project-level loggers
for logger_name, logger_data in settings.LOGGING['loggers'].items():
    AppVar.set('Logging', f'logger:{logger_name}:log_level',
               logger_data['level'],
               f'Custom log level for "{logger_name}" logger.')

# add App vars for celery loggers
celery_logger_names = [
    'celery', 'celery.beat', 'celery.task', 'celery.worker',
    'celery.worker.request', 'celery.pool'
]
for logger_name in celery_logger_names:
    logger = get_logger(logger_name)
    AppVar.set('Logging', f'logger:{logger_name}:log_level',
               logging._levelToName.get(logger.level),
               f'Custom log level for "{logger.name}" logger.')

ENABLE_DB_CONSOLE_LOGGING = AppVar.set(
    'Logging', 'logger:django.db.backends:log_to_console', False,
Ejemplo n.º 6
0
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Affero General Public License for more details.

    You should have received a copy of the GNU Affero General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.

    You can also be released from the requirements of the license by purchasing
    a commercial license from ContraxSuite, LLC. Buying such a license is
    mandatory as soon as you develop commercial activities involving ContraxSuite
    software without disclosing the source code of your own applications.  These
    activities include: offering paid services to customers as an ASP or "cloud"
    provider, processing documents on the fly in a web application,
    or shipping ContraxSuite within a closed source product.
"""
# -*- coding: utf-8 -*-

# Project imports
from apps.common.models import AppVar

__author__ = "ContraxSuite, LLC; LexPredict, LLC"
__copyright__ = "Copyright 2015-2020, ContraxSuite, LLC"
__license__ = "https://github.com/LexPredict/lexpredict-contraxsuite/blob/1.6.0/LICENSE"
__version__ = "1.6.0"
__maintainer__ = "LexPredict, LLC"
__email__ = "*****@*****.**"

REFRESH_DELAY = AppVar.set(
    'Materialized Views',
    'materialized_views_refresh_delay_after_last_request_sec', 60)
Ejemplo n.º 7
0
    a commercial license from ContraxSuite, LLC. Buying such a license is
    mandatory as soon as you develop commercial activities involving ContraxSuite
    software without disclosing the source code of your own applications.  These
    activities include: offering paid services to customers as an ASP or "cloud"
    provider, processing documents on the fly in a web application,
    or shipping ContraxSuite within a closed source product.
"""
# -*- coding: utf-8 -*-

# Project imports
from apps.common.models import AppVar

__author__ = "ContraxSuite, LLC; LexPredict, LLC"
__copyright__ = "Copyright 2015-2020, ContraxSuite, LLC"
__license__ = "https://github.com/LexPredict/lexpredict-contraxsuite/blob/1.5.0/LICENSE"
__version__ = "1.5.0"
__maintainer__ = "LexPredict, LLC"
__email__ = "*****@*****.**"

MLFLOW_MODEL_SERVER_STARTUP_TIMEOUT_SEC = AppVar.set(
    'MLFlow', 'mlflow_model_server_startup_timeout_sec', 30,
    'Timeout for MLFlow model server startup.')

MLFLOW_PREDICT_TIMEOUT_SEC = AppVar.set(
    'MLFlow', 'mlflow_predict_timeout_sec', 30,
    'Timeout for MLFlow model predict operation.')

MLFLOW_MODEL_SERVER_IDLE_TIMEOUT_SEC = AppVar.set(
    'MLFlow', 'mlflow_model_server_idle_timeout_sec', 30,
    'Kills model server if the model is not used for this number of seconds.')
Ejemplo n.º 8
0
    try:
        with open(os.path.join('..', settings.BASE_DIR, 'build.date'),
                  'r') as f:
            build_date_str_ini = f.read().strip()
            build_date_obj = parse(build_date_str_ini)
            return datetime.datetime.strftime(build_date_obj,
                                              '%Y-%m-%d %H:%M:%S %Z')
    except:
        pass


build_date = get_build_date()

BUILD_DATE = AppVar.set('Common',
                        'build_date',
                        build_date,
                        'Backend build date.',
                        overwrite=build_date is not None)

TRACK_API = AppVar.set(
    'Common', 'track_api', False,
    'Enables/disables tracking API request processing time. Values: true / false.'
)
TRACK_API_GREATER_THAN = AppVar.set(
    'Common', 'track_api_greater_than', 250,
    'If API request processing time is enabled then the requests '
    'longer than this value in ms will be tracked. Values: milliseconds')
TRACK_API_SAVE_SQL_LOG = AppVar.set(
    'Common', 'track_api_save_sql_log', False,
    'If API request processing time is enabled then save sql logs')
ENABLE_AUTH_TOKEN_IN_QUERY_STRING = AppVar.set(
Ejemplo n.º 9
0
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Affero General Public License for more details.

    You should have received a copy of the GNU Affero General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.

    You can also be released from the requirements of the license by purchasing
    a commercial license from ContraxSuite, LLC. Buying such a license is
    mandatory as soon as you develop commercial activities involving ContraxSuite
    software without disclosing the source code of your own applications.  These
    activities include: offering paid services to customers as an ASP or "cloud"
    provider, processing documents on the fly in a web application,
    or shipping ContraxSuite within a closed source product.
"""
# -*- coding: utf-8 -*-

# Project imports
from apps.common.models import AppVar

__author__ = "ContraxSuite, LLC; LexPredict, LLC"
__copyright__ = "Copyright 2015-2019, ContraxSuite, LLC"
__license__ = "https://github.com/LexPredict/lexpredict-contraxsuite/blob/1.4.0/LICENSE"
__version__ = "1.4.0"
__maintainer__ = "LexPredict, LLC"
__email__ = "*****@*****.**"

REMOVE_READY_TASKS_DELAY_IN_HOURS = AppVar.set(
    'remove_ready_tasks_delay_in_hours', 48,
    'Delete ready tasks from the database after this number of hours after the task is finished'
)
Ejemplo n.º 10
0
__version__ = "1.1.7"
__maintainer__ = "LexPredict, LLC"
__email__ = "*****@*****.**"


def init_app_vars():
    """
    Collect existing project variables from all app_vars.py modules into db
    """
    logging.info(
        'Going to Collect existing project variables from all app_vars.py modules into db'
    )
    custom_apps = [i for i in settings.INSTALLED_APPS if i.startswith('apps.')]
    for app_name in custom_apps:
        module_str = '%s.app_vars' % app_name
        try:
            _ = importlib.import_module(module_str)
            print('Initiated App Vars from module {}'.format(module_str))
        except ImportError:
            continue


TRACK_API = AppVar.set(
    'track_api', False,
    'Enables/disables tracking API request processing time. Values: true / false.'
)
TRACK_API_GREATER_THAN = AppVar.set(
    'track_api_greater_than', 250,
    'If API request processing time is enabled then the requests '
    'longer than this value in ms will be tracked. Values: milliseconds')
Ejemplo n.º 11
0
"""
# -*- coding: utf-8 -*-

# Project imports
from apps.common.models import AppVar
from django.conf import settings

__author__ = "ContraxSuite, LLC; LexPredict, LLC"
__copyright__ = "Copyright 2015-2020, ContraxSuite, LLC"
__license__ = "https://github.com/LexPredict/lexpredict-contraxsuite/blob/1.8.0/LICENSE"
__version__ = "1.8.0"
__maintainer__ = "LexPredict, LLC"
__email__ = "*****@*****.**"

DEFAULT_USER_GROUP = AppVar.set(
    'User', 'default_user_group', 'Reviewer',
    '''The group name the new user is added to by default''')

ALLOWED_EMAIL_DOMAINS = AppVar.set(
    'User', 'allowed_email_domains', '*',
    '''Allowed for social registration email domains, comma separated, 
       with optional wildcard characters''')

AUTO_REG_EMAIL_DOMAINS = AppVar.set(
    'User', 'auto_reg_email_domains', '',
    '''User whose email belongs to one of these domains will be automatically
       registered after signing in from a social application. The string contains
       email domains, comma separated, with optional wildcard characters''')

ACCOUNT_ALLOW_REGISTRATION = AppVar.set(
    'User', 'account_allow_registration', False,
Ejemplo n.º 12
0
    You should have received a copy of the GNU Affero General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.

    You can also be released from the requirements of the license by purchasing
    a commercial license from ContraxSuite, LLC. Buying such a license is
    mandatory as soon as you develop commercial activities involving ContraxSuite
    software without disclosing the source code of your own applications.  These
    activities include: offering paid services to customers as an ASP or "cloud"
    provider, processing documents on the fly in a web application,
    or shipping ContraxSuite within a closed source product.
"""
# -*- coding: utf-8 -*-

from apps.common.models import AppVar
from apps.rawdb.constants import APP_VAR_DISABLE_RAW_DB_CACHING_NAME

__author__ = "ContraxSuite, LLC; LexPredict, LLC"
__copyright__ = "Copyright 2015-2020, ContraxSuite, LLC"
__license__ = "https://github.com/LexPredict/lexpredict-contraxsuite/blob/1.7.0/LICENSE"
__version__ = "1.7.0"
__maintainer__ = "LexPredict, LLC"
__email__ = "*****@*****.**"

APP_VAR_DISABLE_RAW_DB_CACHING = AppVar.set(
    'RawDB', APP_VAR_DISABLE_RAW_DB_CACHING_NAME, False,
    'Disables automatic caching of documents into raw db tables '
    'when document type / document field structures are changed '
    'via the admin app or when a document is loaded / changed. '
    'Values: true / false (json)')
    provider, processing documents on the fly in a web application,
    or shipping ContraxSuite within a closed source product.
"""
# -*- coding: utf-8 -*-

# Project imports
from apps.common.models import AppVar

__author__ = "ContraxSuite, LLC; LexPredict, LLC"
__copyright__ = "Copyright 2015-2019, ContraxSuite, LLC"
__license__ = "https://github.com/LexPredict/lexpredict-contraxsuite/blob/1.4.0/LICENSE"
__version__ = "1.4.0"
__maintainer__ = "LexPredict, LLC"
__email__ = "*****@*****.**"

DEPLOYMENT_TERMS_INITIALIZED = AppVar.set(
    'deployment_terms_initialized', False,
    'True if terms was loaded during first application startup')

DEPLOYMENT_COURTS_INITIALIZED = AppVar.set(
    'deployment_courts_initialized', False,
    'True if courts was loaded during first application startup')

DEPLOYMENT_GEOENTITIES_INITIALIZED = AppVar.set(
    'deployment_geoentities_initialized', False,
    'True if geo entities was loaded during first application startup')

DEPLOYMENT_DOCUMENT_DATA_INITIALIZED = AppVar.set(
    'deployment_document_data_initialized', False,
    'True if document data was loaded during first application startup')
Ejemplo n.º 14
0
"""
# -*- coding: utf-8 -*-

# Project imports
from apps.common.models import AppVar

__author__ = "ContraxSuite, LLC; LexPredict, LLC"
__copyright__ = "Copyright 2015-2020, ContraxSuite, LLC"
__license__ = "https://github.com/LexPredict/lexpredict-contraxsuite/blob/1.8.0/LICENSE"
__version__ = "1.8.0"
__maintainer__ = "LexPredict, LLC"
__email__ = "*****@*****.**"

STANDARD_LOCATORS = AppVar.set(
    'Extract', 'standard_locators', [
        'citation', 'currency', 'date', 'definition', 'duration', 'geoentity',
        'party', 'term'
    ],
    'List of standard (required) locators for use in "Load Documents" task.')

OPTIONAL_LOCATORS = AppVar.set(
    'Extract', 'optional_locators', [
        'amount', 'copyright', 'court', 'distance', 'percent', 'ratio',
        'regulation', 'trademark', 'url'
    ], 'List of optional locators for use additionally '
    'in "Locate" task if they have been chosen in "Locate" form.')

SIMPLE_LOCATOR_TOKENIZATION = AppVar.set(
    'Extract', 'simple_locator_tokenization', True,
    """Don't use NLTK when checking dictionary entries while locating Courts and
       GeoEntities in the document.""")
Ejemplo n.º 15
0
"""
# -*- coding: utf-8 -*-

# Project imports
from apps.common.models import AppVar

__author__ = "ContraxSuite, LLC; LexPredict, LLC"
__copyright__ = "Copyright 2015-2021, ContraxSuite, LLC"
__license__ = "https://github.com/LexPredict/lexpredict-contraxsuite/blob/2.0.0/LICENSE"
__version__ = "2.0.0"
__maintainer__ = "LexPredict, LLC"
__email__ = "*****@*****.**"


NOTIFY_TOO_MANY_DOCUMENTS = AppVar.set(
    'Analyze', 'cluster_documents_limit', 1000,
    'Notify if there are too many documents for clustering'
)

NOTIFY_TOO_MANY_UNITS = AppVar.set(
    'Analyze', 'cluster_text_units_limit', 500000,
    'Notify if there are too many text units for clustering'
)

DOCUMENT_SIMILARITY_OBJECTS_EXPIRE_IN = AppVar.set(
    'Analyze', 'document_similarity_objects_expire_in', 30 * 24 * 60 * 60,
    'Delete DocumentSimilarity objects in N sec after they were created'
)

TEXT_UNIT_SIMILARITY_OBJECTS_EXPIRE_IN = AppVar.set(
    'Analyze', 'text_unit_similarity_objects_expire_in', 2 * 24 * 60 * 60,
    'Delete TextUnitSimilarity objects in N sec after they were created'
Ejemplo n.º 16
0
    or shipping ContraxSuite within a closed source product.
"""
# -*- coding: utf-8 -*-

# Project imports
from apps.common.models import AppVar

__author__ = "ContraxSuite, LLC; LexPredict, LLC"
__copyright__ = "Copyright 2015-2020, ContraxSuite, LLC"
__license__ = "https://github.com/LexPredict/lexpredict-contraxsuite/blob/1.6.0/LICENSE"
__version__ = "1.6.0"
__maintainer__ = "LexPredict, LLC"
__email__ = "*****@*****.**"

REMOVE_READY_TASKS_DELAY_IN_HOURS = AppVar.set(
    'Task', 'remove_ready_tasks_delay_in_hours', 48,
    'Delete ready tasks from the database after this number of hours after the task is finished'
)

ENABLE_ALERTS = AppVar.set('Task', 'enable_alerts', False,
                           'Enable email alerts for failed / hanged tasks')

ALERT_DEFAULT_INTERVAL = AppVar.set(
    'Task', 'alert_default_interval', 60,
    'Default interval (minutes) before notify on pending task')

DISK_USAGE_PCNT_KEY = 'disk_usage_pcnt'

DISK_USAGE = AppVar.set(
    'Task', 'disk_usage', 0,
    'Disk usage percent, should be set dynamically by CRON task.')
Ejemplo n.º 17
0
    """
    logging.info(
        'Going to Collect existing project variables from all app_vars.py modules into db'
    )
    custom_apps = [i for i in settings.INSTALLED_APPS if i.startswith('apps.')]
    for app_name in custom_apps:
        module_str = '%s.app_vars' % app_name
        try:
            _ = importlib.import_module(module_str)
            print('Initiated App Vars from module {}'.format(module_str))
        except ImportError:
            continue


TRACK_API = AppVar.set(
    'Common', 'track_api', False,
    'Enables/disables tracking API request processing time. Values: true / false.'
)
TRACK_API_GREATER_THAN = AppVar.set(
    'Common', 'track_api_greater_than', 250,
    'If API request processing time is enabled then the requests '
    'longer than this value in ms will be tracked. Values: milliseconds')
TRACK_API_SAVE_SQL_LOG = AppVar.set(
    'Common', 'track_api_save_sql_log', False,
    'If API request processing time is enabled then save sql logs')
ENABLE_AUTH_TOKEN_IN_QUERY_STRING = AppVar.set(
    'Common', 'enable_auth_token_in_query_string', False,
    'Enables/disables ability to authenticate via query string param auth_token in query string'
    'in API calls. WARNING: this is insecure setting for DEV purposes only!!!')
CUSTOM_LINKS_HEADER = AppVar.set(
    'Common', 'custom_links_header', 'Custom Links', '',
    'Title for Custom Links menu item on left sidebar..')
Ejemplo n.º 18
0
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Affero General Public License for more details.

    You should have received a copy of the GNU Affero General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.

    You can also be released from the requirements of the license by purchasing
    a commercial license from ContraxSuite, LLC. Buying such a license is
    mandatory as soon as you develop commercial activities involving ContraxSuite
    software without disclosing the source code of your own applications.  These
    activities include: offering paid services to customers as an ASP or "cloud"
    provider, processing documents on the fly in a web application,
    or shipping ContraxSuite within a closed source product.
"""
# -*- coding: utf-8 -*-

from apps.common.models import AppVar

__author__ = "ContraxSuite, LLC; LexPredict, LLC"
__copyright__ = "Copyright 2015-2019, ContraxSuite, LLC"
__license__ = "https://github.com/LexPredict/lexpredict-contraxsuite/blob/1.4.0/LICENSE"
__version__ = "1.4.0"
__maintainer__ = "LexPredict, LLC"
__email__ = "*****@*****.**"

APP_VAR_DISABLE_EVENT_NOTIFICATIONS = AppVar.set(
    'disable_event_notifications', False,
    '''Disables sending any notifications bound to document events.''')
Ejemplo n.º 19
0
    You should have received a copy of the GNU Affero General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.

    You can also be released from the requirements of the license by purchasing
    a commercial license from ContraxSuite, LLC. Buying such a license is
    mandatory as soon as you develop commercial activities involving ContraxSuite
    software without disclosing the source code of your own applications.  These
    activities include: offering paid services to customers as an ASP or "cloud"
    provider, processing documents on the fly in a web application,
    or shipping ContraxSuite within a closed source product.
"""
# -*- coding: utf-8 -*-

# Project imports
from apps.common.models import AppVar

__author__ = "ContraxSuite, LLC; LexPredict, LLC"
__copyright__ = "Copyright 2015-2020, ContraxSuite, LLC"
__license__ = "https://github.com/LexPredict/lexpredict-contraxsuite/blob/1.8.0/LICENSE"
__version__ = "1.8.0"
__maintainer__ = "LexPredict, LLC"
__email__ = "*****@*****.**"

REFRESH_DELAY = AppVar.set(
    'Materialized Views',
    'materialized_views_refresh_delay_after_last_request_sec', 60)

CONCURRENCY_UPDATE = AppVar.set(
    'Materialized Views', 'materialized_views_concurrency', False,
    'Update materialized view with concurrency access enabled')
Ejemplo n.º 20
0
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Affero General Public License for more details.

    You should have received a copy of the GNU Affero General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.

    You can also be released from the requirements of the license by purchasing
    a commercial license from ContraxSuite, LLC. Buying such a license is
    mandatory as soon as you develop commercial activities involving ContraxSuite
    software without disclosing the source code of your own applications.  These
    activities include: offering paid services to customers as an ASP or "cloud"
    provider, processing documents on the fly in a web application,
    or shipping ContraxSuite within a closed source product.
"""
# -*- coding: utf-8 -*-

# Project imports
from apps.common.models import AppVar

__author__ = "ContraxSuite, LLC; LexPredict, LLC"
__copyright__ = "Copyright 2015-2018, ContraxSuite, LLC"
__license__ = "https://github.com/LexPredict/lexpredict-contraxsuite/blob/1.2.1/LICENSE"
__version__ = "1.2.1"
__maintainer__ = "LexPredict, LLC"
__email__ = "*****@*****.**"

ADMIN_RUNNING_TASKS_VALIDATION_ENABLED = AppVar.set(
    'admin_running_tasks_validation_enabled', True,
    'Prevents critical changes if user tasks running')
Ejemplo n.º 21
0
"""
# -*- coding: utf-8 -*-

from apps.common.models import AppVar
from django.conf import settings

__author__ = "ContraxSuite, LLC; LexPredict, LLC"
__copyright__ = "Copyright 2015-2020, ContraxSuite, LLC"
__license__ = "https://github.com/LexPredict/lexpredict-contraxsuite/blob/1.7.0/LICENSE"
__version__ = "1.7.0"
__maintainer__ = "LexPredict, LLC"
__email__ = "*****@*****.**"


APP_VAR_DISABLE_EVENT_NOTIFICATIONS = AppVar.set(
    'Notifications', 'disable_event_notifications', False,
    '''Disables sending any notifications bound to document events.''')

APP_VAR_EMAIL_BACKEND = AppVar.set('Mail server', 'email_backend', settings.EMAIL_BACKEND,
                                "Email backend class")
APP_VAR_EMAIL_HOST = AppVar.set('Mail server', 'email_host', settings.EMAIL_HOST,
                                "Email host")
APP_VAR_EMAIL_PORT = AppVar.set('Mail server', 'email_port', settings.EMAIL_PORT,
                                "Email port")
APP_VAR_EMAIL_USE_TLS = AppVar.set('Mail server', 'email_use_tls', settings.EMAIL_USE_TLS,
                                "Use TLS")
APP_VAR_EMAIL_HOST_USER = AppVar.set('Mail server', 'email_host_user', settings.EMAIL_HOST_USER,
                                "Email user")
APP_VAR_EMAIL_HOST_PASSWORD = AppVar.set('Mail server', 'email_host_password', settings.EMAIL_HOST_PASSWORD,
                                "Email password")
    Collect existing project variables from all app_vars.py modules into db
    """
    logging.info(
        'Going to Collect existing project variables from all app_vars.py modules into db'
    )
    custom_apps = [i for i in settings.INSTALLED_APPS if i.startswith('apps.')]
    for app_name in custom_apps:
        module_str = '%s.app_vars' % app_name
        try:
            _ = importlib.import_module(module_str)
            print('Initiated App Vars from module {}'.format(module_str))
        except ImportError:
            continue


TRACK_API = AppVar.set(
    'track_api', False,
    'Enables/disables tracking API request processing time. Values: true / false.'
)
TRACK_API_GREATER_THAN = AppVar.set(
    'track_api_greater_than', 250,
    'If API request processing time is enabled then the requests '
    'longer than this value in ms will be tracked. Values: milliseconds')
TRACK_API_SAVE_SQL_LOG = AppVar.set(
    'track_api_save_sql_log', False,
    'If API request processing time is enabled then save sql logs')
ENABLE_AUTH_TOKEN_IN_QUERY_STRING = AppVar.set(
    'enable_auth_token_in_query_string', False,
    'Enables/disables ability to authenticate via query string param auth_token in query string'
    'in API calls. WARNING: this is insecure setting for DEV purposes only!!!')
Ejemplo n.º 23
0
    software without disclosing the source code of your own applications.  These
    activities include: offering paid services to customers as an ASP or "cloud"
    provider, processing documents on the fly in a web application,
    or shipping ContraxSuite within a closed source product.
"""
# -*- coding: utf-8 -*-

# Project imports
from apps.common.models import AppVar

__author__ = "ContraxSuite, LLC; LexPredict, LLC"
__copyright__ = "Copyright 2015-2020, ContraxSuite, LLC"
__license__ = "https://github.com/LexPredict/lexpredict-contraxsuite/blob/1.6.0/LICENSE"
__version__ = "1.6.0"
__maintainer__ = "LexPredict, LLC"
__email__ = "*****@*****.**"

STANDARD_LOCATORS = AppVar.set(
    'Extract', 'standard_locators', [
        'citation', 'currency', 'date', 'definition', 'duration', 'geoentity',
        'party', 'term'
    ],
    'List of standard (required) locators for use in "Load Documents" task.')

OPTIONAL_LOCATORS = AppVar.set(
    'Extract', 'optional_locators', [
        'amount', 'copyright', 'court', 'distance', 'percent', 'ratio',
        'regulation', 'trademark', 'url'
    ], 'List of optional locators for use additionally '
    'in "Locate" task if they have been chosen in "Locate" form.')
Ejemplo n.º 24
0
"""
# -*- coding: utf-8 -*-

# Project imports
from apps.common.models import AppVar
from django.conf import settings

__author__ = "ContraxSuite, LLC; LexPredict, LLC"
__copyright__ = "Copyright 2015-2019, ContraxSuite, LLC"
__license__ = "https://github.com/LexPredict/lexpredict-contraxsuite/blob/1.2.3/LICENSE"
__version__ = "1.2.3"
__maintainer__ = "LexPredict, LLC"
__email__ = "*****@*****.**"

ADMIN_RUNNING_TASKS_VALIDATION_ENABLED = AppVar.set(
    'admin_running_tasks_validation_enabled', True,
    'Prevents critical changes if user tasks running')

TIKA_SERVER_ENDPOINT = AppVar.set(
    'tika_remote_server_endpoint', None,
    'TIKA server endpoint. Example: http://contrax-tika:9998')

TIKA_TIMEOUT = AppVar.set('tika_timeout', settings.TIKA_TIMEOUT,
                          'TIKA timeout (default = 3600 s)')

MAX_DOCUMENT_SIZE = AppVar.set(
    'max_document_size', 50,
    'Enables maximum document file size for uploading, Mb')

PREPROCESS_DOCTEXT_LINEBREAKS = AppVar.set(
    'preprocess_doctext_linebreaks', True,
Ejemplo n.º 25
0
    or shipping ContraxSuite within a closed source product.
"""
# -*- coding: utf-8 -*-

# Project imports
from apps.common.models import AppVar

__author__ = "ContraxSuite, LLC; LexPredict, LLC"
__copyright__ = "Copyright 2015-2020, ContraxSuite, LLC"
__license__ = "https://github.com/LexPredict/lexpredict-contraxsuite/blob/1.7.0/LICENSE"
__version__ = "1.7.0"
__maintainer__ = "LexPredict, LLC"
__email__ = "*****@*****.**"

REMOVE_READY_TASKS_DELAY_IN_HOURS = AppVar.set(
    'Task', 'remove_ready_tasks_delay_in_hours', 48,
    'Delete ready tasks from the database after this number of hours after the task is finished'
)

ENABLE_ALERTS = AppVar.set('Task', 'enable_alerts', False,
                           'Enable email alerts for failed / hanged tasks')

ALERT_DEFAULT_INTERVAL = AppVar.set(
    'Task', 'alert_default_interval', 60,
    'Default interval (minutes) before notify on pending task')

DISK_USAGE_PCNT_KEY = 'disk_usage_pcnt'

DISK_USAGE = AppVar.set(
    'Task', 'disk_usage', 0,
    'Disk usage percent, should be set dynamically by CRON task.')
Ejemplo n.º 26
0
"""
# -*- coding: utf-8 -*-

# Project imports
from apps.common.models import AppVar
from django.conf import settings

__author__ = "ContraxSuite, LLC; LexPredict, LLC"
__copyright__ = "Copyright 2015-2020, ContraxSuite, LLC"
__license__ = "https://github.com/LexPredict/lexpredict-contraxsuite/blob/1.5.0/LICENSE"
__version__ = "1.5.0"
__maintainer__ = "LexPredict, LLC"
__email__ = "*****@*****.**"

ADMIN_RUNNING_TASKS_VALIDATION_ENABLED = AppVar.set(
    'Document', 'admin_running_tasks_validation_enabled', True,
    'Prevents critical changes if user tasks running')

TIKA_SERVER_ENDPOINT = AppVar.set(
    'Document', 'tika_remote_server_endpoint', None,
    'TIKA server endpoint. Example: http://contrax-tika:9998')

TIKA_TIMEOUT = AppVar.set('Document', 'tika_timeout', settings.TIKA_TIMEOUT,
                          'TIKA timeout (default = 3600 s)')

TIKA_PARSE_MODE = AppVar.set('Document', 'tika_parse_mode', 'plain',
                             'TIKA parse mode ("xhtml" or "plain")')

MAX_DOCUMENT_SIZE = AppVar.set(
    'Document', 'max_document_size', 50,
    'Enables maximum document file size for uploading, Mb')
Ejemplo n.º 27
0
"""
# -*- coding: utf-8 -*-

# Project imports
from apps.common.models import AppVar
from django.conf import settings

__author__ = "ContraxSuite, LLC; LexPredict, LLC"
__copyright__ = "Copyright 2015-2020, ContraxSuite, LLC"
__license__ = "https://github.com/LexPredict/lexpredict-contraxsuite/blob/1.6.0/LICENSE"
__version__ = "1.6.0"
__maintainer__ = "LexPredict, LLC"
__email__ = "*****@*****.**"

ADMIN_RUNNING_TASKS_VALIDATION_ENABLED = AppVar.set(
    'Document', 'admin_running_tasks_validation_enabled', True,
    'Prevents critical changes if user tasks running')

TIKA_SERVER_ENDPOINT = AppVar.set(
    'Document', 'tika_remote_server_endpoint', None,
    'TIKA server endpoint. Example: http://contrax-tika:9998')

TIKA_TIMEOUT = AppVar.set('Document', 'tika_timeout', settings.TIKA_TIMEOUT,
                          'TIKA timeout (default = 5.5 hours)')

TIKA_PARSE_MODE = AppVar.set('Document', 'tika_parse_mode', 'plain',
                             'TIKA parse mode ("xhtml" or "plain")')

MAX_DOCUMENT_SIZE = AppVar.set(
    'Document', 'max_document_size', 50,
    'Enables maximum document file size for uploading, Mb')
Ejemplo n.º 28
0
    You should have received a copy of the GNU Affero General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.

    You can also be released from the requirements of the license by purchasing
    a commercial license from ContraxSuite, LLC. Buying such a license is
    mandatory as soon as you develop commercial activities involving ContraxSuite
    software without disclosing the source code of your own applications.  These
    activities include: offering paid services to customers as an ASP or "cloud"
    provider, processing documents on the fly in a web application,
    or shipping ContraxSuite within a closed source product.
"""
# -*- coding: utf-8 -*-

# Project imports
from apps.common.models import AppVar

__author__ = "ContraxSuite, LLC; LexPredict, LLC"
__copyright__ = "Copyright 2015-2020, ContraxSuite, LLC"
__license__ = "https://github.com/LexPredict/lexpredict-contraxsuite/blob/1.7.0/LICENSE"
__version__ = "1.7.0"
__maintainer__ = "LexPredict, LLC"
__email__ = "*****@*****.**"

NOTIFY_TOO_MANY_DOCUMENTS = AppVar.set(
    'Analyze', 'cluster_documents_limit', 1000,
    'Notify if there are too many documents for clustering')

NOTIFY_TOO_MANY_UNITS = AppVar.set(
    'Analyze', 'cluster_text_units_limit', 500000,
    'Notify if there are too many text units for clustering')
Ejemplo n.º 29
0
 def to_representation(self, obj):
     data = super().to_representation(obj)
     data['release_version'] = settings.VERSION_NUMBER
     data['menu_analisys_project_item_name'] = AppVar.get('menu_analisys_project_item_name')
     return data