File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -46,3 +46,6 @@ EMAIL_USER=example@cogstack.org
4646EMAIL_PASS="to be changed"
4747EMAIL_HOST=mail.cogstack.org
4848EMAIL_PORT=465
49+
50+ # Remote model service timeout in seconds
51+ REMOTE_MODEL_SERVICE_TIMEOUT=60
Original file line number Diff line number Diff line change @@ -44,4 +44,7 @@ LOAD_NUM_DOC_PAGES=10
4444EMAIL_USER=example@cogstack.org
4545EMAIL_PASS="to be changed"
4646EMAIL_HOST=mail.cogstack.org
47- EMAIL_PORT=465
47+ EMAIL_PORT=465
48+
49+ # Remote model service timeout in seconds
50+ REMOTE_MODEL_SERVICE_TIMEOUT=60
Original file line number Diff line number Diff line change @@ -64,8 +64,11 @@ def call_remote_model_service(service_url, text):
6464 "text" : text
6565 }
6666
67+ # Get timeout from environment variable, default to 60 seconds
68+ timeout = int (os .getenv ('REMOTE_MODEL_SERVICE_TIMEOUT' , '60' ))
69+
6770 try :
68- response = requests .post (api_url , json = payload , timeout = 60 )
71+ response = requests .post (api_url , json = payload , timeout = timeout )
6972 response .raise_for_status ()
7073 result = response .json ()
7174
Original file line number Diff line number Diff line change 1919from rest_framework .response import Response
2020from medcat .components .ner .trf .deid import DeIdModel
2121from medcat .utils .cdb_utils import ch2pt_from_pt2ch , get_all_ch , snomed_ct_concept_path
22+ from medcat .utils .config_utils import temp_changed_config
23+
2224
2325from .admin import download_projects_with_text , download_projects_without_text , \
2426 import_concepts_from_cdb
@@ -678,10 +680,8 @@ def annotate_text(request):
678680 logger .warning (f'Failed to get children for CUI { parent_cui } : { e } ' )
679681 cuis_set = expanded_cuis
680682
681- curr_cuis = cat .config .components .linking .filters
682- cat .config .components .linking .filters .cuis = cuis_set
683- spacy_doc = cat (message )
684- cat .config .components .linking .filters = curr_cuis
683+ with temp_changed_config (cat .config .components .linking , 'filters' , cuis_set ):
684+ spacy_doc = cat (message )
685685
686686 ents = []
687687 anno_tkns = []
You can’t perform that action at this time.
0 commit comments