def medical_annotators(text): api_key_annotator = '{api-key}' url_annotator = 'url-annotator' service = acd.AnnotatorForClinicalDataV1( authenticator=IAMAuthenticator(apikey=api_key_annotator), version='2020-06-03') service.set_service_url(url_annotator) flowId = "wh_acd.ibm_clinical_insights_v1.0_standard_flow" try: output_dict = {} response = service.analyze_with_flow(flowId, text) concepts = response.concepts for concept in concepts: print("Type: ", concept.type, "- Name: ", concept.preferred_name) output_dict[concept.type] = concept.preferred_name return output_dict except acd.ACDException as ex: print("Error Occurred: Code ", ex.code, " Message ", ex.message, " CorrelationId ", ex.correlation_id)
# See the License for the specific language governing permissions and # limitations under the License. import configparser from ibm_cloud_sdk_core.authenticators.iam_authenticator import IAMAuthenticator import ibm_whcs_sdk.annotator_for_clinical_data as wh CONFIG = configparser.RawConfigParser() CONFIG.read('./ibm_whcs_sdk/annotator_for_clinical_data/tests/config.ini') BASE_URL = CONFIG.get('settings', 'base_url') APIKEY = CONFIG.get('settings', 'key') IAMURL = CONFIG.get('settings', 'iam_url') VERSION = CONFIG.get('settings', 'version') LEVEL = CONFIG.get('settings', 'logging_level') DISABLE_SSL = CONFIG.get('settings', 'disable_ssl') PROFILE = CONFIG.get('settings', 'profile') ACD = wh.AnnotatorForClinicalDataV1(authenticator=IAMAuthenticator( apikey=APIKEY, url=IAMURL, disable_ssl_verification=DISABLE_SSL), version=VERSION) ACD.set_service_url(BASE_URL) ACD.set_disable_ssl_verification(DISABLE_SSL) def test_delete_user_specific_artifacts(): try: ACD.delete_user_specific_artifacts() except wh.ACDException as acde: assert acde.code == 400 or acde.code == 405