diff --git a/COPYRIGHT.md b/COPYRIGHT.md index f7e63505..d60a76a2 100644 --- a/COPYRIGHT.md +++ b/COPYRIGHT.md @@ -1,42 +1,31 @@ -# BVS-InfoButton licenses - -BVS-InfoButton © Pan American Health Organization, 2018. - -BVS-InfoButton software is licensed under the terms available at https://github.com/bireme/BVS-InfoButton/blob/master/LICENSE.txt - -Follows a list of the Open Source Softwares and their respective applicable Open Source licenses and copyright notices. - -Observation: Information may be subject to alteration. +# bvs-infobutton-licenses Category | License | Dependency | Notes --- | --- | --- | --- -Apache | [Apache 2](http://www.apache.org/licenses/LICENSE-2.0.txt) | joda-time # joda-time # 2.9.9 | -Apache | [Apache 2](http://www.apache.org/licenses/LICENSE-2.0.txt) | org.apache.lucene # lucene-analyzers-common # 7.5.0 | -Apache | [Apache 2](http://www.apache.org/licenses/LICENSE-2.0.txt) | org.apache.lucene # lucene-backward-codecs # 7.5.0 | -Apache | [Apache 2](http://www.apache.org/licenses/LICENSE-2.0.txt) | org.apache.lucene # lucene-core # 7.5.0 | -Apache | [Apache 2](http://www.apache.org/licenses/LICENSE-2.0.txt) | org.apache.lucene # lucene-queries # 7.5.0 | -Apache | [Apache 2](http://www.apache.org/licenses/LICENSE-2.0.txt) | org.apache.lucene # lucene-queryparser # 7.5.0 | -Apache | [Apache 2](http://www.apache.org/licenses/LICENSE-2.0.txt) | org.apache.lucene # lucene-sandbox # 7.5.0 | +Apache | [Apache 2](https://www.apache.org/licenses/LICENSE-2.0.txt) | joda-time # joda-time # 2.10.1 | +Apache | [Apache 2](http://www.apache.org/licenses/LICENSE-2.0.txt) | org.apache.lucene # lucene-analyzers-common # 8.0.0 | +Apache | [Apache 2](http://www.apache.org/licenses/LICENSE-2.0.txt) | org.apache.lucene # lucene-backward-codecs # 8.0.0 | +Apache | [Apache 2](http://www.apache.org/licenses/LICENSE-2.0.txt) | org.apache.lucene # lucene-core # 8.0.0 | +Apache | [Apache 2](http://www.apache.org/licenses/LICENSE-2.0.txt) | org.apache.lucene # lucene-queries # 8.0.0 | +Apache | [Apache 2](http://www.apache.org/licenses/LICENSE-2.0.txt) | org.apache.lucene # lucene-queryparser # 8.0.0 | +Apache | [Apache 2](http://www.apache.org/licenses/LICENSE-2.0.txt) | org.apache.lucene # lucene-sandbox # 8.0.0 | +Apache | [Apache 2](http://www.apache.org/licenses/LICENSE-2.0) | org.scalaj # scalaj-http_2.12 # 2.4.1 | Apache | [Apache 2](http://www.apache.org/licenses/LICENSE-2.0.txt) | org.typelevel # macro-compat_2.12 # 1.1.1 | -Apache | [Apache 2.0 License](http://www.apache.org/licenses/LICENSE-2.0.html) | com.typesafe.scala-logging # scala-logging_2.12 # 3.9.0 | -Apache | [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt) | commons-codec # commons-codec # 1.10 | -Apache | [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt) | org.apache.httpcomponents # httpclient # 4.5.6 | -Apache | [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt) | org.apache.httpcomponents # httpcore # 4.4.10 | -Apache | [Apache-2.0](https://opensource.org/licenses/Apache-2.0) | com.typesafe.akka # akka-http-core_2.12 # 10.1.5 | -Apache | [Apache-2.0](https://opensource.org/licenses/Apache-2.0) | com.typesafe.akka # akka-http_2.12 # 10.1.5 | -Apache | [Apache-2.0](https://opensource.org/licenses/Apache-2.0) | com.typesafe.akka # akka-parsing_2.12 # 10.1.5 | -Apache | [Apache-2.0](http://www.apache.org/licenses/LICENSE-2.0.html) | com.typesafe.play # play-functional_2.12 # 2.6.10 | -Apache | [Apache-2.0](http://www.apache.org/licenses/LICENSE-2.0.html) | com.typesafe.play # play-json_2.12 # 2.6.10 | -Apache | [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt) | com.fasterxml.jackson.core # jackson-annotations # 2.8.11 | -Apache | [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt) | com.fasterxml.jackson.core # jackson-core # 2.8.11 | -Apache | [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt) | com.fasterxml.jackson.core # jackson-databind # 2.8.11.1 | -Apache | [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt) | com.fasterxml.jackson.datatype # jackson-datatype-jdk8 # 2.8.11 | -Apache | [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt) | com.fasterxml.jackson.datatype # jackson-datatype-jsr310 # 2.8.11 | -Apache | [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt) | commons-logging # commons-logging # 1.2 | -Apache | [the Apache License, ASL Version 2.0](http://www.apache.org/licenses/LICENSE-2.0) | org.scalactic # scalactic_2.12 # 3.0.5 | -Apache | [the Apache License, ASL Version 2.0](http://www.apache.org/licenses/LICENSE-2.0) | org.scalatest # scalatest_2.12 # 3.0.5 | -BSD | [BSD 3-Clause](http://www.scala-lang.org/license.html) | org.scala-lang # scala-library # 2.12.7 | -BSD | [BSD 3-Clause](http://www.scala-lang.org/license.html) | org.scala-lang # scala-reflect # 2.12.7 | +Apache | [Apache 2.0 License](http://www.apache.org/licenses/LICENSE-2.0.html) | com.typesafe.scala-logging # scala-logging_2.12 # 3.9.2 | +Apache | [Apache-2.0](https://opensource.org/licenses/Apache-2.0) | com.typesafe.akka # akka-http-core_2.12 # 10.1.7 | +Apache | [Apache-2.0](https://opensource.org/licenses/Apache-2.0) | com.typesafe.akka # akka-http_2.12 # 10.1.7 | +Apache | [Apache-2.0](https://opensource.org/licenses/Apache-2.0) | com.typesafe.akka # akka-parsing_2.12 # 10.1.7 | +Apache | [Apache-2.0](http://www.apache.org/licenses/LICENSE-2.0.html) | com.typesafe.play # play-functional_2.12 # 2.7.2 | +Apache | [Apache-2.0](http://www.apache.org/licenses/LICENSE-2.0.html) | com.typesafe.play # play-json_2.12 # 2.7.2 | +Apache | [Apache-2.0](https://www.apache.org/licenses/LICENSE-2.0) | org.scala-lang # scala-library # 2.12.8 | +Apache | [Apache-2.0](https://www.apache.org/licenses/LICENSE-2.0) | org.scala-lang # scala-reflect # 2.12.8 | +Apache | [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt) | com.fasterxml.jackson.core # jackson-annotations # 2.9.8 | +Apache | [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt) | com.fasterxml.jackson.core # jackson-core # 2.9.8 | +Apache | [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt) | com.fasterxml.jackson.core # jackson-databind # 2.9.8 | +Apache | [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt) | com.fasterxml.jackson.datatype # jackson-datatype-jdk8 # 2.9.8 | +Apache | [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt) | com.fasterxml.jackson.datatype # jackson-datatype-jsr310 # 2.9.8 | +Apache | [the Apache License, ASL Version 2.0](http://www.apache.org/licenses/LICENSE-2.0) | org.scalactic # scalactic_2.12 # 3.0.7 | +Apache | [the Apache License, ASL Version 2.0](http://www.apache.org/licenses/LICENSE-2.0) | org.scalatest # scalatest_2.12 # 3.0.7 | BSD | [BSD 3-clause](http://opensource.org/licenses/BSD-3-Clause) | org.scala-lang.modules # scala-xml_2.12 # 1.1.1 | BSD | [BSD 3-clause New License](https://github.com/dom4j/dom4j/blob/master/LICENSE) | org.dom4j # dom4j # 2.1.1 | LGPL | [GNU Lesser General Public License](http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html) | ch.qos.logback # logback-classic # 1.2.3 | diff --git a/LICENSE.txt b/LICENSE.txt old mode 100755 new mode 100644 diff --git a/build.sbt b/build.sbt index 5b71ae1c..c864f381 100755 --- a/build.sbt +++ b/build.sbt @@ -19,7 +19,7 @@ val logbackVersion = "1.2.3" val scalaTestVersion = "3.0.7" // "3.0.5" val hairyfotrVersion = "0.1.17" val luceneVersion = "8.0.0" // "7.5.0" -val httpComponentsVersion = "4.5.7" //"4.5.6" +val scalajHttpVersion = "2.4.1" libraryDependencies ++= Seq( "com.typesafe.akka" %% "akka-http" % akkaVersion, @@ -36,7 +36,7 @@ libraryDependencies ++= Seq( "org.apache.lucene" % "lucene-queryparser" % luceneVersion, "org.apache.lucene" % "lucene-queries" % luceneVersion, "org.apache.lucene" % "lucene-backward-codecs" % luceneVersion, - "org.apache.httpcomponents" % "httpclient" % httpComponentsVersion + "org.scalaj" %% "scalaj-http" % scalajHttpVersion ) logBuffered in Test := false diff --git a/src/main/scala/org/bireme/infob/InfoServer.scala b/src/main/scala/org/bireme/infob/InfoServer.scala index 5df26569..6157317e 100644 --- a/src/main/scala/org/bireme/infob/InfoServer.scala +++ b/src/main/scala/org/bireme/infob/InfoServer.scala @@ -8,20 +8,14 @@ package org.bireme.infob import java.net.{URL, URLDecoder, URLEncoder} -import java.nio.charset.Charset import ch.qos.logback.classic.{Level, Logger => xLogger} import com.typesafe.scalalogging.Logger -import org.apache.http.HttpEntity -import org.apache.http.client.entity.UrlEncodedFormEntity -import org.apache.http.client.methods.HttpPost -import org.apache.http.impl.client.HttpClients -import org.apache.http.message.BasicNameValuePair -import org.apache.http.util.EntityUtils import org.bireme.infob.parameters._ import org.dom4j.Element import org.slf4j.LoggerFactory import play.api.libs.json._ +import scalaj.http.{Http, HttpResponse} import scala.collection.JavaConverters._ import scala.reflect._ @@ -292,34 +286,16 @@ class InfoServer( * error occurred */ private def post(params: Seq[(String, String)]): Either[String, String] = { -//println(s"post: params=$params") - val paramSeq: Seq[BasicNameValuePair] = params.map(elem => new BasicNameValuePair(elem._1, elem._2)) - val httpclient = HttpClients.createDefault() - val httpPost = new HttpPost(iahxUrl) - httpPost.addHeader("Accept-Charset", "UTF-8") - httpPost.addHeader("Accept", "application/json") - httpPost.setEntity(new UrlEncodedFormEntity(paramSeq.asJava, Charset.forName("utf-8"))) -//println(s"httpPost=$httpPost") - val response = httpclient.execute(httpPost) - val statusLine = response.getStatusLine -//println("status Code=" + statusLine.getStatusCode) - if (statusLine.getStatusCode == 200) { -//println(s"response=$response") - try { - val entity: HttpEntity = response.getEntity - val content: String = EntityUtils.toString(entity) - //println(s"content=$content entity=$entity") - response.close() + //println(s"post: params=$params") + + val response: HttpResponse[String] = Http(iahxUrl) + .headers(Seq("Accept-Charset" ->"UTF-8", "Accept" -> "application/json")).postForm(params).asString + + if (response.code == 200) { + val content: String = response.body Right(content) - } catch { - case ex: Throwable => - //println("Throwable=${ex.toString}") - response.close() - Left(ex.toString) - } } else { - val reason: String = statusLine.getReasonPhrase - Left(if (reason.isEmpty) s"errCode:${statusLine.getStatusCode}" else reason) + Left(s"errCode:${response.code}") } } @@ -487,7 +463,7 @@ object InfoServer extends App { ".administrativeGenderCode.c=M&age.v.v=45&age.v.u=a&informationRecipient" + "=PAT&performer=PROV&performer.languageCode.c=en&performer.healthCarePro" + "vider.c.c=163W00000X&knowledgeResponseType=application/json"*/ - "http://bvsinfobutton.homolog.bvsalud.org/infobutton/search?mainSearchCriteria.v.ot=zika virus&knowledgeResponseType=text/xml&knowledgeResponseType=text/xml&explain=true" + "http://bvsinfobutton.homolog.bvsalud.org/infobutton/search?mainSearchCriteria.v.ot=zika virus&subTopic.v.c=79899007&subTopic.v.cs=2.16.840.1.113883.6.96&knowledgeResponseType=text/xml&explain=true" } else { args(0) } diff --git a/src/main/scala/org/bireme/infob/parameters/MainSearchCriteria.scala b/src/main/scala/org/bireme/infob/parameters/MainSearchCriteria.scala index 39078568..ef11122d 100644 --- a/src/main/scala/org/bireme/infob/parameters/MainSearchCriteria.scala +++ b/src/main/scala/org/bireme/infob/parameters/MainSearchCriteria.scala @@ -55,13 +55,12 @@ class MainSearchCriteria(conv: MeshConverter, //println(s"strOriginalText=$strOriginalText strOriginalTextStatus=$strOriginalTextStatus") override def toSrcExpression(env: Seq[SearchParameter]): Option[String] = { - val circ = "ˆ" val ret = code match { case Some(_) => strCodeStatus match { case "exact" => val code2: String = codeSet.head.toLowerCase - Some("(mh:\"" + code2 + circ + "2\" OR ti:\"" + code2 + circ + "1\")") + Some("(mh:\"" + code2 + "\"^2 OR ti:\"" + code2 + "\"^1)") // "\" OR ab:\"" + code2 + "\")") case "synonym" => Some("(" + andOrExpression("mh", codeSet, 2) + " OR " + @@ -147,9 +146,7 @@ class MainSearchCriteria(conv: MeshConverter, } } - val circ = "ˆ" - val words2 = if (boost == 1) words.map(word => s"$index:$word") - else words.map(word => s"$index:$word$circ$boost") + val words2 = words.map(word => s"$index:$word^$boost") val words3 = if (words2.size > 5) { words2.mkString(" OR ") diff --git a/src/main/scala/org/bireme/infob/parameters/SubTopic.scala b/src/main/scala/org/bireme/infob/parameters/SubTopic.scala index 9750e4e0..37ce3695 100644 --- a/src/main/scala/org/bireme/infob/parameters/SubTopic.scala +++ b/src/main/scala/org/bireme/infob/parameters/SubTopic.scala @@ -29,9 +29,9 @@ class SubTopic( ) override def toSrcExpression(env: Seq[SearchParameter]): Option[String] = { - val codeSrcExpr: Option[String] = code.flatMap(x => getSrcExpr(x)) - lazy val dplNameSrcExpr = displayName.flatMap(x => getSrcExpr(x)) - lazy val oTextSrcExpr = originalText.flatMap(x => getSrcExpr(x)) + val codeSrcExpr: Option[String] = code.flatMap(getSrcExpr) + lazy val dplNameSrcExpr = displayName.flatMap(getSrcExpr) + lazy val oTextSrcExpr = originalText.flatMap(getSrcExpr) codeSrcExpr orElse dplNameSrcExpr orElse oTextSrcExpr } @@ -52,8 +52,9 @@ class SubTopic( } }.map { case (qual, expr) => - val index = if (qual) "sh" else "mh" - s"($index:${'"'}$expr${'"'} OR ti:${'"'}$expr${'"'} OR ab:${'"'}$expr${'"'})" + val index = if (qual) "sh" else "mh" // sh - sub headings. mh - mesh headings + s"($index:${'"'}$expr${'"'} OR ti:${'"'}$expr${'"'})" + + s" OR ab:${'"'}$expr${'"'})" } } @@ -63,7 +64,7 @@ class SubTopic( Category("subTopic.v.cs", codeSystem.get), Category("subTopic.v.dn", displayName.getOrElse("")), Category("subTopic.v.ot", originalText.getOrElse("")) - ).filter(!_.term.isEmpty) + ).filter(_.term.nonEmpty) } override def toString: String = diff --git a/web/BVSInfoButton/build/web/WEB-INF/classes/org/bireme/binfo/BVSInfoButton.class b/web/BVSInfoButton/build/web/WEB-INF/classes/org/bireme/binfo/BVSInfoButton.class index 36a32b51..181c3c37 100644 Binary files a/web/BVSInfoButton/build/web/WEB-INF/classes/org/bireme/binfo/BVSInfoButton.class and b/web/BVSInfoButton/build/web/WEB-INF/classes/org/bireme/binfo/BVSInfoButton.class differ diff --git a/web/BVSInfoButton/build/web/WEB-INF/lib/BVS-InfoButton-assembly-1.0.0.jar b/web/BVSInfoButton/build/web/WEB-INF/lib/BVS-InfoButton-assembly-1.0.0.jar index 6c9ff94b..8113fa29 100644 Binary files a/web/BVSInfoButton/build/web/WEB-INF/lib/BVS-InfoButton-assembly-1.0.0.jar and b/web/BVSInfoButton/build/web/WEB-INF/lib/BVS-InfoButton-assembly-1.0.0.jar differ diff --git a/web/BVSInfoButton/build/web/index.html b/web/BVSInfoButton/build/web/index.html index bf05bd23..4d469cec 100644 --- a/web/BVSInfoButton/build/web/index.html +++ b/web/BVSInfoButton/build/web/index.html @@ -310,7 +310,7 @@

BVS - Infobutton (version 1.0.0)

- + diff --git a/web/BVSInfoButton/dist/BVSInfoButton.war b/web/BVSInfoButton/dist/BVSInfoButton.war index 6af3dca5..78b097fe 100644 Binary files a/web/BVSInfoButton/dist/BVSInfoButton.war and b/web/BVSInfoButton/dist/BVSInfoButton.war differ diff --git a/web/BVSInfoButton/src/java/org/bireme/binfo/BVSInfoButton.java b/web/BVSInfoButton/src/java/org/bireme/binfo/BVSInfoButton.java index ebc6eab0..273a2e55 100755 --- a/web/BVSInfoButton/src/java/org/bireme/binfo/BVSInfoButton.java +++ b/web/BVSInfoButton/src/java/org/bireme/binfo/BVSInfoButton.java @@ -96,7 +96,7 @@ private String getRequestInfo(HttpServletRequest request, final long now = Calendar.getInstance().getTimeInMillis(); builder.append("date=" + now); - builder.append("\tremote_address==" + raddr); + builder.append("\tremote_address=" + raddr); builder.append("\treferer=" + referer); builder.append("\tdocs_found=" + total); diff --git a/web/BVSInfoButton/web/index.html b/web/BVSInfoButton/web/index.html index bf05bd23..4d469cec 100755 --- a/web/BVSInfoButton/web/index.html +++ b/web/BVSInfoButton/web/index.html @@ -310,7 +310,7 @@

BVS - Infobutton (version 1.0.0)

- +