File tree Expand file tree Collapse file tree 7 files changed +36
-9
lines changed Expand file tree Collapse file tree 7 files changed +36
-9
lines changed Original file line number Diff line number Diff line change 11# Project specific
22
3+ /.idea /
34example-output /
45example-phi-build /
56
@@ -233,4 +234,4 @@ fabric.properties
233234.idea /httpRequests
234235
235236# Android studio 3.1+ serialized cache file
236- .idea /caches /build_file_checksums.ser
237+ .idea /caches /build_file_checksums.ser
Original file line number Diff line number Diff line change @@ -432,6 +432,6 @@ valid-metaclass-classmethod-first-arg=mcs
432432
433433# Exceptions that will emit a warning when being caught. Defaults to
434434# "Exception"
435- overgeneral-exceptions =StandardError,
436- Exception,
437- BaseException
435+ overgeneral-exceptions =builtins. StandardError,
436+ builtins. Exception,
437+ builtins. BaseException
Original file line number Diff line number Diff line change 11"""Public API"""
22
3- __version__ = "2.0 .0"
3+ __version__ = "2.1 .0"
44
55from . import client
66from . import filesystem
Original file line number Diff line number Diff line change @@ -218,9 +218,19 @@ def _resource_file(filename: str) -> str:
218218 return os .path .join (os .path .dirname (__file__ ), "resources" , filename )
219219
220220
221+ def covid_symptoms_path () -> str :
222+ """Returns the path to a bsv file of covid symptoms"""
223+ return _resource_file ("covid_symptoms.bsv" )
224+
225+
221226def covid_symptoms () -> List [BsvConcept ]:
222227 """Returns a list of known covid symptoms"""
223- return list_bsv_concept (_resource_file ("covid_symptoms.bsv" ))
228+ return list_bsv_concept (covid_symptoms_path ())
229+
230+
231+ def umls_semantic_groups_path () -> str :
232+ """Returns the path to a bsv file of UMLS semantic groups"""
233+ return _resource_file ("SemGroups_2018.bsv" )
224234
225235
226236def umls_semantic_groups () -> List [BsvSemanticType ]:
@@ -229,4 +239,4 @@ def umls_semantic_groups() -> List[BsvSemanticType]:
229239
230240 See https://lhncbc.nlm.nih.gov/ii/tools/MetaMap/documentation/SemanticTypesAndGroups.html
231241 """
232- return list_bsv_semantics (_resource_file ( "SemGroups_2018.bsv" ))
242+ return list_bsv_semantics (umls_semantic_groups_path ( ))
Original file line number Diff line number Diff line change @@ -237,7 +237,7 @@ def _nlp_polarity(polarity: Polarity) -> Extension:
237237
238238
239239def _nlp_derivation_span (docref_id , span : Span ) -> Extension :
240- return _nlp_derivation (docref_id = docref_id , offset = span .begin , length = ( span .end - span .begin ) )
240+ return _nlp_derivation (docref_id = docref_id , offset = span .begin , length = span .end - span .begin )
241241
242242
243243def _nlp_derivation (docref_id , offset = None , length = None ) -> Extension :
Original file line number Diff line number Diff line change @@ -137,7 +137,7 @@ def parse_polarity(polarity) -> Polarity:
137137 elif polarity == 0 :
138138 return Polarity .pos
139139 else :
140- raise Exception (f"polarity unknown: { polarity } " )
140+ raise ValueError (f"polarity unknown: { polarity } " )
141141
142142 @staticmethod
143143 def parse_mention (mention : str ) -> UmlsTypeMention :
Original file line number Diff line number Diff line change 11"""Tests for the filesystem module"""
22
3+ import os
34import unittest
45
6+ import ddt
7+
58from ctakesclient import filesystem
69from tests .test_resources import PathResource
710
811
12+ @ddt .ddt
913class TestCovidSymptomsBSV (unittest .TestCase ):
1014 """Test case for files loaded from bsv"""
1115
16+ @ddt .data (
17+ filesystem .covid_symptoms_path ,
18+ filesystem .umls_semantic_groups_path ,
19+ )
20+ def test_path_methods (self , method ):
21+ """Verify we hand out a bsv path correctly"""
22+ path = method ()
23+ self .assertIsInstance (path , str )
24+ self .assertTrue (path .endswith (".bsv" ))
25+ self .assertTrue (os .path .isabs (path ))
26+ self .assertTrue (os .path .isfile (path ))
27+
1228 def test_covid_symptom_concepts (self ):
1329 """
1430 Symptoms of COVID-19
You can’t perform that action at this time.
0 commit comments