Code Monkey home page Code Monkey logo

mtw-mesh's Introduction

MTW-MeSH

Medical Subject Headings Translation Workflow

Please see the Wiki for details of this project.

Codacy status

Codacy Badge

mtw-mesh's People

Contributors

dependabot[bot] avatar filak avatar julienbacquart avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

julienbacquart

mtw-mesh's Issues

Exports - JSON for Elastic - fix query to include missing items

Query template to fix:

lookups_use_instead

Ie.
https://id.nlm.nih.gov/mesh/D001769Q000201.html
https://id.nlm.nih.gov/mesh/D004798Q000097.html

Test query:

PREFIX rdf:  <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
PREFIX owl:  <http://www.w3.org/2002/07/owl#>
PREFIX meshv:  <http://id.nlm.nih.gov/mesh/vocab#>
PREFIX mesh:   <http://id.nlm.nih.gov/mesh/>
PREFIX text:   <http://jena.apache.org/text#>
PREFIX meshx:  <http://mesh.medvik.cz/link/>
PREFIX mesht:  <http://www.medvik.cz/schema/mesh/vocab/#>

#SELECT ?dui (GROUP_CONCAT(DISTINCT ?o ; separator='|') AS ?qn)
SELECT *
WHERE {
  BIND(mesh:D001769 as ?d)
  ?dq meshv:hasDescriptor ?d .
  #?dq meshv:active ?active .
  #FILTER(?active)
  ?d meshv:identifier ?dui .
  ?dq meshv:useInstead ?ud .
  #?dq meshv:hasQualifier ?q .
  #?q meshv:identifier ?qui .
  #?ud meshv:identifier ?udui .
  #BIND( CONCAT(STR(?qui), '~', STR(?udui)) AS ?o)
}
#GROUP BY ?dui
LIMIT 100

Checking for duplicate terms in translation data when updating concept

Store all the trx terms in a db table

/* terms */
--drop table if exists terms;
create table audit (
  id integer primary key autoincrement,
  dui text not null,   -- DescriptorUI | QualifierUI
  cui text not null,   -- ConceptUI
  term text not null, 
  created text DEFAULT (strftime('%Y-%m-%dT%H:%M:%S','now', 'localtime'))
);

Analyze how to:

  1. populate the table initially
  2. check terms for duplicates before concept update
  3. insert rows for new terms
  4. update when deleting terms

If duplicate is found issue a danger alert - including created + dui + link .../search/dui:

Implement caching using Memcached

pymemcache==3.5.2

Ie.

    if app.config.get('CACHE_TYPE') == 'MemcachedCache':
        memhost = app.config.get('CACHE_MEMCACHED_SERVERS',['127.0.0.1:11211'])[0]
        try:
            memclient = PMClient(memhost, ignore_exc=True, connect_timeout=3, timeout=3)
            memclient.set('test_alive_key', 'ALIVE')
        except:
            err = '\n\nMemcached instance NOT running ! ' + str(memhost) + ' \n'
            app.logger.error(err)
            warn = '\n\nSetting CACHE_TYPE to Flask-Caching : FileSystemCache \n'
            app.logger.warning(warn)
            app.config.update({"CACHE_TYPE": "FileSystemCache"})
            CACHE_DIR = mtu.get_instance_dir(app, app.config.get('CACHE_DIR','cache_fs'))
            app.config.update({'CACHE_DIR': CACHE_DIR})

Better relevancy while searching

Try to use propLists

https://jena.apache.org/documentation/query/text-query.html#lists-of-indexed-properties

text:propLists (
    [ text:propListProp mesht:defQuery ;
      text:props ( 
         rdfs:label
         meshv:identifier 
         meshv:prefLabel
         meshv:altLabel
         meshv:casn1_label
         meshv:registryNumber
         meshv:relatedRegistryNumber
             mesht:identifier 
             mesht:prefLabel
             mesht:altLabel
             mesht:casn1_label
          ) ;
    ]
    [ text:propListProp mesht:includeNotes ;
      text:props ( 
         rdfs:label
         meshv:identifier 
         meshv:prefLabel
         meshv:altLabel
         meshv:casn1_label
         meshv:registryNumber
         meshv:relatedRegistryNumber
             mesht:identifier 
             mesht:prefLabel
             mesht:altLabel
             mesht:casn1_label
                mesht:translatorsNote
                mesht:annotation
                mesht:historyNote
                mesht:scopeNote
          meshv:annotation
          meshv:historyNote
          meshv:note
          meshv:onlineNote
          meshv:publicMeSHNote
          meshv:scopeNote
         ) ;
    ]
) ;

Add filter - checkbox - to the form (searchForm)

  • includeNotes
{% set prop_list = 'mesht:defQuery' %}
{% if includeNotes == 'yes' %}
    {% set prop_list = 'mesht:includeNotes' %}
{% endif %}

  {% if slang == 'target' %}
    (?s ?score) text:query ({{ prop_list }} "{{ query }}" 500 "lang:{{ lang }}") .
  {% elif slang == 'source' %}
    (?s ?score) text:query ({{ prop_list }} "{{ query }}" 500 "lang:en") .
  {% else %}
    (?s ?score) text:query ({{ prop_list }} "{{ query }}" 500) .
  {% endif %}
...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.