Skip to content

Commit becb383

Browse files
Good Viz Fix
1 parent ef06bb8 commit becb383

File tree

6 files changed

+28
-68
lines changed

6 files changed

+28
-68
lines changed

app/histostats/vizualisation.py

+19-3
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ def create_plotly_viz(df):
162162
conclusion = df["conclusion"].value_counts()
163163
conclusion_label = []
164164
for i in list(conclusion.index):
165-
conclusion_label.append(string_breaker(i, 15))
165+
conclusion_label.append(string_wordbreaker(i))
166166
fig4 = px.bar(
167167
x=conclusion.index,
168168
y=conclusion,
@@ -274,7 +274,7 @@ def generate_UNCLEAR(df):
274274
conclusion_boqa = df_unclear["BOQA_prediction"].value_counts()
275275
labels_trim = []
276276
for i in list(conclusion_boqa.index):
277-
labels_trim.append(string_breaker(i, 15))
277+
labels_trim.append(string_wordbreaker(i))
278278
fig = px.bar(
279279
x=conclusion_boqa.index,
280280
y=conclusion_boqa,
@@ -311,7 +311,7 @@ def generate_confusion_BOQA(df):
311311
labels = ["No_Pred"] + df_no_unclear["conclusion"].unique().tolist()
312312
labels_trim = []
313313
for i in list(labels):
314-
labels_trim.append(string_breaker(i, 15))
314+
labels_trim.append(string_wordbreaker(i))
315315
matrix_results = confusion_matrix(
316316
# y_true, y_pred, labels=["No_Pred", "CNM", "COM", "NM"]
317317
y_true,
@@ -449,3 +449,19 @@ def string_breaker(s, max_length=10):
449449
new_string.append(s[i * max_length : i * max_length + max_length])
450450
new_string.append(s[lines_nb * max_length :])
451451
return "<br>".join(new_string)
452+
453+
454+
def string_wordbreaker(s, max_length=20):
455+
s.replace("-", " ")
456+
s = s.split(" ")
457+
new_string = [""]
458+
index_new_string = 0
459+
for i in s:
460+
if len(new_string[index_new_string] + " " + i) >= 20:
461+
index_new_string += 1
462+
new_string.append("")
463+
new_string[index_new_string] = i
464+
else:
465+
new_string[index_new_string] += " "
466+
new_string[index_new_string] += i
467+
return "<br>".join(new_string)

app/imgupload/forms.py

+9-9
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,15 @@ class ImageForm(FlaskForm):
3737
"Coloration Type",
3838
validators=[DataRequired()],
3939
choices=[
40-
"HE",
41-
"TG",
42-
"ATP",
43-
"NADH/SDH",
44-
"COX",
45-
"PAS",
46-
"Sudan Lipids",
47-
"Phosphorylases",
48-
"ME",
40+
"Haematoxylin and Eosin stain (HE)",
41+
"Gömöri trichrome stain (TG)",
42+
"Adenosine Triphosphate Staining (ATP)",
43+
"NADH/SDH staining",
44+
"COX staining",
45+
"PAS staining",
46+
"Sudan Lipids staining",
47+
"Phosphorylases staining",
48+
"Electron Microscopy (EM)",
4949
],
5050
render_kw={
5151
"placeholder": "Histology Coloration Type",

config.py

-2
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ class Config(object):
4242

4343
# Max upload size: 1GB
4444
MAX_CONTENT_LENGTH = 1024 * 1024 * 1024
45-
# Create various list from config file
46-
DIAG_LIST = Common.create_diag_list(os.path.join("config", "diagnostic.tsv"))
4745

4846
# DB connection settings
4947
SQLALCHEMY_DATABASE_URI = "sqlite:///" + os.path.join(

config/config_gene.txt

-37
This file was deleted.

config/diagnostic.tsv

-17
This file was deleted.

data/database/app.db.demo

4 KB
Binary file not shown.

0 commit comments

Comments
 (0)