Skip to content

Commit

Permalink
Version 1.6.3
Browse files Browse the repository at this point in the history
  • Loading branch information
filak committed Jan 25, 2024
1 parent 08fb75b commit 30f2364
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 47 deletions.
2 changes: 1 addition & 1 deletion flask-app/application/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def create_app(debug=False, logger=None, port=5900,
app.config.update(dict(
APPLICATION_ROOT = url_prefix,
APP_NAME = 'MTW',
APP_VER = '1.6.2',
APP_VER = '1.6.3',
API_VER = '1.0.0',
DBVERSION = 1.0,
CACHE_DIR = mtu.get_instance_dir(app, 'cache'),
Expand Down
71 changes: 39 additions & 32 deletions flask-app/application/modules/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,36 +350,37 @@ def getLookupJson(lookups, export):
d['trn'] = []
trees = item.get('trn','').split('~')
for trn in trees:
if item.get('active','') == 'false':
trn = trn.replace('[OBSOLETE]','').strip()
if 'x' not in d['cat']:
d['cat'].append('x')

d['trn'].append(trn)
cat = trn[:1].lower()
if cat not in d['cat']:
d['cat'].append(cat)
if trn:
if item.get('active','') == 'false':
trn = trn.replace('[OBSOLETE]','').strip()
if 'x' not in d['cat']:
d['cat'].append('x')

d['trn'].append(trn)
cat = trn[:1].lower()
if cat not in d['cat']:
d['cat'].append(cat)

d['xtr'] = []
#d['xtr'] = []
cui = item.get('cui')
if cui:
d['cui'] = cui
d['xtr'].append(cui)
#d['xtr'].append(cui)

nlm = item.get('nlm')
if nlm:
d['nlm'] = nlm
d['xtr'].append(nlm)
#d['xtr'].append(nlm)

rn = item.get('rn','0')
if rn != '0':
d['rn'] = rn
d['xtr'].append(rn)
#d['xtr'].append(rn)

cas = item.get('cas')
if cas:
d['cas'] = cas
d['xtr'].append(cas)
#d['xtr'].append(cas)

crt = item.get('crt')
if crt:
Expand All @@ -389,9 +390,9 @@ def getLookupJson(lookups, export):
if est:
d['est'] = est

for t in terms:
if t:
d['xtr'].append( t.replace('[OBSOLETE]','').strip() )
#for t in terms:
# if t:
# d['xtr'].append( t.replace('[OBSOLETE]','').strip() )


if export in ['marc','js_elastic']:
Expand Down Expand Up @@ -507,10 +508,13 @@ def getElasticData(data):
item['heading'].append(item['trx'])

for trn in item.get('trn',[]):
### Add later by running: grind-data elastic mesh ...
##resp.append( {'index': {'_id': trn, '_index': 'mesht'}} )
resp.append( {'id': dui, 'db': 'mesht', 'trn': trn.replace('.','-'),
'eng': item.get('eng',''), 'trx': item.get('trx',''), 'active': item.get('active')} )
if trn:
### Add later by running: grind-data elastic mesh ...
##resp.append( {'index': {'_id': trn, '_index': 'mesht'}} )
resp.append({'id': dui, 'db': 'mesht', 'trn': trn.replace('.','-'),
'eng': item.get('eng',''), 'trx': item.get('trx',''),
'active': item.get('active')}
)

### Add later by running: grind-data elastic mesh ...
##resp.append( {'index': {'_id': dui, '_index': 'mesh'}} )
Expand All @@ -528,10 +532,13 @@ def getElasticData(data):
item['heading'].append(item['trx'])

for trn in item.get('trn',[]):
### Add later by running: grind-data elastic mesh ...
##resp.append( {'index': {'_id': trn, '_index': 'mesht'}} )
resp.append( {'id': dui, 'db': 'mesht', 'trn': trn.replace('.','-'),
'eng': item.get('eng',''), 'trx': item.get('trx',''), 'active': item.get('active')} )
if trn:
### Add later by running: grind-data elastic mesh ...
##resp.append( {'index': {'_id': trn, '_index': 'mesht'}} )
resp.append({'id': dui, 'db': 'mesht', 'trn': trn.replace('.','-'),
'eng': item.get('eng',''), 'trx': item.get('trx',''),
'active': item.get('active')}
)

if qualifs.get(dui):
qa = []
Expand Down Expand Up @@ -854,8 +861,9 @@ def getMarcFields(dui, item, descriptors, qualifiers, qualifs, xnote, lp='=', cp

if treetype == 'def':
for trn in item.get('trn',[]):
trx = '$a' + fw + trn.replace('.', '.' + fw + '$x' + fw)
rows.append(lp + '072 ' + trx)
if trn:
trx = '$a' + fw + trn.replace('.', '.' + fw + '$x' + fw)
rows.append(lp + '072 ' + trx)

heading = item.get('trx', '')
if heading == '':
Expand Down Expand Up @@ -948,17 +956,16 @@ def getMarcFields(dui, item, descriptors, qualifiers, qualifs, xnote, lp='=', cp
anot = '$a' + fw + an + fw
rows.append(lp + '667 ' + anot )

scn = xnote.get('scnt')
if not scn:
scn = xnote.get('scn')
scn = xnote.get('scnt', xnote.get('scn'))
if scn:
scnf = '$i' + fw + scn + fw
rows.append(lp + '680 ' + scnf )

if treetype == 'daw':
for trn in item.get('trn',[]):
trx = '$a' + fw + trn + fw
rows.append(lp + '686 ' + trx )
if trn:
trx = '$a' + fw + trn + fw
rows.append(lp + '686 ' + trx )

hn = xnote.get('hn')
if not hn:
Expand Down
2 changes: 1 addition & 1 deletion flask-app/mtw-server.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from application.main import create_app

appname = 'mtw-server'
appdesc = 'MTW Server 1.6.2'
appdesc = 'MTW Server 1.6.3'
appusage = 'Help: ' + appname + ' -h \n'
appauthor = 'Filip Kriz'

Expand Down
24 changes: 11 additions & 13 deletions flask-app/mtw_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,39 +1,37 @@
### Version 1.6.2
### Python 3.11 ###
### Version 1.6.3
### Python 3.12 ###
arrow==1.3.0
bcrypt==4.1.1 ## NOT python-bcrypt !!!
bcrypt==4.1.2 ## NOT python-bcrypt !!!
cachelib==0.9.0 ## 0.10+ incompatible with Flask-caching 2.0.2 !
certifi==2023.11.17
cffi==1.16.0
colorama==0.4.6
diff_match_patch==20230430
Flask==3.0.0
Flask==3.0.1
Flask-Caching==2.1.0
Flask-Paranoid==0.3.0
##Flask-SeaSurf==1.1.1 ## This version is broken with Flask 3+
#Run: pip install https://github.com/maxcountryman/flask-seasurf/archive/refs/heads/main.tar.gz
##Flask-Session==0.5.0 ## This version is broken with Werkzeug 3+
#Flask-SeaSurf==1.1.1 # Broken with Flask 3+
#Run: pip install https://github.com/maxcountryman/flask-seasurf/archive/refs/heads/main.zip
#Flask-Session==0.5.0 # Broken with Flask 3+
#Run: pip install https://github.com/pallets-eco/flask-session/archive/refs/heads/main.zip
flask-talisman==1.1.0
future==0.18.3
idna==3.6
itsdangerous==2.1.2
Jinja2==3.1.3
MarkupSafe==2.1.3
pefile==2023.2.7
pip_audit==2.6.1 ## Run: pip freeze > requirements.txt ; pip-audit ; pip-audit -r mtw_requirements.txt
MarkupSafe==2.1.4
pip_audit==2.7.0 ## Run: pip freeze > requirements.txt ; pip-audit ; pip-audit -r mtw_requirements.txt
pyuca==1.2
requests==2.31.0
requests_futures==1.0.1
setuptools==69.0.2
setuptools==69.0.3
urllib3==1.26.18
### (optional) If deploying with Waitress (https://github.com/Pylons/waitress):
waitress==2.1.2
Werkzeug==3.0.1
wheel==0.42.0
### (optional) If building for Windows:
pyinstaller==6.3.0
pyinstaller-hooks-contrib==2023.10
pyinstaller-hooks-contrib==2024.0
## Install pywin32
pywin32==306
## and run AS Admin (!):
Expand Down

0 comments on commit 30f2364

Please sign in to comment.