[ca4dac]: / makefile

Download this file

90 lines (74 with data), 2.4 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
## makefile automates the build and deployment for python projects
## Build system
#
PROJ_TYPE = python
PROJ_MODULES = git python-resources python-cli python-doc python-doc-deploy markdown
PY_DEP_POST_DEPS += modeldeps
PY_CLI_ARGS += --config test-resources/config/default.conf
ADD_CLEAN += medcat.log
CLEAN_DEPS += pycleancache cleanexample
## Project
#
ENTRY_BIN = ./mednlp
TEST_SENT = "John Smith was diagnosed with liver disease while in Chicago."
## Includes
#
include ./zenbuild/main.mk
## Targets
#
# install models and their dependencies instead of letting the app do it
.PHONY: modeldeps
modeldeps:
$(PIP_BIN) install $(PIP_ARGS) -r \
resources/requirements/model.txt --no-deps
# try to reinstall the `nmslib` python package
.PHONY: reinstallnmslib
reinstallnmslib:
@echo "reinstall no binary nmslib for speed and warnings"
pip uninstall -y nmslib || true
pip install --no-binary :all: nmslib
# test scispacy entity link db
.PHONY: testentlink
testentlink:
make PY_SRC_TEST=test/entlink test
# test parsing
.PHONY: testparse
testparse:
@$(ENTRY_BIN) show $(PY_CLI_ARGS) $(TEST_SENT) | \
diff - test-resources/integration/parse.txt || \
exit 1
# not CUIs/results are after defaulting to notebook only MedCAT model
.PHONY: testfeatures
testfeatures:
@$(ENTRY_BIN) features $(PY_CLI_ARGS) \
--ids pref_name_,loc --medonly $(TEST_SENT) | \
diff - test-resources/integration/features.csv || \
exit 1
# test CTS (UMLS terminology service)
.PHONY: testclinicaltuis
testclinicaltuis:
@$(ENTRY_BIN) group byname $(PY_CLI_ARGS) -q \
Anatomy,Devices,Disorders,Drugs,Genes,Living,Objects,Occupations,Phenomena,Physiology,Procedures | \
diff - test-resources/integration/tuis.txt || \
exit 1
# integration tests
.PHONY: testint
testint:
@example/features/features.py show | \
diff - test-resources/integration/ex-features.txt || \
exit 1
@example/cui2vec/cui2vec.py similarity -t heart 2>&1 | \
grep -v RuntimeWarning | \
grep -v 'dists = dot' | \
diff - test-resources/integration/cui2vec.txt || \
exit 1
@example/uts/uts.py | \
diff - test-resources/integration/uts.txt || \
exit 1
# unit and integration tests
.PHONY: testall
testall: test testentlink testparse testfeatures testclinicaltuis testint
# remove cached files created by the examples
.PHONY: cleanexample
cleanexample:
rm -fr example/cache