From 526744dee2b214773b53263ae5fbfe1a55c1dfe9 Mon Sep 17 00:00:00 2001 From: kimong Date: Wed, 5 Mar 2014 15:04:37 -0500 Subject: [PATCH] [GF#33228] Update NCBO REST client code. --- software/build/project.properties | 2 +- .../nih/nci/evs/browser/common/Constants.java | 2 +- .../nih/nci/evs/browser/utils/DataUtils.java | 47 ++++++++++++++----- 3 files changed, 37 insertions(+), 14 deletions(-) diff --git a/software/build/project.properties b/software/build/project.properties index 6127eafb7..679be92e4 100644 --- a/software/build/project.properties +++ b/software/build/project.properties @@ -55,7 +55,7 @@ lex.evs.api.url=http://ncias-d499-v.nci.nih.gov:29780/lexevsapi61 ; ncit.url = URL to NCIt application ; meddra_security_token = MedDRA security token ; ncbo_api_key = NCBO API key -ncbo_widget_info=NCI_Thesaurus|NCI_Thesaurus|NCIT;CTCAE|CTCAE|CTCAE;NPO|NPO|NPO;GO|GO|GO;SNOMED Clinical Terms|SNOMEDCT|SNOMEDCT;HGNC|HUGO|HUGO;HL7|HL7|HL7;LOINC|LOINC|LOINC;ICD-9-CM|ICD9CM|ICD9CM;MA|MA|MA;RadLex|RADLEX|RADLEX;ICD-10-CM|ICD10CM|ICD10CM;OBI|OBI|OBI;PDQ|PDQ|PDQ;NDFRT|NDFRT|NDFRT; +ncbo_widget_info=NPO|http://purl.bioontology.org/ontology/npo#|NPO;GO|http://purl.obolibrary.org/obo/|GO;SNOMED Clinical Terms|http://purl.bioontology.org/ontology/SNOMEDCT/|SNOMEDCT;HGNC|http://ncicb.nci.nih.gov/xml/owl/EVS/Hugo.owl#|HUGO;NCI_Thesaurus|http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#|NCIT;LOINC|http://purl.bioontology.org/ontology/LNC/|LOINC;ICD-9-CM|http://purl.bioontology.org/ontology/ICD9CM/|ICD9CM;MA|http://purl.obolibrary.org/obo/|MA;RadLex|http://www.owl-ontologies.com/RADLEX.owl#|RADLEX;ICD-10-CM|http://purl.bioontology.org/ontology/ICD10CM/|ICD10CM;OBI|http://purl.obolibrary.org/obo/|OBI;PDQ|http://purl.bioontology.org/ontology/PDQ/|PDQ;NDFRT|http://purl.bioontology.org/ontology/NDFRT/|NDFRT; ; license_page_option = Display license page flag ; audio_captcha_background_noise_on = Set to false to turn off the background noise for audio captcha (default to true) ; diff --git a/software/ncitbrowser/src/java/gov/nih/nci/evs/browser/common/Constants.java b/software/ncitbrowser/src/java/gov/nih/nci/evs/browser/common/Constants.java index 825a3765e..2c40b13f7 100644 --- a/software/ncitbrowser/src/java/gov/nih/nci/evs/browser/common/Constants.java +++ b/software/ncitbrowser/src/java/gov/nih/nci/evs/browser/common/Constants.java @@ -167,7 +167,7 @@ public class Constants { public static final String NCBO_WIDGET_QUERY_STRING = "http://bioportal.bioontology.org/widgets/visualization?ontology="; //public static final String DEFAULT_NCBO_WIDGET_INFO = "NCI_Thesaurus|1032|NCIT;"; - public static final String DEFAULT_NCBO_WIDGET_INFO = "NCI_Thesaurus|NCI_Thesaurus|NCIT;"; + public static final String DEFAULT_NCBO_WIDGET_INFO = "NCI_Thesaurus|http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#|NCIT;"; public static final String[] NAV_TYPE_VALUES = {"terminologies", "mappings", "valuesets"}; diff --git a/software/ncitbrowser/src/java/gov/nih/nci/evs/browser/utils/DataUtils.java b/software/ncitbrowser/src/java/gov/nih/nci/evs/browser/utils/DataUtils.java index 7501afd84..43ff7cca4 100644 --- a/software/ncitbrowser/src/java/gov/nih/nci/evs/browser/utils/DataUtils.java +++ b/software/ncitbrowser/src/java/gov/nih/nci/evs/browser/utils/DataUtils.java @@ -355,7 +355,7 @@ public static String getDefaultOntologiesToSearchOnStr() { String value = (String) item.getValue(); /* if (value.indexOf("Metathesaurus") == -1) { - buf.append(value + "|"); + buf.append(value + "|);"); } */ if (value.indexOf("NCI_Thesaurus") != -1 || value.indexOf("NCI Thesaurus") != -1) { @@ -844,6 +844,12 @@ private static void setCodingSchemeMap() { } } _formalName2NCImSABHashMap = createFormalName2NCImSABHashMap(); + + //KLO + if (!_localName2FormalNameHashMap.containsKey(Constants.NCIT)) { + _localName2FormalNameHashMap.put(Constants.NCIT, Constants.NCIT_CS_NAME); + } + dumpHashMap(_formalName2NCImSABHashMap); setMappingDisplayNameHashMap(); @@ -6292,8 +6298,8 @@ public static HashMap getNCBOWidgetString() { public static HashMap getNCBOWidgetString() { String ncbo_widget_info = NCItBrowserProperties.getNCBO_WIDGET_INFO(); if (isNull(ncbo_widget_info)) { - System.out.println("(*) ncbo_widget_info: " + ncbo_widget_info); - System.out.println("(*) computeNCBOWidgetString ... "); + //System.out.println("(*) ncbo_widget_info: " + ncbo_widget_info); + //System.out.println("(*) computeNCBOWidgetString ... "); ncbo_widget_info = computeNCBOWidgetString(); } //System.out.println("(*) ncbo_widget_info: " + ncbo_widget_info); @@ -6378,17 +6384,34 @@ public static String getNCBOOntologyAbbreviation(String dictionary) { return (String) v.elementAt(1); } + public static String getNCBOOntologyNamespace(String dictionary) { + boolean bool = visualizationWidgetSupported(dictionary); + if (!bool) return null; + String csName = getCSName(dictionary); + String ncbo_widget_info_str = (String) _visualizationWidgetHashMap.get(csName); + if (ncbo_widget_info_str == null) return null; + Vector v = parseData(ncbo_widget_info_str); + if (v == null) return null; + return (String) v.elementAt(0); + } + + public static String createVisualizationWidgetURL(String abbreviation, String code) { - String api_key = NCItBrowserProperties.getNCBO_API_KEY(); - if (abbreviation.compareTo(Constants.NCIT) == 0) { - return NCBO_WIDGET_QUERY_STRING + abbreviation + "&class=" - + HTTPUtils.encode(Constants.NCIT_NAMESPACE + code) - + "&apikey=" + getAPIKey(); - } else { - return NCBO_WIDGET_QUERY_STRING + abbreviation + "&class=" - + HTTPUtils.encode(Constants.NCBO_PURL + abbreviation + "/" + code) - + "&apikey=" + getAPIKey(); + String api_key = getAPIKey(); + //String csName = (String) localname2CSNameMap.get(abbreviation); + String csName = getCSName(abbreviation); + String purl = getNCBOOntologyNamespace(csName); + + System.out.println("(**********) " + purl); + if (purl == null) return null; + + if (purl.contains("obo")) { + code = code.replaceAll(":", "_"); } + + return NCBO_WIDGET_QUERY_STRING + abbreviation + "&class=" + + HTTPUtils.encode(purl + code) + + "&apikey=" + getAPIKey(); } public static String getVisualizationWidgetURL(String dictionary, String code) {