Coverage for nlp_webserver/constants.py: 100%

22 statements  

« prev     ^ index     » next       coverage.py v7.8.0, created at 2025-08-27 10:34 -0500

1r""" 

2crate_anon/nlp_webserver/constants.py 

3 

4=============================================================================== 

5 

6 Copyright (C) 2015, University of Cambridge, Department of Psychiatry. 

7 Created by Rudolf Cardinal (rnc1001@cam.ac.uk). 

8 

9 This file is part of CRATE. 

10 

11 CRATE is free software: you can redistribute it and/or modify 

12 it under the terms of the GNU General Public License as published by 

13 the Free Software Foundation, either version 3 of the License, or 

14 (at your option) any later version. 

15 

16 CRATE is distributed in the hope that it will be useful, 

17 but WITHOUT ANY WARRANTY; without even the implied warranty of 

18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 

19 GNU General Public License for more details. 

20 

21 You should have received a copy of the GNU General Public License 

22 along with CRATE. If not, see <https://www.gnu.org/licenses/>. 

23 

24=============================================================================== 

25 

26Constants for CRATE's implementation of an NLPRP server. 

27 

28""" 

29 

30KEY_PROCTYPE = "proctype" 

31PROCTYPE_GATE = "GATE" 

32 

33# GATE_BASE_URL = "https://api.nhsta.gate.ac.uk/process-document" 

34GATE_BASE_URL = "https://nhsta-api.slam-services.gate.ac.uk/process-document" 

35NLP_WEBSERVER_CONFIG_ENVVAR = "CRATE_NLP_WEB_CONFIG" 

36NLP_WEBSERVER_CELERY_APP_NAME = "crate_anon.nlp_webserver.tasks" 

37SERVER_NAME = "test_server" 

38SERVER_VERSION = "0.1" 

39 

40 

41class NlpServerConfigKeys: 

42 SQLALCHEMY_PREFIX = "sqlalchemy." # not itself a key 

43 

44 BACKEND_URL = "backend_url" 

45 BROKER_URL = "broker_url" 

46 ENCRYPTION_KEY = "encryption_key" 

47 NLP_WEBSERVER_SECRET = "nlp_webserver.secret" 

48 PROCESSORS_PATH = "processors_path" 

49 REDIS_DB_NUMBER = "redis_db_number" 

50 REDIS_HOST = "redis_host" 

51 REDIS_PASSWORD = "redis_password" 

52 REDIS_PORT = "redis_port" 

53 SQLALCHEMY_ECHO = SQLALCHEMY_PREFIX + "echo" 

54 SQLALCHEMY_URL = SQLALCHEMY_PREFIX + "url" 

55 USERS_FILE = "users_file" 

56 

57 

58SQLALCHEMY_COMMON_OPTIONS = { 

59 # https://docs.sqlalchemy.org/en/13/core/engines.html 

60 "pool_recycle": 25200, # in seconds; is 7 hours 

61 "pool_pre_ping": True, 

62}