Coverage for portality/settings.py: 99%

308 statements  

« prev     ^ index     » next       coverage.py v7.17.3, created at 2026-11-20 13:43 +0000

1""" 

2~~AppSettings:Config~~ 

3""" 

4import os 

5from portality import constants 

6from portality.lib import paths 

7from datetime import datetime 

8 

9########################################### 

10# Application Version information 

11# ~~->API:Feature~~ 

12 

13DOAJ_VERSION = "8.7.8" 

14API_VERSION = "4.0.1" 

15 

16###################################### 

17# Deployment configuration 

18 

19HOST = '0.0.0.0' 

20DEBUG = False 

21DEBUG_DEV_LOG = False # show all log of each module 

22PORT = 5004 

23SSL = True 

24VALID_ENVIRONMENTS = ['dev', 'test', 'staging', 'production', 'harvester'] 

25CMS_BUILD_ASSETS_ON_STARTUP = False 

26# Cookies security 

27SESSION_COOKIE_SAMESITE = 'Lax' 

28SESSION_COOKIE_SECURE = True 

29REMEMBER_COOKIE_SECURE = True 

30 

31#################################### 

32# Testdrive for setting up the test environment. 

33# CAUTION - this can modify the index so should NEVER be used in production! 

34TESTDRIVE_ENABLED = False 

35 

36# List of script names which can be executed via the testdrive. 

37TESTDRIVE_SCRIPT_WHITELIST = ["article_deletion_notifications", "approaching_flag_deadline"] 

38 

39#################################### 

40# Debug Mode 

41 

42# PyCharm debug settings 

43DEBUG_PYCHARM = False # do not try to connect to the PyCharm debugger by default 

44DEBUG_PYCHARM_SERVER = 'localhost' 

45DEBUG_PYCHARM_PORT = 6000 

46 

47# ~~->DebugToolbar:Framework~~ 

48DEBUG_TB_TEMPLATE_EDITOR_ENABLED = True 

49DEBUG_TB_INTERCEPT_REDIRECTS = False 

50 

51# set to True to enable the env list panel in the debug toolbar 

52DEBUG_TB_ENV_LIST_ENABLED = False 

53 

54####################################### 

55# Elasticsearch configuration 

56# ~~->Elasticsearch:Technology 

57 

58# elasticsearch settings # TODO: changing from single host / esprit to multi host on ES & correct the default 

59ELASTICSEARCH_HOSTS = [{'host': 'localhost', 'port': 9200}, {'host': 'localhost', 'port': 9201}] 

60ELASTIC_SEARCH_VERIFY_CERTS = True # Verify the SSL certificate of the ES host. Set to False in dev.cfg to avoid having to configure your local certificates 

61 

62# 2 sets of elasticsearch DB settings - index-per-project and index-per-type. Keep both for now so we can migrate. 

63# e.g. host:port/index/type/id 

64ELASTIC_SEARCH_DB = "doaj" 

65ELASTIC_SEARCH_TEST_DB = "doajtest" 

66 

67# e.g. host:port/type/doc/id 

68ELASTIC_SEARCH_INDEX_PER_TYPE = True 

69INDEX_PER_TYPE_SUBSTITUTE = '_doc' # Migrated from esprit 

70ELASTIC_SEARCH_DB_PREFIX = "doaj-" # note: include the separator 

71ELASTIC_SEARCH_TEST_DB_PREFIX = "doajtest-" 

72 

73INITIALISE_INDEX = True # whether or not to try creating the index and required index types on startup 

74ELASTIC_SEARCH_SNAPSHOT_REPOSITORY = None 

75ELASTIC_SEARCH_SNAPSHOT_TTL = 366 

76 

77ES_TERMS_LIMIT = 1024 

78ELASTICSEARCH_REQ_TIMEOUT = 20 # Seconds - used in core.py for whole ES connection request timeout 

79ES_READ_TIMEOUT = '2m' # Minutes - used in DAO for searches 

80QUERY_SERVICE_ES_RETRIES = 3 # attempts per user-facing search via the QueryService (/query and the API) 

81 

82##################################################### 

83# Elastic APM config (MUST be configured in env file) 

84# ~~->APM:Feature~~ 

85 

86ENABLE_APM = False 

87 

88ELASTIC_APM = { 

89 # Set required service name. Allowed characters: 

90 # a-z, A-Z, 0-9, -, _, and space 

91 'SERVICE_NAME': '', 

92 

93 # Use if APM Server requires a token 

94 'SECRET_TOKEN': '', 

95 

96 # Set custom APM Server URL (default: http://localhost:8200) 

97 'SERVER_URL': '', 

98} 

99 

100########################################### 

101# Event handler 

102 

103# Process events immediately/synchronously 

104EVENT_SEND_FUNCTION = "portality.events.background.send_event" 

105 

106########################################### 

107# Read Only Mode 

108# 

109# Use these options to place the application into READ ONLY mode 

110 

111# This puts the UI into READ_ONLY mode 

112# ~~->ReadOnlyMode:Feature~~ 

113READ_ONLY_MODE = False 

114 

115# This puts the cron jobs into READ_ONLY mode 

116SCRIPTS_READ_ONLY_MODE = False 

117 

118########################################### 

119# Feature Toggles 

120 

121# ~~->OfflineMode:Feature~~ 

122OFFLINE_MODE = False 

123 

124# List the features we want to be active (API v1 and v2 remain with redirects to v3) 

125# ~~->API:Feature~~ 

126FEATURES = ['api1', 'api2', 'api3', 'api4'] 

127VALID_FEATURES = ['api1', 'api2', 'api3', 'api4'] 

128 

129######################################## 

130# File Path and URL Path settings 

131 

132# root of the git repo 

133ROOT_DIR = paths.rel2abs(__file__, "..") 

134 

135# base path, to the directory where this settings file lives 

136BASE_FILE_PATH = paths.abs_dir_path(__file__) 

137 

138BASE_URL = "https://doaj.org" 

139if BASE_URL.startswith('https://'): 

140 BASE_DOMAIN = BASE_URL[8:] 

141elif BASE_URL.startswith('http://'): 

142 BASE_DOMAIN = BASE_URL[7:] 

143else: 

144 BASE_DOMAIN = BASE_URL 

145 

146# ~~->API:Feature~~ 

147BASE_API_URL = "https://doaj.org/api/" 

148API_CURRENT_BLUEPRINT_NAME = "api_v4" # change if upgrading API to new version and creating new view 

149CURRENT_API_MAJOR_VERSION = "4" 

150 

151# URL used for the journal ToC URL in the journal CSV export 

152# NOTE: must be the correct route as configured in view/doaj.py 

153# ~~->ToC:WebRoute~~ 

154JOURNAL_TOC_URL_FRAG = BASE_URL + '/toc/' 

155 

156# Used when generating external links, e.g. in the API docs 

157PREFERRED_URL_SCHEME = 'https' 

158 

159# Whether the app is running behind a proxy, for generating URLs based on X-Forwarded-Proto 

160# ~~->ProxyFix:Framework~~ 

161PROXIED = False 

162 

163# directory to upload files to. MUST be full absolute path 

164# The default takes the directory above this, and then down in to "upload" 

165UPLOAD_DIR = os.path.join(ROOT_DIR, "upload") 

166UPLOAD_ASYNC_DIR = os.path.join(ROOT_DIR, "upload_async") 

167FAILED_ARTICLE_DIR = os.path.join(ROOT_DIR, "failed_articles") 

168 

169# directory where reports are output 

170REPORTS_BASE_DIR = "/home/cloo/reports/" 

171 

172################################## 

173# File store 

174# ~~->FileStore:Feature~~ 

175 

176# put this in your production.cfg, to store everything on S3: 

177# STORE_IMPL = "portality.store.StoreS3" 

178 

179STORE_IMPL = "portality.store.StoreLocal" 

180STORE_SCOPE_IMPL = { 

181 # Enable this by scope in order to have different scopes store via different storage implementations 

182 # constants.STORE__SCOPE__PUBLIC_DATA_DUMP: "portality.store.StoreS3", 

183 # constants.STORE__SCOPE__JOURNAL_CSV: "portality.store.StoreS3" 

184} 

185 

186STORE_TMP_IMPL = "portality.store.TempStore" 

187 

188STORE_LOCAL_DIR = paths.rel2abs(__file__, "..", "local_store", "main") 

189STORE_TMP_DIR = paths.rel2abs(__file__, "..", "local_store", "tmp") 

190STORE_LOCAL_EXPOSE = False # if you want to allow files in the local store to be exposed under /store/<path> urls. For dev only. 

191STORE_LOCAL_WRITE_BUFFER_SIZE = 16777216 

192STORE_TMP_WRITE_BUFFER_SIZE = 16777216 

193 

194# containers (buckets in AWS) where various content will be stored 

195# These values are placeholders, and must be overridden in live deployment 

196# this prevents test environments from accidentally writing to the production buckets 

197STORE_ANON_DATA_CONTAINER = "doaj-anon-data-placeholder" 

198STORE_CACHE_CONTAINER = "doaj-data-cache-placeholder" 

199STORE_PUBLIC_DATA_DUMP_CONTAINER = "doaj-data-dump-placeholder" 

200STORE_HARVESTER_CONTAINER = "doaj-harvester" 

201STORE_EXPORT_CONTAINER = "doaj-export-placeholder" 

202STORE_JOURNAL_CSV_CONTAINER = "doaj-journal-csv-placeholder" 

203 

204# S3 credentials for relevant scopes 

205# ~~->S3:Technology~~ 

206STORE_S3_SCOPES = { 

207 "anon_data": { 

208 "aws_access_key_id": "put this in your dev/test/production.cfg", 

209 "aws_secret_access_key": "put this in your dev/test/production.cfg" 

210 }, 

211 "cache": { 

212 "aws_access_key_id": "put this in your dev/test/production.cfg", 

213 "aws_secret_access_key": "put this in your dev/test/production.cfg" 

214 }, 

215 # Used by the api_export script to dump data from the api 

216 constants.STORE__SCOPE__PUBLIC_DATA_DUMP: { 

217 "aws_access_key_id": "put this in your dev/test/production.cfg", 

218 "aws_secret_access_key": "put this in your dev/test/production.cfg" 

219 }, 

220 # Used to store harvester run logs to S3 

221 "harvester": { 

222 "aws_access_key_id": "put this in your dev/test/production.cfg", 

223 "aws_secret_access_key": "put this in your dev/test/production.cfg" 

224 }, 

225 # Used to store the admin-generated CSV reports 

226 "export": { 

227 "aws_access_key_id": "put this in your dev/test/production.cfg", 

228 "aws_secret_access_key": "put this in your dev/test/production.cfg" 

229 }, 

230 constants.STORE__SCOPE__JOURNAL_CSV: { 

231 "aws_access_key_id": "put this in your dev/test/production.cfg", 

232 "aws_secret_access_key": "put this in your dev/test/production.cfg" 

233 } 

234} 

235 

236STORE_S3_MULTIPART_THRESHOLD = 5 * 1024 ** 3 # 5GB 

237 

238#################################### 

239# CMS configuration 

240 

241# paths where static content should be served from. 

242# * in the order you want them searched 

243# * relative to the portality directory 

244# ~~->CMS:DataStore~~ 

245STATIC_PATHS = [ 

246 "static", 

247 "../cms/assets" 

248] 

249 

250# GitHub base url where static content can be edited by the DOAJ team (you can leave out the trailing slash) 

251# ~~->GitHub:ExternalService~~ 

252CMS_EDIT_BASE_URL = "https://github.com/DOAJ/doaj/edit/static_pages/cms" 

253 

254# Where static files are served from - in case we need to serve a file 

255# from there ourselves using Flask instead of nginx (e.g. to support a 

256# legacy route to that file) 

257# Changing this will not change the actual folder that Flask serves 

258# static files from. 

259# http://flask.pocoo.org/snippets/102/ 

260STATIC_DIR = os.path.join(ROOT_DIR, "portality", "static") 

261 

262###################################### 

263# Service Descriptive Text 

264 

265SERVICE_NAME = "Directory of Open Access Journals" 

266 

267################################### 

268# Cookie settings 

269 

270# make this something secret in your overriding app.cfg 

271# ~~->Cookies:Feature~~ 

272SECRET_KEY = "default-key" 

273 

274# Consent Cookie and other Top-Level dismissable notes 

275# ~~->ConsentCookie:Feature~~ 

276CONSENT_COOKIE_KEY = "doaj-cookie-consent" 

277 

278# site notes, which can be configured to run any time with any content 

279# ~~-> SiteNote:Feature~~ 

280SITE_NOTE_ACTIVE = False 

281SITE_NOTE_KEY = "doaj-site-note" 

282SITE_NOTE_SLEEP = 259200 # every 3 days 

283SITE_NOTE_COOKIE_VALUE = "You have seen our most recent site wide announcement" 

284 

285#################################### 

286# Authorisation settings 

287# ~~->AuthNZ:Feature~~ 

288 

289# Can people register publicly? If false, only the superuser can create new accounts 

290PUBLIC_REGISTER = True 

291 

292SUPER_USER_ROLE = "admin" 

293 

294LOGIN_VIA_ACCOUNT_ID = True 

295 

296# amount of time a reset token is valid for (86400 is 24 hours) 

297PASSWORD_RESET_TIMEOUT = 86400 

298# amount of time a reset token for a new account is valid for 

299PASSWORD_CREATE_TIMEOUT = PASSWORD_RESET_TIMEOUT * 14 

300# amount of time a login through login-link is valid for 

301LOGIN_LINK_TIMEOUT = 600 

302# Encryption key for passwordless login. Must be 32 url-safe 

303# base64-encoded bytes, e.g. generated with: 

304# python -c "from cryptography.fernet import Fernet; print(Fernet.generate_key().decode())" 

305# The placeholder below is not a valid key - set a real one as a secret 

306# in your overriding app.cfg or dev.cfg, or requesting a passwordless 

307# login link will fail with 

308# "Fernet key must be 32 url-safe base64-encoded bytes." 

309# (password-reset emails use a separate uuid-based reset token and are 

310# unaffected by this setting) 

311PASSWORDLESS_ENCRYPTION_KEY = "Passwordless login encryption key" 

312 

313# "api" top-level role is added to all accounts on creation; it can be revoked per account by removal of the role. 

314TOP_LEVEL_ROLES = [ 

315 "admin", 

316 "publisher", 

317 "editor", 

318 "associate_editor", 

319 "api", 

320 "ultra_bulk_delete", 

321 "preservation", 

322 constants.ROLE_PUBLIC_DATA_DUMP, 

323 constants.ROLE_PUBLISHER_JOURNAL_CSV, 

324 constants.ROLE_ADMIN_REPORT_WITH_NOTES, 

325 constants.ROLE_PREMIUM, 

326 constants.ROLE_PREMIUM_OAI, 

327 constants.ROLE_PREMIUM_PDD, 

328 constants.ROLE_PREMIUM_CSV 

329] 

330 

331ROLE_MAP = { 

332 "editor": [ 

333 "associate_editor", # note, these don't cascade, so we still need to list all the low-level roles 

334 "edit_journal", 

335 "edit_suggestion", 

336 "edit_application", # todo: switchover from suggestion to application 

337 "editor_area", 

338 "assign_to_associate", 

339 "list_group_journals", 

340 "list_group_suggestions", 

341 "read_notifications" 

342 ], 

343 "associate_editor": [ 

344 "edit_journal", 

345 "edit_suggestion", 

346 "editor_area", 

347 "read_notifications" 

348 ], 

349 constants.ROLE_PREMIUM: [ 

350 constants.ROLE_PREMIUM_OAI, 

351 constants.ROLE_PREMIUM_PDD, 

352 constants.ROLE_PREMIUM_CSV 

353 ] 

354} 

355 

356# If you change the reserved usernames, your data will likely need a migration to remove their 

357# existing use in the system. 

358SYSTEM_USERNAME = "system" 

359RESERVED_USERNAMES = [SYSTEM_USERNAME] # do not allow the creation of user accounts with this id 

360 

361# Roles assigned to all users when they are registered 

362DEFAULT_REGISTER_ROLES = [constants.ROLE_PUBLISHER, constants.ROLE_API] 

363 

364# Role map to destination route on login (when no other destination page is present) 

365# checked in order, if the user has the role in the first tuple position, they will 

366# be redirected to the endpoint in the second tuple position 

367ROLE_LOGIN_DESTINATIONS = [ 

368 ("admin", "dashboard.top_todo"), 

369 ("editor", "editor.index"), 

370 ("associate_editor", "editor.index"), 

371 ("publisher", "publisher.index") 

372] 

373 

374# if the user doesn't have one of the above roles, where should they be sent after login 

375DEFAULT_LOGIN_DESTINATION = "doaj.home" 

376 

377#################################### 

378# Email Settings 

379# ~~->Email:ExternalService 

380 

381# Settings for Flask-Mail. Set in app.cfg 

382MAIL_SERVER = None # default localhost 

383MAIL_PORT = 25 # default 25 

384#MAIL_USE_TLS # default False 

385#MAIL_USE_SSL # default False 

386#MAIL_DEBUG # default app.debug 

387#MAIL_USERNAME # default None 

388#MAIL_PASSWORD # default None 

389#MAIL_DEFAULT_SENDER # default None 

390#MAIL_MAX_EMAILS # default None 

391#MAIL_SUPPRESS_SEND # default app.testing 

392 

393ENABLE_EMAIL = True 

394ENABLE_PUBLISHER_EMAIL = True 

395 

396ADMIN_NAME = "DOAJ" 

397ADMIN_EMAIL = "sysadmin@cottagelabs.com" 

398ADMINS = ["steve@cottagelabs.com", "mark@cottagelabs.com"] 

399 

400MANAGING_EDITOR_EMAIL = "managing-editors@doaj.org" 

401CONTACT_FORM_ADDRESS = "feedback+contactform@doaj.org" 

402SCRIPT_TAG_DETECTED_EMAIL_RECIPIENTS = ["helpdesk@doaj.org"] 

403 

404SYSTEM_EMAIL_FROM = 'helpdesk@doaj.org' 

405CC_ALL_EMAILS_TO = SYSTEM_EMAIL_FROM # DOAJ may get a dedicated inbox in the future 

406 

407# Error logging via email 

408SUPPRESS_ERROR_EMAILS = False 

409ERROR_LOGGING_EMAIL = 'doaj.internal@gmail.com' 

410ERROR_MAIL_HOSTNAME = 'smtp.mailgun.org' 

411ERROR_MAIL_USERNAME = None 

412ERROR_MAIL_PASSWORD = None 

413 

414# Reports email recipient 

415REPORTS_EMAIL_TO = ["helpdesk@doaj.org"] 

416 

417######################################## 

418# workflow email notification settings 

419# ~~->WorkflowNotifications:Feature~~ 

420 

421MAN_ED_IDLE_WEEKS = 4 # weeks before an application is considered reminder-worthy 

422ED_IDLE_WEEKS = 3 # weeks before the editor is warned about idle applications in their group 

423ASSOC_ED_IDLE_DAYS = 10 

424ASSOC_ED_IDLE_WEEKS = 3 

425 

426# Which statuses the notification queries should be filtered to show 

427# ~~-> ApplicationStatuses:Config~~ 

428MAN_ED_NOTIFICATION_STATUSES = [ 

429 constants.APPLICATION_STATUS_PENDING, 

430 constants.APPLICATION_STATUS_IN_PROGRESS, constants.APPLICATION_STATUS_COMPLETED, 

431 constants.APPLICATION_STATUS_ON_HOLD 

432] 

433ED_NOTIFICATION_STATUSES = [ 

434 constants.APPLICATION_STATUS_PENDING, 

435 constants.APPLICATION_STATUS_IN_PROGRESS, 

436 constants.APPLICATION_STATUS_COMPLETED 

437] 

438ASSOC_ED_NOTIFICATION_STATUSES = [ 

439 constants.APPLICATION_STATUS_PENDING, 

440 constants.APPLICATION_STATUS_IN_PROGRESS 

441] 

442 

443################################### 

444# status endpoint configuration 

445# ~~->StatusEndpoint:Feature~~ 

446 

447# /status endpoint connection to all app machines 

448APP_MACHINES_INTERNAL_IPS = [HOST + ':' + str(PORT)] # This should be set in production.cfg (or dev.cfg etc) 

449 

450########################################### 

451# Background Jobs settings 

452# ~~->Huey:Technology~~ 

453# ~~->Redis:Technology~~ 

454# ~~->BackgroundTasks:Feature~~ 

455 

456# huey/redis settings 

457REDIS_HOST = os.getenv('REDIS_HOST', '127.0.0.1') 

458REDIS_PORT = os.getenv('REDIS_PORT', 6379) 

459HUEY_IMMEDIATE = False 

460HUEY_ASYNC_DELAY = 10 

461 

462# Crontab for never running a job - February 31st (use to disable tasks) 

463CRON_NEVER = {"month": "2", "day": "31", "day_of_week": "*", "hour": "*", "minute": "*"} 

464 

465# Crontab schedules must be for unique times to avoid delays due to perceived race conditions 

466HUEY_SCHEDULE = { 

467 # Hourly 

468 "journal_csv": {"month": "*", "day": "*", "day_of_week": "*", "hour": "*", "minute": "20"}, 

469 "read_news": {"month": "*", "day": "*", "day_of_week": "*", "hour": "*", "minute": "30"}, 

470 "site_statistics": {"month": "*", "day": "*", "day_of_week": "*", "hour": "*", "minute": "40"}, 

471 

472 # Daily 

473 "find_discontinued_soon": {"month": "*", "day": "*", "day_of_week": "*", "hour": "0", "minute": "3"}, 

474 "approaching_flag_deadline": {"month": "*", "day": "*", "day_of_week": "*", "hour": "0", "minute": "45"}, 

475 "datalog_journal_added_update": {"month": "*", "day": "*", "day_of_week": "*", "hour": "4", "minute": "30"}, 

476 "harvest": {"month": "*", "day": "*", "day_of_week": "*", "hour": "5", "minute": "30"}, 

477 "request_es_backup": {"month": "*", "day": "*", "day_of_week": "*", "hour": "6", "minute": "0"}, 

478 "sitemap": {"month": "*", "day": "*", "day_of_week": "*", "hour": "8", "minute": "0"}, 

479 "check_latest_es_backup": {"month": "*", "day": "*", "day_of_week": "*", "hour": "9", "minute": "0"}, 

480 "prune_es_backups": {"month": "*", "day": "*", "day_of_week": "*", "hour": "9", "minute": "15"}, 

481 "public_data_dump": {"month": "*", "day": "*", "day_of_week": "*", "hour": "10", "minute": "0"}, 

482 

483 # Every N days of the month 

484 "auto_assign_editor_group_data": {"month": "*", "day": "*/7", "day_of_week": "*", "hour": "3", "minute": "30"}, 

485 "monitor_bgjobs": {"month": "*", "day": "*/6", "day_of_week": "*", "hour": "10", "minute": "0"}, 

486 

487 # Weekly (Monday) 

488 "async_workflow_notifications": {"month": "*", "day": "*", "day_of_week": "1", "hour": "5", "minute": "0"}, 

489 "article_deletion_notifications": {"month": "*", "day": "*", "day_of_week": "1", "hour": "5", "minute": "10"}, 

490 

491 # Monthly 

492 "reporting": {"month": "*", "day": "1", "day_of_week": "*", "hour": "0", "minute": "0"}, 

493 "article_cleanup_sync": {"month": "*", "day": "2", "day_of_week": "*", "hour": "0", "minute": "0"}, 

494 "anon_export": {"month": "*", "day": "10", "day_of_week": "*", "hour": "1", "minute": "10"}, 

495 "old_data_cleanup": {"month": "*", "day": "12", "day_of_week": "*", "hour": "2", "minute": "0"}, 

496 # Disabled: a full run (re)generates RIS for every article (~16.6M). The cache refills on demand instead - RIS 

497 # downloads and article saves both write it. Was {"month": "*", "day": "15", "day_of_week": "*", "hour": "3", "minute": "30"} 

498 "ris_export": CRON_NEVER, 

499} 

500 

501 

502HUEY_TASKS = { 

503 "ingest_articles": {"retries": 10, "retry_delay": 15}, 

504 "preserve": {"retries": 0, "retry_delay": 15}, 

505 "application_autochecks": {"retries": 0, "retry_delay": 15}, 

506 "journal_autochecks": {"retries": 0, "retry_delay": 15} 

507} 

508 

509#################################### 

510# publisher area settings 

511 

512# the earliest date accepted on the publisher's 'enter article metadata' form. 

513# code will default to 15 years before current year if commented out. 

514# ~~->ArticleMetadata:Page~~ 

515METADATA_START_YEAR = 1960 

516 

517# tick (on toc) and doaj seal settings 

518# ~~->Tick:Feature~~ 

519TICK_THRESHOLD = '2014-03-19T00:00:00Z' 

520 

521# ~~->UpdateRequests:Feature~~ 

522UPDATE_REQUESTS_SHOW_OLDEST = "2018-01-01T00:00:00Z" 

523 

524############################################## 

525# Elasticsearch Mappings 

526# ~~->Elasticsearch:Technology~~ 

527 

528FACET_FIELD = ".exact" 

529 

530# an array of DAO classes from which to retrieve the type-specific ES mappings 

531# to be loaded into the index during initialisation. 

532ELASTIC_SEARCH_MAPPINGS = [ 

533 "portality.models.Article", # ~~->Article:Model~~ 

534 "portality.models.Journal", # ~~->Journal:Model~~ 

535 "portality.models.Application", # ~~->Application:Model~~ 

536 "portality.models.DraftApplication", # ~~-> DraftApplication:Model~~ 

537 "portality.models.harvester.HarvestState", # ~~->HarvestState:Model~~ 

538 "portality.models.background.BackgroundJob", # ~~-> BackgroundJob:Model~~ 

539 "portality.models.autocheck.Autocheck", # ~~-> Autocheck:Model~~ 

540 "portality.models.export.Export", # ~~-> Export:Model~~ 

541 "portality.models.DataDump", # ~~-> DataDump:Model~~ 

542 "portality.models.JournalCSV", # ~~-> JournalCSV:Model~~ 

543 "portality.models.ur_review_route.URReviewRoute", # ~~-> URReviewRoute:Model~~ 

544 "portality.models.admin_alert.AdminAlert", # ~~-> AdminAlert:Model~~ 

545 "portality.models.ris_export.RISExport", 

546 "portality.models.note.Note" 

547] 

548 

549# Map from dataobj coercion declarations to ES mappings 

550# ~~->DataObj:Library~~ 

551# ~~->Seamless:Library~~ 

552DATAOBJ_TO_MAPPING_DEFAULTS = { 

553 "unicode": { 

554 "type": "text", 

555 "fields": { 

556 "exact": { 

557 "type": "keyword", 

558 # "index": False, 

559 "store": True 

560 } 

561 } 

562 }, 

563 "str": { 

564 "type": "text", 

565 "fields": { 

566 "exact": { 

567 "type": "keyword", 

568 # "index": False, 

569 "store": True 

570 } 

571 } 

572 }, 

573 "unicode_upper": { 

574 "type": "text", 

575 "fields": { 

576 "exact": { 

577 "type": "keyword", 

578 # "index": False, 

579 "store": True 

580 } 

581 } 

582 }, 

583 "unicode_lower": { 

584 "type": "text", 

585 "fields": { 

586 "exact": { 

587 "type": "keyword", 

588 # "index": False, 

589 "store": True 

590 } 

591 } 

592 }, 

593 "isolang": { 

594 "type": "text", 

595 "fields": { 

596 "exact": { 

597 "type": "keyword", 

598 # "index": False, 

599 "store": True 

600 } 

601 } 

602 }, 

603 "isolang_2letter_strict": { 

604 "type": "text", 

605 "fields": { 

606 "exact": { 

607 "type": "keyword", 

608 # "index": False, 

609 "store": True 

610 } 

611 } 

612 }, 

613 "isolang_2letter_lax": { 

614 "type": "text", 

615 "fields": { 

616 "exact": { 

617 "type": "keyword", 

618 # "index": False, 

619 "store": True 

620 } 

621 } 

622 }, 

623 "country_code": { 

624 "type": "text", 

625 "fields": { 

626 "exact": { 

627 "type": "keyword", 

628 # "index": False, 

629 "store": True 

630 } 

631 } 

632 }, 

633 "currency_code_strict": { 

634 "type": "text", 

635 "fields": { 

636 "exact": { 

637 "type": "keyword", 

638 # "index": False, 

639 "store": True 

640 } 

641 } 

642 }, 

643 "currency_code_lax": { 

644 "type": "text", 

645 "fields": { 

646 "exact": { 

647 "type": "keyword", 

648 # "index": False, 

649 "store": True 

650 } 

651 } 

652 }, 

653 "issn": { 

654 "type": "text", 

655 "fields": { 

656 "exact": { 

657 "type": "keyword", 

658 # "index": False, 

659 "store": True 

660 } 

661 } 

662 }, 

663 "url": { 

664 "type": "text", 

665 "fields": { 

666 "exact": { 

667 "type": "keyword", 

668 # "index": False, 

669 "store": True 

670 } 

671 } 

672 }, 

673 "utcdatetimemicros": { 

674 "type": "date", 

675 "format": "date_optional_time" 

676 }, 

677 "utcdatetime": { 

678 "type": "date", 

679 "format": "date_optional_time" 

680 }, 

681 "bool": { 

682 "type": "boolean" 

683 }, 

684 "integer": { 

685 "type": "long" 

686 }, 

687 "bigenddate": { 

688 "type": "date", 

689 "format": "date_optional_time" 

690 }, 

691 "year": { 

692 "type": "date", 

693 "format": "year" 

694 } 

695} 

696 

697# Extension Map from dataobj coercion declarations to ES mappings. 

698# This is useful when some extensions required for some objects additional to defaults. 

699# ~~->DataObj:Library~~ 

700# ~~->Seamless:Library~~ 

701DATAOBJ_TO_MAPPING_COPY_TO_EXTENSIONS = { 

702 "unicode": {"copy_to": ["all_meta"]}, 

703 "str": {"copy_to": ["all_meta"]}, 

704 "unicode_upper": {"copy_to": ["all_meta"]}, 

705 "unicode_lower": {"copy_to": ["all_meta"]}, 

706 "issn": {"copy_to": ["all_meta"]}, 

707 "url": {"copy_to": ["all_meta"]} 

708} 

709 

710# TODO: we may want a big-type and little-type setting 

711DEFAULT_INDEX_SETTINGS = \ 

712 { 

713 'number_of_shards': 4, 

714 'number_of_replicas': 1, 

715 'analysis': { 

716 'analyzer': { 

717 'ascii_folded': { 

718 'tokenizer': 'standard', 

719 'filter': ['lowercase', 'asciifolding'] 

720 } 

721 } 

722 } 

723 } 

724 

725# Per-index settings to merge on top of DEFAULT_INDEX_SETTINGS at index creation time. 

726# Keys are index type names (e.g. 'article'), values are dicts of ES index settings. 

727INDEX_SETTINGS_OVERRIDES = { 

728 # RIS cache: write-mostly, read back by id only; DEFLATE is ~35% smaller than the default LZ4 for its _source 

729 "ris_export": {"codec": "best_compression"}, 

730} 

731 

732DEFAULT_DYNAMIC_MAPPING = { 

733 'dynamic_templates': [ 

734 { 

735 "strings": { 

736 "match_mapping_type": "string", 

737 "mapping": { 

738 "type": "text", 

739 "fields": { 

740 "exact": { 

741 "type": "keyword", 

742 # "normalizer": "lowercase" 

743 } 

744 } 

745 } 

746 } 

747 } 

748 ] 

749} 

750 

751# LEGACY MAPPINGS 

752# a dict of the ES mappings. identify by name, and include name as first object name 

753# and identifier for how non-analyzed fields for faceting are differentiated in the mappings 

754MAPPINGS = { 

755 'account': { # ~~->Account:Model~~ 

756 # 'aliases': { 

757 # 'account': {} 

758 # }, 

759 'mappings': DEFAULT_DYNAMIC_MAPPING, 

760 'settings': DEFAULT_INDEX_SETTINGS 

761 } 

762} 

763 

764MAPPINGS['upload'] = MAPPINGS["account"] # ~~->Upload:Model~~ 

765MAPPINGS['bulk_articles'] = MAPPINGS["account"] # ~~->BulkArticles:Model~~ 

766MAPPINGS['cache'] = MAPPINGS["account"] # ~~->Cache:Model~~ 

767MAPPINGS['lcc'] = MAPPINGS["account"] # ~~->LCC:Model~~ 

768MAPPINGS['editor_group'] = MAPPINGS["account"] # ~~->EditorGroup:Model~~ 

769MAPPINGS['news'] = MAPPINGS["account"] # ~~->News:Model~~ 

770MAPPINGS['lock'] = MAPPINGS["account"] # ~~->Lock:Model~~ 

771MAPPINGS['provenance'] = MAPPINGS["account"] # ~~->Provenance:Model~~ 

772MAPPINGS['preserve'] = MAPPINGS["account"] # ~~->Preservation:Model~~ 

773MAPPINGS['notification'] = MAPPINGS["account"] # ~~->Notification:Model~~ 

774MAPPINGS['article_tombstone'] = MAPPINGS["account"] # ~~->ArticleTombstone:Model~~ 

775MAPPINGS['shortened_url'] = MAPPINGS["account"] #~~->URLShortener:Model~~ 

776 

777######################################### 

778# Query Routes 

779# ~~->Query:WebRoute~~ 

780 

781QUERY_ROUTE = { 

782 "query": { 

783 # ~~->PublicJournalQuery:Endpoint~~ 

784 "journal": { 

785 "auth": False, 

786 "role": None, 

787 "query_validators": ["non_public_fields_validator", "public_query_validator"], 

788 "query_filters": ["only_in_doaj", "last_update_fallback", "search_all_meta"], 

789 "result_filters": ["public_result_filter"], 

790 "dao": "portality.models.Journal", # ~~->Journal:Model~~ 

791 "required_parameters": {"ref": ["ssw", "public_journal", "subject_page"]}, 

792 "request_cache": True 

793 }, 

794 # ~~->PublicArticleQuery:Endpoint~~ 

795 "article": { 

796 "auth": False, 

797 "role": None, 

798 "query_validators": ["non_public_fields_validator", "public_query_validator"], 

799 "query_filters": ["only_in_doaj"], 

800 "result_filters": ["public_result_filter"], 

801 "dao": "portality.models.Article", # ~~->Article:Model~~ 

802 "required_parameters": {"ref": ["public_article", "toc", "subject_page"]}, 

803 "request_cache": True 

804 }, 

805 # back-compat for fixed query widget 

806 # ~~->PublicJournalArticleQuery:Endpoint~~ 

807 "journal,article": { 

808 "auth": False, 

809 "role": None, 

810 "query_validators": ["non_public_fields_validator", "public_query_validator"], 

811 "query_filters": ["only_in_doaj", "strip_facets", "es_type_fix", "journal_article_filter"], 

812 "result_filters": ["public_result_filter", "add_fqw_facets", "fqw_back_compat"], 

813 "dao": "portality.models.JournalArticle", # ~~->JournalArticle:Model~~ 

814 "required_parameters": {"ref": ["fqw"]} 

815 } 

816 }, 

817 "publisher_query": { 

818 # ~~->PublisherJournalQuery:Endpoint~~ 

819 "journal": { 

820 "auth": True, 

821 "role": "publisher", 

822 "query_validators": ["non_public_fields_validator"], 

823 "query_filters": ["owner", "only_in_doaj", "search_all_meta"], 

824 "result_filters": ["publisher_result_filter"], 

825 "dao": "portality.models.Journal" # ~~->Journal:Model~~ 

826 }, 

827 # ~~->PublisherApplicationQuery:Endpoint~~ 

828 "applications": { 

829 "auth": True, 

830 "role": "publisher", 

831 "query_validators": ["non_public_fields_validator"], 

832 "query_filters": ["owner", "not_update_request", "search_all_meta"], 

833 "result_filters": ["publisher_result_filter"], 

834 "dao": "portality.models.AllPublisherApplications" # ~~->AllPublisherApplications:Model~~ 

835 }, 

836 # ~~->PublisherUpdateRequestsQuery:Endpoint~~ 

837 "update_requests": { 

838 "auth": True, 

839 "role": "publisher", 

840 "query_validators": ["non_public_fields_validator"], 

841 "query_filters": ["owner", "update_request", "search_all_meta"], 

842 "result_filters": ["publisher_result_filter"], 

843 "dao": "portality.models.Application" # ~~->Application:Model~~ 

844 } 

845 }, 

846 "admin_query": { 

847 # ~~->AdminJournalQuery:Endpoint~~ 

848 "journal": { 

849 "auth": True, 

850 "role": "admin", 

851 "dao": "portality.models.Journal" # ~~->Journal:Model~~ 

852 }, 

853 # ~~->AdminApplicationQuery:Endpoint~~ 

854 "suggestion": { 

855 "auth": True, 

856 "role": "admin", 

857 "query_filters": ["not_update_request"], 

858 "dao": "portality.models.Application" # ~~->Application:Model~~ 

859 }, 

860 # ~~->AdminUpdateRequestQuery:Endpoint~~ 

861 "update_requests": { 

862 "auth": True, 

863 "role": "admin", 

864 "query_filters": ["update_request"], 

865 "dao": "portality.models.Application" # ~~->Application:Model~~ 

866 }, 

867 # ~~->AdminEditorGroupQuery:Endpoint~~ 

868 "editor,group": { 

869 "auth": True, 

870 "role": "admin", 

871 "dao": "portality.models.EditorGroup" # ~~->EditorGroup:Model~~ 

872 }, 

873 # ~~->AdminAccountQuery:Endpoint~~ 

874 "account": { 

875 "auth": True, 

876 "role": "admin", 

877 "dao": "portality.models.Account" # ~~->Account:Model~~ 

878 }, 

879 # ~~->AdminJournalArticleQuery:Endpoint~~ 

880 "journal,article": { 

881 "auth": True, 

882 "role": "admin", 

883 "dao": "portality.models.search.JournalArticle" # ~~->JournalArticle:Model~~ 

884 }, 

885 # ~~->AdminBackgroundJobQuery:Endpoint~~ 

886 "background,job": { 

887 "auth": True, 

888 "role": "admin", 

889 "dao": "portality.models.BackgroundJob" # ~~->BackgroundJob:Model~~ 

890 }, 

891 # ~~->APINotificationQuery:Endpoint~~ 

892 "notifications": { 

893 "auth": True, 

894 "role": "admin", 

895 "dao": "portality.models.Notification", # ~~->Notification:Model~~ 

896 "required_parameters": None 

897 }, 

898 "reports": { 

899 "auth": True, 

900 "role": "admin", 

901 "dao": "portality.models.Export" 

902 }, 

903 "journal_csv": { 

904 "auth": True, 

905 "role": "admin", 

906 "dao": "portality.models.JournalCSV" # ~~->JournalCSV:Model~~ 

907 }, 

908 "pdd": { 

909 "auth": True, 

910 "role": "admin", 

911 "dao": "portality.models.DataDump" # ~~->JournalCSV:Model~~ 

912 }, 

913 "alerts": { 

914 "auth": True, 

915 "role": "admin", 

916 "dao": "portality.models.AdminAlert", # ~~->AdminAlert:Model~~ 

917 "required_parameters": None 

918 }, 

919 "autoassign": { 

920 "auth": True, 

921 "role": "admin", 

922 "dao": "portality.models.URReviewRoute", # ~~->AdminAlert:Model~~ 

923 "required_parameters": None 

924 }, 

925 "ris": { 

926 "auth": True, 

927 "role": "admin", 

928 "dao": "portality.models.RISExport", # ~~->AdminAlert:Model~~ 

929 "required_parameters": None 

930 }, 

931 # ~~->SystemObjectProvenanceQuery:Endpoint~~ 

932 "provenance": { 

933 "auth": True, 

934 "role": "admin", 

935 "dao": "portality.models.Provenance", # ~~->Provenance:Model~~ 

936 "tolerate_missing_mapping": True 

937 }, 

938 # ~~->SystemObjectFileUploadQuery:Endpoint~~ 

939 "upload": { 

940 "auth": True, 

941 "role": "admin", 

942 "dao": "portality.models.FileUpload", # ~~->FileUpload:Model~~ 

943 "tolerate_missing_mapping": True 

944 }, 

945 # ~~->SystemObjectBulkUploadQuery:Endpoint~~ 

946 "bulk_articles": { 

947 "auth": True, 

948 "role": "admin", 

949 "dao": "portality.models.BulkArticles", # ~~->BulkArticles:Model~~ 

950 "tolerate_missing_mapping": True 

951 }, 

952 # ~~->SystemObjectCacheQuery:Endpoint~~ 

953 "cache": { 

954 "auth": True, 

955 "role": "admin", 

956 "dao": "portality.models.Cache", # ~~->Cache:Model~~ 

957 "tolerate_missing_mapping": True 

958 }, 

959 # ~~->SystemObjectLockQuery:Endpoint~~ 

960 "lock": { 

961 "auth": True, 

962 "role": "admin", 

963 "dao": "portality.models.Lock", # ~~->Lock:Model~~ 

964 "tolerate_missing_mapping": True 

965 }, 

966 # ~~->SystemObjectPreservationQuery:Endpoint~~ 

967 "preserve": { 

968 "auth": True, 

969 "role": "admin", 

970 "dao": "portality.models.PreservationState", # ~~->PreservationState:Model~~ 

971 "tolerate_missing_mapping": True 

972 }, 

973 # ~~->SystemObjectArticleTombstoneQuery:Endpoint~~ 

974 "article_tombstone": { 

975 "auth": True, 

976 "role": "admin", 

977 "dao": "portality.models.ArticleTombstone", # ~~->ArticleTombstone:Model~~ 

978 "tolerate_missing_mapping": True 

979 }, 

980 # ~~->SystemObjectDraftApplicationQuery:Endpoint~~ 

981 "draft_application": { 

982 "auth": True, 

983 "role": "admin", 

984 "dao": "portality.models.DraftApplication", # ~~->DraftApplication:Model~~ 

985 "tolerate_missing_mapping": True 

986 }, 

987 # ~~->SystemObjectHarvesterStateQuery:Endpoint~~ 

988 "harvester_state": { 

989 "auth": True, 

990 "role": "admin", 

991 "dao": "portality.models.HarvestState", # ~~->HarvestState:Model~~ 

992 "tolerate_missing_mapping": True 

993 }, 

994 # ~~->SystemObjectAutocheckQuery:Endpoint~~ 

995 "autocheck": { 

996 "auth": True, 

997 "role": "admin", 

998 "dao": "portality.models.Autocheck", # ~~->Autocheck:Model~~ 

999 "tolerate_missing_mapping": True 

1000 } 

1001 }, 

1002 "associate_query": { 

1003 # ~~->AssEdJournalQuery:Endpoint~~ 

1004 "journal": { 

1005 "auth": True, 

1006 "role": "associate_editor", 

1007 "query_validators": ["non_public_fields_validator"], 

1008 "query_filters": ["associate", "search_all_meta", "flagged"], 

1009 "dao": "portality.models.Journal" # ~~->Journal:Model~~ 

1010 }, 

1011 # ~~->AssEdApplicationQuery:Endpoint~~ 

1012 "suggestion": { 

1013 "auth": True, 

1014 "role": "associate_editor", 

1015 "query_validators": ["non_public_fields_validator"], 

1016 "query_filters": ["associate", "search_all_meta"], 

1017 "dao": "portality.models.Application" # ~~->Application:Model~~ 

1018 } 

1019 }, 

1020 "editor_query": { 

1021 # ~~->EditorJournalQuery:Endpoint~~ 

1022 "journal": { 

1023 "auth": True, 

1024 "role": "editor", 

1025 "query_validators": ["non_public_fields_validator"], 

1026 "query_filters": ["editor", "search_all_meta"], 

1027 "dao": "portality.models.Journal" # ~~->Journal:Model~~ 

1028 }, 

1029 # ~~->EditorApplicationQuery:Endpoint~~ 

1030 "suggestion": { 

1031 "auth": True, 

1032 "role": "editor", 

1033 "query_validators": ["non_public_fields_validator"], 

1034 "query_filters": ["editor", "search_all_meta"], 

1035 "dao": "portality.models.Application" # ~~->Application:Model~~ 

1036 } 

1037 }, 

1038 "api_query": { 

1039 # ~~->APIArticleQuery:Endpoint~~ 

1040 "article": { 

1041 "auth": False, 

1042 "role": None, 

1043 "query_filters": ["only_in_doaj", "public_source"], 

1044 "dao": "portality.models.Article", # ~~->Article:Model~~ 

1045 "required_parameters": None, 

1046 "keepalive": "10m" 

1047 }, 

1048 # ~~->APIJournalQuery:Endpoint~~ 

1049 "journal": { 

1050 "auth": False, 

1051 "role": None, 

1052 "query_validators": ["non_public_fields_validator"], 

1053 "query_filters": ["only_in_doaj", "public_source", "search_all_meta"], 

1054 "dao": "portality.models.Journal", # ~~->Journal:Model~~ 

1055 "required_parameters": None 

1056 }, 

1057 # ~~->APIApplicationQuery:Endpoint~~ 

1058 "application": { 

1059 "auth": True, 

1060 "role": None, 

1061 "query_validators": ["non_public_fields_validator"], 

1062 "query_filters": ["owner", "private_source", "search_all_meta"], 

1063 "dao": "portality.models.Suggestion", # ~~->Application:Model~~ 

1064 "required_parameters": None 

1065 } 

1066 }, 

1067 "dashboard_query": { 

1068 # ~~->APINotificationQuery:Endpoint~~ 

1069 "notifications": { 

1070 "auth": True, 

1071 "role": "read_notifications", 

1072 "query_filters": ["who_current_user"], # ~~-> WhoCurrentUser:Query 

1073 "dao": "portality.models.Notification", # ~~->Notification:Model~~ 

1074 "required_parameters": None 

1075 } 

1076 } 

1077} 

1078 

1079QUERY_FILTERS = { 

1080 # sanitisers 

1081 "public_query_validator": "portality.lib.query_filters.public_query_validator", 

1082 "non_public_fields_validator": "portality.lib.query_filters.non_public_fields_validator", 

1083 

1084 # query filters 

1085 "only_in_doaj": "portality.lib.query_filters.only_in_doaj", 

1086 "owner": "portality.lib.query_filters.owner", 

1087 "update_request": "portality.lib.query_filters.update_request", 

1088 "associate": "portality.lib.query_filters.associate", 

1089 "editor": "portality.lib.query_filters.editor", 

1090 "strip_facets": "portality.lib.query_filters.strip_facets", 

1091 "es_type_fix": "portality.lib.query_filters.es_type_fix", 

1092 "last_update_fallback": "portality.lib.query_filters.last_update_fallback", 

1093 "not_update_request": "portality.lib.query_filters.not_update_request", 

1094 "who_current_user": "portality.lib.query_filters.who_current_user", # ~~-> WhoCurrentUser:Query ~~ 

1095 "search_all_meta": "portality.lib.query_filters.search_all_meta", # ~~-> SearchAllMeta:Query ~~ 

1096 "journal_article_filter": "portality.lib.query_filters.journal_article_filter", 

1097 # ~~-> JournalArticleFilter:Query ~~ 

1098 

1099 # result filters 

1100 "public_result_filter": "portality.lib.query_filters.public_result_filter", 

1101 "publisher_result_filter": "portality.lib.query_filters.publisher_result_filter", 

1102 "add_fqw_facets": "portality.lib.query_filters.add_fqw_facets", 

1103 "fqw_back_compat": "portality.lib.query_filters.fqw_back_compat", 

1104 

1105 # source filters 

1106 "private_source": "portality.lib.query_filters.private_source", 

1107 "public_source": "portality.lib.query_filters.public_source", 

1108} 

1109# Exclude the fields that doesn't want to be searched by public queries 

1110# This is part of non_public_fields_validator. 

1111PUBLIC_QUERY_VALIDATOR__EXCLUDED_FIELDS = [ 

1112 # old protections for notes 

1113 # TODO: these MUST remain in place for the duration of deployment, they can be removed post migration 

1114 "admin.notes.note", 

1115 "admin.notes.id", 

1116 "admin.notes.author_id", 

1117 # New protections for notes 

1118 "admin.index.notes" 

1119] 

1120 

1121ADMIN_NOTES_INDEX_ONLY_FIELDS = { 

1122 "all_meta": { 

1123 "type": "text", 

1124 "fields": { 

1125 "exact": { 

1126 "type": "keyword", 

1127 "store": True 

1128 } 

1129 } 

1130 } 

1131} 

1132 

1133# These mappings prevent the notes and flags from being indexed in all_meta (the default for text fields) 

1134ADMIN_NOTES_SEARCH_MAPPING = { 

1135 "admin.index.notes": { 

1136 "type": "text" 

1137 }, 

1138 "admin.flag.note_id": { 

1139 "type": "text", 

1140 "fields": { 

1141 "exact": { 

1142 "type": "keyword", 

1143 "store": True 

1144 } 

1145 } 

1146 }, 

1147 "admin.flag.assigned_to": { 

1148 "type": "text", 

1149 "fields": { 

1150 "exact": { 

1151 "type": "keyword", 

1152 "store": True 

1153 } 

1154 } 

1155 } 

1156} 

1157 

1158ASCII_FOLDED = {"analyzer": "ascii_folded", "search_analyzer": "ascii_folded"} 

1159ASCII_FOLDED_ALL_META = {**ASCII_FOLDED, "copy_to": ["all_meta"]} 

1160 

1161JOURNAL_EXCEPTION_MAPPING = { 

1162 "bibjson.title" : {**DATAOBJ_TO_MAPPING_DEFAULTS["unicode"], **ASCII_FOLDED_ALL_META}, 

1163 "bibjson.alternative_title" : {**DATAOBJ_TO_MAPPING_DEFAULTS["unicode"], **ASCII_FOLDED_ALL_META}, 

1164 "bibjson.publisher.name" : {**DATAOBJ_TO_MAPPING_DEFAULTS["unicode"], **ASCII_FOLDED_ALL_META}, 

1165 "index.country" : {**DATAOBJ_TO_MAPPING_DEFAULTS["unicode"], **ASCII_FOLDED_ALL_META}, 

1166 "index.title": {**DATAOBJ_TO_MAPPING_DEFAULTS["unicode"], **ASCII_FOLDED_ALL_META} 

1167} 

1168 

1169ARTICLE_EXCEPTION_MAPPING = { 

1170 "bibjson.abstract" : {**DATAOBJ_TO_MAPPING_DEFAULTS["unicode"], **ASCII_FOLDED_ALL_META}, 

1171 "bibjson.author.name" : {**DATAOBJ_TO_MAPPING_DEFAULTS["unicode"], **ASCII_FOLDED_ALL_META}, 

1172 "bibjson.journal.publisher": {**DATAOBJ_TO_MAPPING_DEFAULTS["unicode"], **ASCII_FOLDED_ALL_META}, 

1173 "index.country": {**DATAOBJ_TO_MAPPING_DEFAULTS["unicode"], **ASCII_FOLDED_ALL_META}, 

1174 "bibjson.title": {**DATAOBJ_TO_MAPPING_DEFAULTS["unicode"], **ASCII_FOLDED_ALL_META} 

1175} 

1176 

1177#################################################### 

1178# Autocomplete 

1179 

1180# ~~->BibJSON:Model~~ 

1181AUTOCOMPLETE_ADVANCED_FIELD_MAPS = { 

1182 "bibjson.publisher.name": "index.publisher_ac", 

1183 "bibjson.institution.name": "index.institution_ac" 

1184} 

1185 

1186#################################################### 

1187# Application Form 

1188# ~~->ApplicationForm:Feature~~ 

1189 

1190# save the public application form as a draft every 60 seconds 

1191PUBLIC_FORM_AUTOSAVE = 60000 

1192 

1193############################################ 

1194# Atom Feed 

1195# ~~->AtomFeed:Feature~~ 

1196 

1197FEED_TITLE = "DOAJ Recent Journals Added" 

1198 

1199# Maximum number of feed entries to be given in a single response. If this is omitted, it will 

1200# default to 20 

1201MAX_FEED_ENTRIES = 100 

1202 

1203# Maximum age of feed entries (in seconds) (default value here is 30 days). 

1204MAX_FEED_ENTRY_AGE = 2592000 

1205 

1206# Licensing terms for feed content 

1207# ~~->SiteLicence:Content~~ 

1208FEED_LICENCE = "(c) DOAJ 2024. CC BY-SA." 

1209 

1210# name of the feed generator (goes in the atom:generator element) 

1211FEED_GENERATOR = "CottageLabs feed generator" 

1212 

1213# Larger image to use as the logo for all of the feeds 

1214# ~~->Favicon:Content~~ 

1215FEED_LOGO = "https://doaj.org/static/doaj/images/favicon.ico" 

1216 

1217########################################### 

1218# OAI-PMH SETTINGS 

1219# ~~->OAIPMH:Feature~~ 

1220 

1221OAI_ADMIN_EMAIL = 'helpdesk+oai@doaj.org' 

1222 

1223# ~~->OAIAriticleXML:Crosswalk~~ 

1224# ~~->OAIJournalXML:Crosswalk~~ 

1225OAI_DC_METADATA_FORMAT = { 

1226 "metadataPrefix": "oai_dc", 

1227 "schema": "http://www.openarchives.org/OAI/2.0/oai_dc.xsd", 

1228 "metadataNamespace": "http://www.openarchives.org/OAI/2.0/oai_dc/" 

1229} 

1230 

1231OAI_DOAJ_METADATA_FORMAT = { 

1232 "metadataPrefix": "oai_doaj", 

1233 "schema": "https://doaj.org/static/doaj/doajArticles.xsd", 

1234 "metadataNamespace": "https://doaj.org/features/oai_doaj/1.0/" 

1235} 

1236 

1237OAIPMH_METADATA_FORMATS = { 

1238 # "specific endpoint": [list, of, formats, supported] 

1239 

1240 None: [OAI_DC_METADATA_FORMAT], # no specific endpoint, the request is to the root /oai path 

1241 "article": [OAI_DC_METADATA_FORMAT, OAI_DOAJ_METADATA_FORMAT] 

1242} 

1243 

1244OAIPMH_IDENTIFIER_NAMESPACE = "doaj.org" 

1245 

1246OAIPMH_LIST_RECORDS_PAGE_SIZE = 100 

1247 

1248OAIPMH_LIST_IDENTIFIERS_PAGE_SIZE = 300 

1249 

1250OAIPMH_RESUMPTION_TOKEN_EXPIRY = 86400 

1251 

1252########################################## 

1253# Article XML configuration 

1254 

1255# paths to schema files to validate incoming documents against for the various 

1256# crosswalks available 

1257# ~~->CrossrefXML:Schema~~ 

1258# ~~->DOAJArticleXML:Schema~~ 

1259SCHEMAS = { 

1260 "doaj": os.path.join(BASE_FILE_PATH, "static", "doaj", "doajArticles.xsd"), 

1261 "crossref442": os.path.join(BASE_FILE_PATH, "static", "crossref", "crossref4.4.2.xsd"), 

1262 "crossref531": os.path.join(BASE_FILE_PATH, "static", "crossref", "crossref5.3.1.xsd") 

1263} 

1264 

1265# placeholders for the loaded schemas 

1266DOAJ_SCHEMA = None 

1267CROSSREF442_SCHEMA = None 

1268CROSSREF531_SCHEMA = None 

1269LOAD_CROSSREF_THREAD = None 

1270 

1271# mapping of format names to modules which implement the crosswalks 

1272# ~~->DOAJArticleXML:Crosswalk~~ 

1273# ~~->CrossrefXML:Crosswalk~~ 

1274ARTICLE_CROSSWALKS = { 

1275 "doaj": "portality.crosswalks.article_doaj_xml.DOAJXWalk", 

1276 "crossref442": "portality.crosswalks.article_crossref_xml.CrossrefXWalk442", 

1277 "crossref531": "portality.crosswalks.article_crossref_xml.CrossrefXWalk531" 

1278} 

1279 

1280# maximum size of files that can be provided by-reference (the default value is 250Mb) 

1281MAX_REMOTE_SIZE = 262144000 

1282 

1283################################################# 

1284# Cache settings 

1285# ~~->Cache:Feature~~ 

1286 

1287# number of seconds site statistics should be considered fresh 

1288# 1800s = 30mins 

1289SITE_STATISTICS_TIMEOUT = 1800 

1290 

1291# directory into which to put files which are cached (e.g. the csv) 

1292CACHE_DIR = os.path.join(ROOT_DIR, "cache") 

1293 

1294# Article and Journal History directories - they should be different 

1295# ~~->ArticleHistory:Feature~~ 

1296# ~~->JournalHistory:Feature~~ 

1297ARTICLE_HISTORY_DIR = os.path.join(ROOT_DIR, "history", "article") 

1298JOURNAL_HISTORY_DIR = os.path.join(ROOT_DIR, "history", "journal") 

1299 

1300################################################# 

1301# Sitemap settings 

1302# ~~->Sitemap:Feature~~ 

1303 

1304# approximate rate of change of the Table of Contents for journals 

1305TOC_CHANGEFREQ = "monthly" 

1306 

1307# Maximum number of sitemap entries per index file before splitting into chunks (50K entries, 50MB size is actual limit) 

1308SITEMAP_INDEX_MAX_ENTRIES = 90 

1309 

1310################################################## 

1311# News feed settings 

1312# ~~->News:Feature~~ 

1313 

1314BLOG_URL = "https://blog.doaj.org/" 

1315 

1316BLOG_FEED_URL = "https://blog.doaj.org/feed/" 

1317 

1318FRONT_PAGE_NEWS_ITEMS = 4 

1319 

1320NEWS_PAGE_NEWS_ITEMS = 20 

1321 

1322################################################## 

1323# Edit Lock settings 

1324# ~~->Lock:Feature~~ 

1325 

1326# amount of time loading an editable page locks it for, in seconds. 

1327EDIT_LOCK_TIMEOUT = 1200 

1328 

1329# amount of time a background task can lock a resource for, in seconds 

1330BACKGROUND_TASK_LOCK_TIMEOUT = 3600 

1331 

1332############################################### 

1333# Bit.ly configuration 

1334# ~~->Bitly:ExternalService~~ 

1335 

1336# bit,ly api shortening service 

1337# BITLY_SHORTENING_API_URL = "https://api-ssl.bitly.com/v4/shorten" 

1338 

1339# bitly oauth token 

1340# ENTER YOUR OWN TOKEN IN APPROPRIATE .cfg FILE 

1341# BITLY_OAUTH_TOKEN = "" 

1342 

1343 

1344################################################# 

1345# API configuration 

1346# ~~->API:Feature~~ 

1347# ~~->APISearch:Feature~~ 

1348 

1349# maximum number of records to return per page 

1350DISCOVERY_MAX_PAGE_SIZE = 100 

1351 

1352# maximum number of records to return in total (a request for a page starting beyond this number will fail) 

1353DISCOVERY_MAX_RECORDS_SIZE = 1000 

1354 

1355# ~~->ArticleBibJSON:Model~~ 

1356DISCOVERY_ARTICLE_SEARCH_SUBS = { 

1357 "title": "bibjson.title", 

1358 "doi": "bibjson.identifier.id.exact", 

1359 "issn": "index.issn.exact", 

1360 "publisher": "bibjson.journal.publisher", 

1361 "journal": "bibjson.journal.title", 

1362 "abstract": "bibjson.abstract" 

1363} 

1364 

1365DISCOVERY_ARTICLE_SORT_SUBS = { 

1366 "title": "index.unpunctitle.exact" 

1367} 

1368 

1369# ~~->JournalBibJSON:Model~~ 

1370DISCOVERY_JOURNAL_SEARCH_SUBS = { 

1371 "title": "index.title", 

1372 "issn": "index.issn.exact", 

1373 "publisher": "bibjson.publisher", 

1374 "license": "index.license.exact", 

1375 "username": "admin.owner.exact" 

1376} 

1377 

1378DISCOVERY_JOURNAL_SORT_SUBS = { 

1379 "title": "index.unpunctitle.exact", 

1380 "issn": "index.issn.exact" 

1381} 

1382 

1383DISCOVERY_APPLICATION_SEARCH_SUBS = { 

1384 "title": "index.title", 

1385 "issn": "index.issn.exact", 

1386 "publisher": "bibjson.publisher", 

1387 "license": "index.license.exact" 

1388} 

1389 

1390DISCOVERY_APPLICATION_SORT_SUBS = { 

1391 "title": "index.unpunctitle.exact", 

1392 "issn": "index.issn.exact" 

1393} 

1394 

1395# API data dump settings 

1396DISCOVERY_BULK_PAGE_SIZE = 1000 

1397DISCOVERY_RECORDS_PER_FILE = 100000 

1398 

1399###################################################### 

1400# Hotjar configuration 

1401# ~~->Hotjar:ExternalService~~ 

1402 

1403# hotjar id - only activate this in production 

1404HOTJAR_ID = "" 

1405 

1406###################################################### 

1407# Analytics configuration 

1408# specify in environment .cfg file - avoids sending live analytics events from test and dev environments 

1409 

1410# ~~->PlausibleAnalytics:ExternalService~~ 

1411# Plausible analytics 

1412# root url of plausible 

1413PLAUSIBLE_URL = "https://plausible.io" 

1414PLAUSIBLE_JS_URL = PLAUSIBLE_URL + "/js/script.outbound-links.file-downloads.js" 

1415PLAUSIBLE_API_URL = PLAUSIBLE_URL + "/api/event" 

1416# site name / domain name that used to register in plausible 

1417PLAUSIBLE_SITE_NAME = BASE_DOMAIN 

1418PLAUSIBLE_LOG_DIR = None 

1419 

1420# Analytics custom dimensions. These are configured in the interface. #fixme: are these still configured since the move from GA? 

1421ANALYTICS_DIMENSIONS = { 

1422 'oai_res_id': 'dimension1', # In analytics as OAI:Record 

1423} 

1424 

1425# Plausible for OAI-PMH 

1426# ~~-> OAIPMH:Feature~~ 

1427ANALYTICS_CATEGORY_OAI = 'OAI-PMH' 

1428 

1429# Plausible for Atom 

1430# ~~-> Atom:Feature~~ 

1431ANALYTICS_CATEGORY_ATOM = 'Atom' 

1432ANALYTICS_ACTION_ACTION = 'Feed request' 

1433 

1434# Plausible for JournalCSV 

1435# ~~-> JournalCSV:Feature~~ 

1436ANALYTICS_CATEGORY_JOURNALCSV = 'JournalCSV' 

1437ANALYTICS_ACTION_JOURNALCSV = 'Download' 

1438 

1439# Plausible for OpenURL 

1440# ~~->OpenURL:Feature~~ 

1441ANALYTICS_CATEGORY_OPENURL = 'OpenURL' 

1442 

1443# Plausible for PublicDataDump 

1444# ~~->PublicDataDump:Feature~~ 

1445ANALYTICS_CATEGORY_PUBLICDATADUMP = 'PublicDataDump' 

1446ANALYTICS_ACTION_PUBLICDATADUMP = 'Download' 

1447 

1448# Plausible for RIS 

1449# ~~->PublicDataDump:Feature~~ 

1450ANALYTICS_CATEGORY_RIS = 'RIS' 

1451ANALYTICS_ACTION_RISEXPORT = 'Export' 

1452 

1453# Plausible for Urlshort 

1454# ~~->URLShortener:Feature~~ 

1455ANALYTICS_CATEGORY_URLSHORT = 'ShortURL' 

1456ANALYTICS_ACTION_URLSHORT_ADD = 'Find or create short url' 

1457ANALYTICS_ACTION_URLSHORT_REDIRECT = 'Redirect' 

1458 

1459# Plausible for API 

1460# ~~-> API:Feature~~ 

1461ANALYTICS_CATEGORY_API = 'API Hit' 

1462ANALYTICS_ACTIONS_API = { 

1463 'search_applications': 'Search applications', 

1464 'search_journals': 'Search journals', 

1465 'search_articles': 'Search articles', 

1466 'create_application': 'Create application', 

1467 'retrieve_application': 'Retrieve application', 

1468 'update_application': 'Update application', 

1469 'delete_application': 'Delete application', 

1470 'create_article': 'Create article', 

1471 'retrieve_article': 'Retrieve article', 

1472 'update_article': 'Update article', 

1473 'delete_article': 'Delete article', 

1474 'retrieve_journal': 'Retrieve journal', 

1475 'bulk_application_create': 'Bulk application create', 

1476 'bulk_application_delete': 'Bulk application delete', 

1477 'bulk_article_create': 'Bulk article create', 

1478 'bulk_article_create_status': 'Bulk article create status', 

1479 'bulk_article_delete': 'Bulk article delete' 

1480} 

1481 

1482# Plausible for fixed query widget 

1483# ~~->FixedQueryWidget:Feature~~ 

1484ANALYTICS_CATEGORY_FQW = 'FQW' 

1485ANALYTICS_ACTION_FQW = 'Hit' 

1486 

1487##################################################### 

1488# Anonymised data export (for dev) configuration 

1489# ~~->AnonExport:Feature~~ 

1490 

1491ANON_SALT = 'changeme' 

1492 

1493# ======================================== 

1494# Quick Reject Feature Config 

1495# ~~->QuickReject:Feature~~ 

1496 

1497QUICK_REJECT_REASONS = [ 

1498 "The journal has not published enough research content to qualify for DOAJ inclusion.", 

1499 "The ISSN is incorrect, provisional or not registered with issn.org.", 

1500 "The URL(s) provided in the application do not work.", 

1501 "The journal is already in DOAJ.", 

1502 "The journal is not Open Access.", 

1503 "The journal title in the application and/or website does not match the title at issn.org.", 

1504 "The application has incorrect answers or the URLs given do not provide the required information.", 

1505 "This application is a duplicate.", 

1506 "The full-text articles are not available article by article with individual links.", 

1507 "The information in the journal implies that it does not employ a fair & robust peer review process.", 

1508 "The journal or publisher has been previously rejected or removed from DOAJ.", 

1509 "The journal's copyright policy is not available or unclear.", 

1510 "The journal's licensing policy is not available or unclear.", 

1511 "The information about the journal is in different languages.", 

1512 "The information about the journal is not the same in all languages.", 

1513 "The journal makes a false claim to be indexed in DOAJ or other databases or displays non-standard Impact Factors.", 

1514 "The journal does not employ good publishing practices." 

1515] 

1516 

1517MINIMAL_OA_START_DATE = 1900 

1518 

1519############################################# 

1520# Harvester Configuration 

1521# ~~->Harvester:Feature~~ 

1522 

1523# Configuration options for the DOAJ API Client 

1524 

1525# EPMC Client configuration 

1526# ~~-> EPMC:ExternalService~~ 

1527EPMC_REST_API = "https://www.ebi.ac.uk/europepmc/webservices/rest/" 

1528EPMC_TARGET_VERSION = "6.9" # doc here: https://europepmc.org/docs/Europe_PMC_RESTful_Release_Notes.pdf 

1529EPMC_HARVESTER_THROTTLE = 0.2 

1530 

1531# General harvester configuration 

1532HARVESTERS = [ 

1533 "portality.tasks.harvester_helpers.epmc.epmc_harvester.EPMCHarvester" 

1534] 

1535 

1536INITIAL_HARVEST_DATE = "2015-12-01T00:00:00Z" 

1537 

1538# List of account ids to harvest from. MUST NOT be checked into the repo, put these 

1539# in the local.cfg instead 

1540HARVEST_ACCOUNTS = [] 

1541 

1542# Amount of time a harvester record is allowed to be in "queued" or "processing" state before we 

1543# assume it's a zombie, and ignore it 

1544HARVESTER_ZOMBIE_AGE = 604800 

1545 

1546####################################################### 

1547# Preservation configuration 

1548# ~~->Preservation:Feature 

1549PRESERVATION_URL = "http://PresevatinURL" 

1550PRESERVATION_USERNAME = "user_name" 

1551PRESERVATION_PASSWD = "password" 

1552PRESERVATION_COLLECTION = {} 

1553 

1554######################################################### 

1555# Background tasks --- anon export 

1556TASKS_ANON_EXPORT_CLEAN = False 

1557TASKS_ANON_EXPORT_LIMIT = None 

1558TASKS_ANON_EXPORT_BATCH_SIZE = 100000 

1559TASKS_ANON_EXPORT_SCROLL_TIMEOUT = '5m' 

1560 

1561######################################################### 

1562# Background tasks --- old_data_cleanup 

1563TASK_DATA_RETENTION_DAYS = { 

1564 "notification": 180, # ~~-> Notifications:Feature ~~ 

1565 "background_job": 180, # ~~-> BackgroundJobs:Feature ~~ 

1566 "admin_alert": 180, # ~~-> AdminAlerts:Feature ~~ 

1567} 

1568 

1569######################################## 

1570# Editorial Dashboard - set to-do list size 

1571TODO_LIST_SIZE = 48 

1572 

1573######################################################### 

1574# Background tasks --- monitor_bgjobs 

1575TASKS_MONITOR_BGJOBS_TO = ["helpdesk@doaj.org", ] 

1576TASKS_MONITOR_BGJOBS_FROM = "helpdesk@doaj.org" 

1577 

1578################################## 

1579# Background monitor 

1580# ~~->BackgroundMonitor:Feature~~ 

1581 

1582# some time period for convenience 

1583_MIN = 60 

1584_HOUR = 3600 

1585_DAY = 24 * _HOUR 

1586_WEEK = 7 * _DAY 

1587_YEAR = 52 * _WEEK + _DAY # unless it's a leap year 

1588 

1589# Configures the age of the last completed job on the queue before the queue is marked as unstable 

1590# (in seconds) 

1591BG_MONITOR_LAST_COMPLETED = { 

1592 'events': 2 * _HOUR, # 2 hours 

1593 'scheduled_short': 2 * _HOUR, # 2 hours 

1594 'scheduled_long': _DAY + 2 * _HOUR, # 26 hours 

1595} 

1596 

1597# Default monitoring config for background job types which are not enumerated in BG_MONITOR_ERRORS_CONFIG below 

1598BG_MONITOR_DEFAULT_CONFIG = { 

1599 ## default values for queued config 

1600 

1601 # the total number of items that are allowed to be in `queued` state at the same time. 

1602 # Any more than this and the result is flagged 

1603 'total': 2, 

1604 

1605 # The age of the oldest record allowed to be in the `queued` state. 

1606 # If the oldest queued item was created before this, the result is flagged 

1607 'oldest': 20 * _MIN, 

1608 

1609 ## default values for error config 

1610 

1611 # The time period over which to check for errors, from now to now - check_sec 

1612 'check_sec': _HOUR, 

1613 

1614 # The number of errors allowed in the check period before the result is flagged 

1615 'allowed_num_err': 0, 

1616 

1617 # The last time this job ran within the specified time period, was it successful. 

1618 # If the most recent job in the timeframe is an error, this will trigger an "unstable" state (0 turns this off) 

1619 'last_run_successful_in': 0 

1620} 

1621 

1622# Configures the monitoring period and the allowed number of errors in that period before a queue is marked 

1623# as unstable 

1624BG_MONITOR_ERRORS_CONFIG = { 

1625 'anon_export': { 

1626 # anon_export only runs monthly, so a raw count of errors within a rolling window 

1627 # can't distinguish "still failing" from "failed a few times then succeeded" - disable 

1628 # this check and rely on BG_MONITOR_LAST_SUCCESSFULLY_RUN_CONFIG['anon_export'] instead, 

1629 # which only cares whether the most recent run succeeded. 

1630 'allowed_num_err': None 

1631 }, 

1632 'article_bulk_create': { 

1633 'check_sec': _DAY, # 1 day 

1634 'allowed_num_err': 0, 

1635 }, 

1636 'article_cleanup_sync': { 

1637 'check_sec': 2 * _DAY, # 2 days 

1638 'allowed_num_err': 0 

1639 }, 

1640 'harvest': { 

1641 # harvest runs daily and is sometimes re-run manually after a failure - disable the error 

1642 # count and rely on BG_MONITOR_LAST_SUCCESSFULLY_RUN_CONFIG['harvest'] instead, which only 

1643 # cares whether the most recent run succeeded. 

1644 'allowed_num_err': None 

1645 }, 

1646 'ingest_articles': { 

1647 'check_sec': _DAY, 

1648 'allowed_num_err': 0 

1649 }, 

1650 'journal_csv': { 

1651 'check_sec': 3 * _HOUR, 

1652 'allowed_num_err': 1, 

1653 }, 

1654 'public_data_dump': { 

1655 'check_sec': 2 * _HOUR, 

1656 'allowed_num_err': 0 

1657 }, 

1658 'process_event': { 

1659 'check_sec': 2 * _HOUR, 

1660 'allowed_num_err': 0 

1661 } 

1662} 

1663 

1664# Configures the total number of queued items and the age of the oldest of those queued items allowed 

1665# before the queue is marked as unstable. This is provided by type, so we can monitor all types separately 

1666BG_MONITOR_QUEUED_CONFIG = { 

1667 'anon_export': { 

1668 'total': 1, 

1669 'oldest': 20 * _MIN 

1670 }, 

1671 'article_bulk_create': { 

1672 'total': 3, 

1673 'oldest': 10 * _MIN 

1674 }, 

1675 'harvest': { 

1676 'total': 1, 

1677 'oldest': _DAY 

1678 }, 

1679 'ingest_articles': { 

1680 'total': 10, 

1681 'oldest': 10 * _MIN 

1682 }, 

1683 'journal_bulk_edit': { 

1684 'total': 2, 

1685 'oldest': 10 * _MIN 

1686 }, 

1687 'journal_csv': { 

1688 'total': 1, 

1689 'oldest': 20 * _MIN 

1690 }, 

1691 'public_data_dump': { 

1692 'total': 1, 

1693 'oldest': _DAY 

1694 }, 

1695 'set_in_doaj': { 

1696 'total': 2, 

1697 'oldest': 10 * _MIN 

1698 }, 

1699 'suggestion_bulk_edit': { 

1700 'total': 2, 

1701 'oldest': 10 * _MIN 

1702 }, 

1703 'process_event': { 

1704 'total': 500, 

1705 'oldest': 6 * _HOUR 

1706 } 

1707} 

1708 

1709BG_MONITOR_LAST_SUCCESSFULLY_RUN_CONFIG = { 

1710 'anon_export': { 

1711 'last_run_successful_in': 32 * _DAY 

1712 }, 

1713 'article_cleanup_sync': { 

1714 'last_run_successful_in': 33 * _DAY 

1715 }, 

1716 'async_workflow_notifications': { 

1717 'last_run_successful_in': _WEEK + _DAY 

1718 }, 

1719 'check_latest_es_backup': { 

1720 'last_run_successful_in': _DAY + 2 * _HOUR 

1721 }, 

1722 'datalog_journal_added_update': { 

1723 'last_run_successful_in': _DAY + 2 * _HOUR 

1724 }, 

1725 'find_discontinued_soon': { 

1726 'last_run_successful_in': _DAY + 2 * _HOUR 

1727 }, 

1728 'approaching_flag_deadline': { 

1729 'last_run_successful_in': _DAY + _HOUR 

1730 }, 

1731 'harvest': { 

1732 'last_run_successful_in': _DAY + 2 * _HOUR 

1733 }, 

1734 'journal_csv': { 

1735 'last_run_successful_in': 2 * _HOUR 

1736 }, 

1737 'monitor_bgjobs': { 

1738 'last_run_successful_in': _WEEK + _DAY 

1739 }, 

1740 'old_data_cleanup': { 

1741 'last_run_successful_in': 32 * _DAY 

1742 }, 

1743 'prune_es_backups': { 

1744 'last_run_successful_in': _DAY + 2 * _HOUR 

1745 }, 

1746 'public_data_dump': { 

1747 'last_run_successful_in': 32 * _DAY 

1748 }, 

1749 'read_news': { 

1750 'last_run_successful_in': 2 * _HOUR 

1751 }, 

1752 'reporting': { 

1753 'last_run_successful_in': 32 * _DAY 

1754 }, 

1755 'request_es_backup': { 

1756 'last_run_successful_in': _DAY + 2 * _HOUR 

1757 }, 

1758 'sitemap': { 

1759 'last_run_successful_in': _DAY + 2 * _HOUR 

1760 } 

1761} 

1762 

1763################################################## 

1764# Public data dump settings 

1765 

1766# how long should the temporary URL for public data dumps last 

1767PUBLIC_DATA_DUMP_URL_TIMEOUT = 3600 

1768 

1769################################################## 

1770# Journal CSV Setings 

1771 

1772# how long should the temporary URL for journal csvs last 

1773JOURNAL_CSV_URL_TIMEOUT = 3600 

1774 

1775################################################## 

1776# Pages under maintenance 

1777 

1778PRESERVATION_PAGE_UNDER_MAINTENANCE = False 

1779 

1780# report journals that discontinue in ... days (eg. 1 = tomorrow) 

1781DISCONTINUED_DATE_DELTA = 0 

1782 

1783#################################################### 

1784# Flag management 

1785 

1786# find approaching deadlines in ... days (eg. 1 = tomorrow) 

1787FLAG_APPROACHING_DEADLINE_DELTA = 7 

1788 

1789################################################## 

1790# Feature tours currently active 

1791 

1792TOUR_COOKIE_PREFIX = "doaj_tour_" 

1793TOUR_COOKIE_MAX_AGE = 31536000 

1794 

1795TOURS = { 

1796 "/admin/application/*": [ 

1797 { 

1798 "roles": ["admin"], 

1799 "selectors": [".flags__container"], 

1800 "content_id": "admin_flags", 

1801 "name": "Flags", 

1802 "description": "Make teamwork smoother by adding a flag to journals and applications — a note assigned to a teammate, with an optional deadline." 

1803 } 

1804 ], 

1805 "/admin/journal/*": [ 

1806 { 

1807 "roles": ["admin"], 

1808 "selectors": [".autochecks-manager-toggle"], 

1809 "content_id": "admin_journal_autochecks", 

1810 "name": "Autochecks", 

1811 "description": "Autochecks are available on some journals, and can help you to identify potential problems with the journal's metadata." 

1812 } 

1813 ], 

1814 "/editor/": [ 

1815 { 

1816 "roles": ["editor"], 

1817 "content_id": "application_by_status", 

1818 "name": "New Links in the Colour Legend", 

1819 "description": "Discover how the colour legend labels now serve as links to quickly filter and view applications by group and status." 

1820 } 

1821 ], 

1822 "/dashboard/": [ 

1823 { 

1824 "roles": ["admin"], 

1825 "content_id": "application_by_status", 

1826 "name": "New Links in the Colour Legend", 

1827 "description": "Discover how the colour legend labels now serve as links to quickly filter and view applications by group and status." 

1828 } 

1829 ] 

1830} 

1831 

1832####################################################### 

1833# Selenium test environment 

1834 

1835# url of selenium server, selenium remote will be used if it's not empty 

1836# usually it's a docker container and the url should be 'http://localhost:4444/wd/hub' 

1837SELENIUM_REMOTE_URL = 'http://localhost:4444/wd/hub' 

1838 

1839# host and port that used to run doaj server in background for selenium testcases 

1840# if you use docker selenium browser container, ip should be ip of docker network interface such as 172.17.0.1 

1841# SELENIUM_DOAJ_HOST = 'localhost' 

1842SELENIUM_DOAJ_HOST = '172.17.0.1' 

1843SELENIUM_DOAJ_PORT = 5014 

1844 

1845################################################# 

1846# Concurrency timeout(s) 

1847 

1848UR_CONCURRENCY_TIMEOUT = 10 

1849 

1850############################################# 

1851# Google Sheet 

1852# ~~->GoogleSheet:ExternalService~~ 

1853 

1854# Google Sheet API 

1855# value should be key file path of json, empty string means disabled 

1856GOOGLE_KEY_PATH = '' 

1857 

1858# The /export path to test users CSV file on google sheets (file is public) 

1859TEST_USERS_CSV_DL_PATH = "" 

1860 

1861 

1862############################################# 

1863# Datalog 

1864# ~~->Datalog:Feature~~ 

1865 

1866# Datalog for Journal Added 

1867 

1868# google sheet filename for datalog ja 

1869DATALOG_JA_FILENAME = 'DOAJ: journals added and withdrawn' 

1870 

1871# worksheet name or tab name that datalog will write to 

1872DATALOG_JA_WORKSHEET_NAME = 'Added' 

1873 

1874################################################## 

1875# Autocheck Resource configurations 

1876 

1877# Should we autocheck incoming applications and update requests 

1878AUTOCHECK_INCOMING = False 

1879 

1880AUTOCHECK_RESOURCE_ISSN_ORG_TIMEOUT = 10 

1881AUTOCHECK_RESOURCE_ISSN_ORG_THROTTLE = 1 # seconds between requests 

1882 

1883################################################### 

1884# Automatic Update Request editor group assignment 

1885 

1886AUTO_ASSIGN_UR_EDITOR_GROUP = True 

1887AUTO_ASSIGN_EDITOR_BY_PUBLISHER_SHEET = "https://docs.google.com/spreadsheets/d/e/2PACX-1vQg09oCuqQcP0XTFyRiLzpPFoqUeEE6hSDEIglUvSLU-TGVP9C3j4XLgslmBLJmQcdlGujz1b9TN6CN/pub?gid=0&single=true&output=csv" 

1888AUTO_ASSIGN_EDITOR_BY_COUNTRY_SHEET = "https://docs.google.com/spreadsheets/d/e/2PACX-1vQg09oCuqQcP0XTFyRiLzpPFoqUeEE6hSDEIglUvSLU-TGVP9C3j4XLgslmBLJmQcdlGujz1b9TN6CN/pub?gid=1948254841&single=true&output=csv" 

1889AUTO_ASSIGN_EDITOR_GOOGLE_SHEET = "https://docs.google.com/spreadsheets/d/1EDvesL3si4zRj97RCUjTcqglin_XJ5OLGAR8xifoTr0/edit" 

1890 

1891################################################## 

1892# Background jobs Management settings 

1893 

1894# list of actions name that will be cleaned up if they are redundant 

1895BGJOB_MANAGE_REDUNDANT_ACTIONS = [ 

1896 'read_news', 'journal_csv' 

1897] 

1898 

1899ANON_EXPORT_SKIP_LIST = ['ris_export', 'cache'] 

1900 

1901################################################## 

1902# Honeypot bot-trap settings for forms (now: only registration form) 

1903HONEYPOT_TIMER_THRESHOLD = 5000 

1904 

1905################################ 

1906# Url Shortener 

1907# ~~->URLShortener:Feature~~ 

1908 

1909# URLSHORT_LIMIT* used to limit the number of short URLs (URLSHORT_LIMIT) created 

1910# by a user within a certain time period (URLSHORT_LIMIT_WITHIN_DAYS) 

1911URLSHORT_LIMIT_WITHIN_DAYS = 7 

1912URLSHORT_LIMIT = 50_000 

1913 

1914URLSHORT_ALLOWED_SUPERDOMAINS = ['doaj.org'] 

1915URLSHORT_ALIAS_LENGTH = 6 

1916HONEYPOT_TIMER_THRESHOLD = 5000 

1917 

1918################################################## 

1919# Premium membership configurations 

1920 

1921# Should the system enforce premium membership mode 

1922PREMIUM_MODE = True 

1923 

1924# should the system respect phase-in mode, accommodating the phase-in start as the 

1925# oldest date for non-premium content 

1926PREMIUM_PHASE_IN = False 

1927PREMIUM_PHASE_IN_START = datetime(2026, 3, 19) 

1928 

1929# What is the delay non-premium users have to data access 

1930NON_PREMIUM_DELAY_SECONDS = 30 * _DAY 

1931 

1932################################################## 

1933# Object validation settings 

1934 

1935SEAMLESS_JOURNAL_LIKE_SILENT_PRUNE = False 

1936SEAMLESS_JOURNAL_LIKE_OTHER_FIELDS = False