Skip to content

Commit

Permalink
version 1.3.2 boosteting term and subTopic bug fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
heitorbarbieri committed Apr 23, 2019
1 parent d1680be commit 7dcb4e6
Show file tree
Hide file tree
Showing 12 changed files with 48 additions and 85 deletions.
59 changes: 24 additions & 35 deletions COPYRIGHT.md
Original file line number Diff line number Diff line change
@@ -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 | <notextile></notextile>
Apache | [Apache 2](http://www.apache.org/licenses/LICENSE-2.0.txt) | org.apache.lucene # lucene-analyzers-common # 7.5.0 | <notextile></notextile>
Apache | [Apache 2](http://www.apache.org/licenses/LICENSE-2.0.txt) | org.apache.lucene # lucene-backward-codecs # 7.5.0 | <notextile></notextile>
Apache | [Apache 2](http://www.apache.org/licenses/LICENSE-2.0.txt) | org.apache.lucene # lucene-core # 7.5.0 | <notextile></notextile>
Apache | [Apache 2](http://www.apache.org/licenses/LICENSE-2.0.txt) | org.apache.lucene # lucene-queries # 7.5.0 | <notextile></notextile>
Apache | [Apache 2](http://www.apache.org/licenses/LICENSE-2.0.txt) | org.apache.lucene # lucene-queryparser # 7.5.0 | <notextile></notextile>
Apache | [Apache 2](http://www.apache.org/licenses/LICENSE-2.0.txt) | org.apache.lucene # lucene-sandbox # 7.5.0 | <notextile></notextile>
Apache | [Apache 2](https://www.apache.org/licenses/LICENSE-2.0.txt) | joda-time # joda-time # 2.10.1 | <notextile></notextile>
Apache | [Apache 2](http://www.apache.org/licenses/LICENSE-2.0.txt) | org.apache.lucene # lucene-analyzers-common # 8.0.0 | <notextile></notextile>
Apache | [Apache 2](http://www.apache.org/licenses/LICENSE-2.0.txt) | org.apache.lucene # lucene-backward-codecs # 8.0.0 | <notextile></notextile>
Apache | [Apache 2](http://www.apache.org/licenses/LICENSE-2.0.txt) | org.apache.lucene # lucene-core # 8.0.0 | <notextile></notextile>
Apache | [Apache 2](http://www.apache.org/licenses/LICENSE-2.0.txt) | org.apache.lucene # lucene-queries # 8.0.0 | <notextile></notextile>
Apache | [Apache 2](http://www.apache.org/licenses/LICENSE-2.0.txt) | org.apache.lucene # lucene-queryparser # 8.0.0 | <notextile></notextile>
Apache | [Apache 2](http://www.apache.org/licenses/LICENSE-2.0.txt) | org.apache.lucene # lucene-sandbox # 8.0.0 | <notextile></notextile>
Apache | [Apache 2](http://www.apache.org/licenses/LICENSE-2.0) | org.scalaj # scalaj-http_2.12 # 2.4.1 | <notextile></notextile>
Apache | [Apache 2](http://www.apache.org/licenses/LICENSE-2.0.txt) | org.typelevel # macro-compat_2.12 # 1.1.1 | <notextile></notextile>
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 | <notextile></notextile>
Apache | [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt) | commons-codec # commons-codec # 1.10 | <notextile></notextile>
Apache | [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt) | org.apache.httpcomponents # httpclient # 4.5.6 | <notextile></notextile>
Apache | [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt) | org.apache.httpcomponents # httpcore # 4.4.10 | <notextile></notextile>
Apache | [Apache-2.0](https://opensource.org/licenses/Apache-2.0) | com.typesafe.akka # akka-http-core_2.12 # 10.1.5 | <notextile></notextile>
Apache | [Apache-2.0](https://opensource.org/licenses/Apache-2.0) | com.typesafe.akka # akka-http_2.12 # 10.1.5 | <notextile></notextile>
Apache | [Apache-2.0](https://opensource.org/licenses/Apache-2.0) | com.typesafe.akka # akka-parsing_2.12 # 10.1.5 | <notextile></notextile>
Apache | [Apache-2.0](http://www.apache.org/licenses/LICENSE-2.0.html) | com.typesafe.play # play-functional_2.12 # 2.6.10 | <notextile></notextile>
Apache | [Apache-2.0](http://www.apache.org/licenses/LICENSE-2.0.html) | com.typesafe.play # play-json_2.12 # 2.6.10 | <notextile></notextile>
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 | <notextile></notextile>
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 | <notextile></notextile>
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 | <notextile></notextile>
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 | <notextile></notextile>
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 | <notextile></notextile>
Apache | [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt) | commons-logging # commons-logging # 1.2 | <notextile></notextile>
Apache | [the Apache License, ASL Version 2.0](http://www.apache.org/licenses/LICENSE-2.0) | org.scalactic # scalactic_2.12 # 3.0.5 | <notextile></notextile>
Apache | [the Apache License, ASL Version 2.0](http://www.apache.org/licenses/LICENSE-2.0) | org.scalatest # scalatest_2.12 # 3.0.5 | <notextile></notextile>
BSD | [BSD 3-Clause](http://www.scala-lang.org/license.html) | org.scala-lang # scala-library # 2.12.7 | <notextile></notextile>
BSD | [BSD 3-Clause](http://www.scala-lang.org/license.html) | org.scala-lang # scala-reflect # 2.12.7 | <notextile></notextile>
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 | <notextile></notextile>
Apache | [Apache-2.0](https://opensource.org/licenses/Apache-2.0) | com.typesafe.akka # akka-http-core_2.12 # 10.1.7 | <notextile></notextile>
Apache | [Apache-2.0](https://opensource.org/licenses/Apache-2.0) | com.typesafe.akka # akka-http_2.12 # 10.1.7 | <notextile></notextile>
Apache | [Apache-2.0](https://opensource.org/licenses/Apache-2.0) | com.typesafe.akka # akka-parsing_2.12 # 10.1.7 | <notextile></notextile>
Apache | [Apache-2.0](http://www.apache.org/licenses/LICENSE-2.0.html) | com.typesafe.play # play-functional_2.12 # 2.7.2 | <notextile></notextile>
Apache | [Apache-2.0](http://www.apache.org/licenses/LICENSE-2.0.html) | com.typesafe.play # play-json_2.12 # 2.7.2 | <notextile></notextile>
Apache | [Apache-2.0](https://www.apache.org/licenses/LICENSE-2.0) | org.scala-lang # scala-library # 2.12.8 | <notextile></notextile>
Apache | [Apache-2.0](https://www.apache.org/licenses/LICENSE-2.0) | org.scala-lang # scala-reflect # 2.12.8 | <notextile></notextile>
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 | <notextile></notextile>
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 | <notextile></notextile>
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 | <notextile></notextile>
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 | <notextile></notextile>
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 | <notextile></notextile>
Apache | [the Apache License, ASL Version 2.0](http://www.apache.org/licenses/LICENSE-2.0) | org.scalactic # scalactic_2.12 # 3.0.7 | <notextile></notextile>
Apache | [the Apache License, ASL Version 2.0](http://www.apache.org/licenses/LICENSE-2.0) | org.scalatest # scalatest_2.12 # 3.0.7 | <notextile></notextile>
BSD | [BSD 3-clause](http://opensource.org/licenses/BSD-3-Clause) | org.scala-lang.modules # scala-xml_2.12 # 1.1.1 | <notextile></notextile>
BSD | [BSD 3-clause New License](https://github.com/dom4j/dom4j/blob/master/LICENSE) | org.dom4j # dom4j # 2.1.1 | <notextile></notextile>
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 | <notextile></notextile>
Expand Down
Empty file modified LICENSE.txt
100755 → 100644
Empty file.
4 changes: 2 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand Down
44 changes: 10 additions & 34 deletions src/main/scala/org/bireme/infob/InfoServer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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._
Expand Down Expand Up @@ -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}")
}
}

Expand Down Expand Up @@ -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)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,12 @@ class MainSearchCriteria(conv: MeshConverter,
//println(s"strOriginalText=$strOriginalText strOriginalTextStatus=$strOriginalTextStatus")

override def toSrcExpression(env: Seq[SearchParameter]): Option[String] = {
val circ = "&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 " +
Expand Down Expand Up @@ -147,9 +146,7 @@ class MainSearchCriteria(conv: MeshConverter,
}
}

val circ = "&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 ")
Expand Down
13 changes: 7 additions & 6 deletions src/main/scala/org/bireme/infob/parameters/SubTopic.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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${'"'})"
}
}

Expand All @@ -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 =
Expand Down
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion web/BVSInfoButton/build/web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ <h1>BVS - Infobutton (version 1.0.0)</h1>
<option value="Q000633">Q000633 - toxicity (MeSH)</option>
<option value="Q000506">Q000506 - poisoning (MeSH)</option>

<option value="79899007">79899007 - Drug Interactions (SNOMED_CT)</option>
<option value="79899007">79899007 - Drug Interaction (SNOMED_CT)</option>
<option value="47965005">47965005 - Diagnosis, Differential (SNOMED_CT)</option>
<option value="404204005">404204005 - Drug interaction with drug (SNOMED_CT)</option>
<option value="95907004">95907004 - Drug interaction with food (SNOMED_CT)</option>
Expand Down
Binary file modified web/BVSInfoButton/dist/BVSInfoButton.war
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion web/BVSInfoButton/web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ <h1>BVS - Infobutton (version 1.0.0)</h1>
<option value="Q000633">Q000633 - toxicity (MeSH)</option>
<option value="Q000506">Q000506 - poisoning (MeSH)</option>

<option value="79899007">79899007 - Drug Interactions (SNOMED_CT)</option>
<option value="79899007">79899007 - Drug Interaction (SNOMED_CT)</option>
<option value="47965005">47965005 - Diagnosis, Differential (SNOMED_CT)</option>
<option value="404204005">404204005 - Drug interaction with drug (SNOMED_CT)</option>
<option value="95907004">95907004 - Drug interaction with food (SNOMED_CT)</option>
Expand Down

0 comments on commit 7dcb4e6

Please sign in to comment.