File size: 4,535 Bytes
cb8c7c9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
import os
PRODUCTION = False
if PRODUCTION:
    prepath = "/Users/vkocaman/cache_pretrained/"
    path = "/Users/vkocaman/cache_pretrained/2.4/"
    jar_path = "/home/ubuntu/jars/"
    input_folder = '/home/ubuntu/streamlit/dia/resources/'
    rules_folder = '/home/ubuntu/streamlit/dia/resources/rules/'
else:
    project_path = "F:/JSL/streamlit-demo-apps/"

    prepath = "file:///E://JSL/SparkNLPSUITE/models/cache_pretrained/"
    path = "file:///E://JSL/SparkNLPSUITE/models/cache_pretrained/2.4/"
    jar_path = "file:///E:/JSL/Jars/streamlit4/"
    rules_folder = "file:///E://JSL/SparkNLPSUITE/streamlit-demo-apps/resources/rules/"
    models_folder = "file:///E://JSL/SparkNLPSUITE/models/"

ENTITIES_FOR_ICD10 = ['problem', 'diagnosis', 'procedure name', 'lab name', 'symptom_name', 'procedure_name', 'procedure', 'lab_name', 'pathological_formation', 'cancer']
LOGO_PATH = '../resources/jsl-logo.png'
available_models = []

#APP STYLE
MAX_WIDTH = 1600
PADDING_TOP = 0.25
PADDING_BOTTOM = 0.25
PADDING_RIGHT = 4
PADDING_LEFT = 4
COLOR = 'black'
BACKGROUND_COLOR = 'white'

HTML_WRAPPER = """<div class="scroll entities" style="overflow-x: auto; border: 1px solid #e6e9ef; border-radius: 0.25rem; padding: 0.25rem; margin-bottom: 2.5rem; white-space:pre-wrap">{}</div>"""
HTML_INDEX_WRAPPER = """<div ">{}</div>"""

STYLE_CONFIG_OLD = f"""
<style>
    @import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700&display=swap');
    *:not(text){{
      font-family: Montserrat;
    }}

    .reportview-container .main .block-container{{
        max-width: {MAX_WIDTH}px;
        padding-top: {PADDING_TOP}rem;
        padding-right: {PADDING_RIGHT}rem;
        padding-left: {PADDING_LEFT}rem;
        padding-bottom: {PADDING_BOTTOM}rem;
    }}
    .reportview-container .main {{
        color: {COLOR};
        background-color: {BACKGROUND_COLOR};
    }}
    div.scroll {{
                margin:1px, 1px;
                padding:1px;
                width: 100%;
                height: 500px;
                overflow-x: hidden;
                overflow-x: auto;
    }}
    .entity-wrapper{{
        padding: 1px;
        display: inline-grid;
        text-align:center;
        margin-bottom:1px;
        border-radius: 5px 5px
    }}
    .entity-name{{
        background: #f1f2f3;
        color: #3c3e44;
        padding: 1px;
        border-color: #484b51;
        border-width: medium;
        border-radius: 5px 5px;
    }}
    .entity-type{{
        color: #272727;
        text-transform: uppercase;
        font-family: roboto;
        font-size: 13px;
    }}
    .reportview-container .markdown-text-container{{
        font-family: roboto !important;
        color: dimgray !important;
        line-height: normal !important;
    }}
    .reportview-container h2
    {{
        font-weight: 400 !important;
        font-size: 1.5rem !important;
        line-height: 1.6!important;
    }}
    .reportview-container h2
    {{
        font-weight: 300 !important;
        font-size: 1.3rem !important;
        line-height: 1.4!important;
    }}


</style>
"""

with open('./utils/style.css') as f:
    STYLE_CONFIG_NEW = f.read()
STYLE_CONFIG = STYLE_CONFIG_OLD + '<style>{}</style>'.format(STYLE_CONFIG_NEW)

LABEL_COLORS = {'problem':'#0C8888',
               'test':'#FF33C1',
               'treatment':'#3196D4',
                'multi':'#ccfff5',
                'multi-tissue_structure':'#8dd8b4',
                'cell':'#ffe6cc',
                'organism':'#ffddcc',
                'gene_or_gene_product':'#fff0b3',
                'organ':'#e6e600',
                'simple_chemical':'#ffd699',

                'per':'#0C8888', 'pers':'#0C8888','person':'#0C8888',
                'org':'#FF33C1',
                'misc': '#3196D4', 'mis': '#3196D4',
                'loc':'#5B00A3', 'location':'#5B00A3',


                'drug':'#33BBFF',
                'diagnosis':'#b5a1c9',
                'maybe':'#FFB5C5',
                'lab_result':'#3abd80',
                'negated':'#CD3700',
                'name':'#C0FF3E',
                'lab_name':'#698B22',
                'modifier':'#8B475D',
                'symptom_name':'#CDB7B5',
                'section_name':'#8B7D7B',
                'procedure_name':'#48D1CC',
                'grading':"#8c61e8",
                'size':"#746b87",
                'organism_substance':'#ffaa80',
                'gender':'#ffacb7',
                'age':'#ffe0ac',
                'date': '#a6b1e1'
                }