Skip to content

Commit

Permalink
Merge pull request #25 from DePaul-CCR/pc_threshold_bar_changes
Browse files Browse the repository at this point in the history
Removes threshold bars and adds collapsable case defs
  • Loading branch information
mooserson authored Aug 4, 2023
2 parents 59e60c8 + 45a0300 commit d9b58c2
Show file tree
Hide file tree
Showing 7 changed files with 96 additions and 25 deletions.
1 change: 0 additions & 1 deletion dsq_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,6 @@ def dsq_diagnose():
fig.update_layout(yaxis_title='Averaged Frequency and Severity Scores',
xaxis_title='Symptom Domains')
fig.update_yaxes(range=[0, 100], dtick=25)
fig.add_hline(y=1.5 * 25, line_color='black')
graphJSON = json.dumps(fig, cls=plotly.utils.PlotlyJSONEncoder)

return render_template("results/graph3.html", graphJSON=graphJSON,
Expand Down
3 changes: 1 addition & 2 deletions website/screener_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def graph():
select_list = ['fatigue13c', (session['pemname'] + 'c'),
(session['cogname'] + 'c'), (session['sleepname'] + 'c'), 'dx']
df = df[select_list]
colors = ['#89889E' if score < 2 else '#56A8A0' for score in composite_scores]
colors = ['#89889E' if score < 50 else '#56A8A0' for score in composite_scores]

# composite f/s score graph
fig = go.Figure(
Expand All @@ -178,7 +178,6 @@ def graph():
xaxis_title='Symptom Domains'
)
fig.update_yaxes(range=[0, 100], dtick=25)
fig.add_hline(y=1.5 * 25, line_color='black')
graphJSON = json.dumps(fig, cls=plotly.utils.PlotlyJSONEncoder)
return render_template("results/graph.html",
graphJSON = graphJSON,
Expand Down
1 change: 0 additions & 1 deletion website/short_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,6 @@ def graph2():
fig.update_layout(yaxis_title='Averaged Frequency and Severity Scores',
xaxis_title='Symptom Domains')
fig.update_yaxes(range=[0, 100], dtick=25)
fig.add_hline(y=1.5 * 25, line_color='black')
# This converts to figure fig to a JSON object so it can be dynamically rendered with javascript on the page
graphJSON = json.dumps(fig, cls=plotly.utils.PlotlyJSONEncoder)

Expand Down
36 changes: 35 additions & 1 deletion website/static/css/results.css
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
}

.case-results-title {
margin: 5px 0 0 0;
margin: 5px 0 5px 0;
}

.case-results-diagnosis {
Expand All @@ -50,6 +50,7 @@
padding: 2px;
text-align: left;
font-weight: bold;
display: none;
}

.case-results p {
Expand Down Expand Up @@ -89,13 +90,34 @@
border-bottom: 1px solid black;
}

.symptom-list.closed {
display: none;
}

.symptom-expand-button {
display: flex;
justify-content: center;
align-items: center;
padding: 5px 0 5px 0;
cursor: default;
font-weight: bold;
transition: background-color .3s;
background-color: #C2EFEB;
}

.symptom-expand-button:hover {
background-color: #ED7E63;
}

.symptom-col-1 {
display: flex;
align-items: center;
text-align: left;
padding: 5px;
border-top: 1px solid black;
border-left: 1px solid black;
/* so symptom connecting elements can be positioned in between correctly */
position: relative;
}

.symptom-col-2 {
Expand All @@ -114,6 +136,18 @@
margin: 50px 0 20px 0;
}

.symptom-logic-connector {
position: absolute;
top: -.6em;
right: 0;
background-color: white;
display: inline-block;
z-index: 1000;
border: 1px solid black;
border-right: 0;
font-size: .9em;
}

.two-buttons {
white-space: nowrap;
display: flex;
Expand Down
22 changes: 22 additions & 0 deletions website/static/js/expand_symptoms.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
const iomExpandButton = document.querySelector('.symptom-expand-button#iom');
const iomSymptomList = document.querySelector('.symptom-list#iom');
const cccExpandButton = document.querySelector('.symptom-expand-button#ccc');
const cccSymptomList = document.querySelector('.symptom-list#ccc');

iomExpandButton.addEventListener('click', () => {
iomSymptomList.classList.toggle('closed');
if (iomSymptomList.classList.contains('closed')) {
iomExpandButton.innerHTML = "Click here to see more..."
} else {
iomExpandButton.innerHTML = "Click here to see less..."
}
});

cccExpandButton.addEventListener('click', () => {
cccSymptomList.classList.toggle('closed');
if (cccSymptomList.classList.contains('closed')) {
cccExpandButton.innerHTML = "Click here to see more..."
} else {
cccExpandButton.innerHTML = "Click here to see less..."
}
});
25 changes: 17 additions & 8 deletions website/templates/results/graph2.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,34 @@ <h3 class="ariel">DePaul University Short Form Questionnaire Results</h3>
<h3 class="case-results-title">Institute of Medicine (IOM) Case Definition</h3>
<div class="case-results-diagnosis">{{ iom_msg }}</div>
<div class="case-results-symptom-header">Case Definition Requirements Met: </div>
<div class="symptom-list">
<div class="symptom-col-1">Fatigue that persists at least 6 months </div>
<div class="symptom-list closed" id="iom">
<div class="symptom-col-1">Fatigue that persists at least 6 months</div>
<div class="symptom-col-2" {% if iomfatiguecheck == 'Yes' %} style="background-color: #FFD580;" {% endif %}>{{ iomfatiguecheck }}</div>
<div class="symptom-col-1">50% or more reduction in functioning</div>
<div class="symptom-col-1">50% or more reduction in functioning
<div class="symptom-logic-connector" {% if iomfatiguecheck == 'Yes' and iomreductioncheck == 'Yes'%} style="background-color: #FFD580; font-weight: bold;" {% endif %}>Both{</div>
</div>
<div class="symptom-col-2" {% if iomreductioncheck == 'Yes' %} style="background-color: #FFD580;" {% endif %}>{{ iomreductioncheck }}</div>
<div class="symptom-col-1">Post-exertional malaise (PEM) </div>
<div class="symptom-col-1">Post-exertional malaise (PEM)</div>
<div class="symptom-col-2" {% if iompemcheck == 'Yes' %} style="background-color: #FFD580;" {% endif %}>{{ iompemcheck }}</div>
<div class="symptom-col-1">Unrefreshing sleep </div>
<div class="symptom-col-1">Unrefreshing sleep</div>
<div class="symptom-col-2" {% if iomsleepcheck == 'Yes' %} style="background-color: #FFD580;" {% endif %}>{{ iomsleepcheck }}</div>
<div class="symptom-col-1">Cognitive impairment </div>
<div class="symptom-col-1">Cognitive impairment</div>
<div class="symptom-col-2" {% if iomcogcheck == 'Yes' %} style="background-color: #FFD580;" {% endif %}>{{ iomcogcheck }}</div>
<div class="symptom-col-1">Orthostatic intolerance </div>
<div class="symptom-col-1">Orthostatic intolerance
<div class="symptom-logic-connector" {% if iomcogcheck == 'Yes' or iomorthocheck == 'Yes'%} style="background-color: #FFD580; font-weight: bold;" {% endif %}>Either{</div>
</div>
<div class="symptom-col-2" {% if iomorthocheck == 'Yes' %} style="background-color: #FFD580;" {% endif %}>{{ iomorthocheck }}</div>
<div class="symptom-col-1"><b>Diagnosis:</b></div>
<div class="symptom-col-2"><b>{{ iomdxcheck }}</b></div>
</div>
<div class="symptom-expand-button" id="iom">Click here to see more...</div>
</div>

<div class="case-results">
<h3 class="case-results-title">Canadian 2003 ME/CFS Case Definition</h3>
<div class="case-results-diagnosis">{{ ccc_msg }}</div>
<div class="case-results-symptom-header">Case Definition Requirements Met: </div>
<div class="symptom-list">
<div class="symptom-list closed" id="ccc">
<div class="symptom-col-1">Fatigue that persists at least 6 months</div>
<div class="symptom-col-2" {% if ccc_fatiguecheck == 'Yes' %} style="background-color: #FFD580;" {% endif %}>{{ ccc_fatiguecheck }}</div>
<div class="symptom-col-1">50% or more reduction in functioning</div>
Expand All @@ -55,6 +60,7 @@ <h3 class="case-results-title">Canadian 2003 ME/CFS Case Definition</h3>
<div class="symptom-col-1"><b>Diagnosis:</b></div>
<div class="symptom-col-2"><b>{{ ccc_dx }}</b></div>
</div>
<div class="symptom-expand-button" id="ccc">Click here to see more...</div>
</div>
<div class="container">
<div class="chart-center">
Expand All @@ -78,4 +84,7 @@ <h3 class="case-results-title">Canadian 2003 ME/CFS Case Definition</h3>
</div>

<p class="disclaimer"><i>Disclaimer: This screener is not meant to provide medical diagnoses. Please consult with your physician if you believe you may be suffering from ME/CFS.</i></p>

<script src="{{url_for('static', filename='js/expand_symptoms.js')}}"></script>

{% endblock %}
33 changes: 21 additions & 12 deletions website/templates/results/graph3.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,34 @@ <h3 class="ariel">Full DePaul University Symptom Questionnaire Results</h3>
<h3 class="case-results-title">Institute of Medicine (IOM) Case Definition</h3>
<div class="case-results-diagnosis">{{ iom_msg }}</div>
<div class="case-results-symptom-header">Case Definition Requirements Met: </div>
<div class="symptom-list">
<div class="symptom-col-1">Fatigue that persists at least 6 months </div>
<div class="symptom-list closed" id="iom">
<div class="symptom-col-1">Fatigue that persists at least 6 months</div>
<div class="symptom-col-2" {% if iomfatiguecheck == 'Yes' %} style="background-color: #FFD580;" {% endif %}>{{ iomfatiguecheck }}</div>
<div class="symptom-col-1">50% or more reduction in functioning</div>
<div class="symptom-col-1">50% or more reduction in functioning
<div class="symptom-logic-connector" {% if iomfatiguecheck == 'Yes' and iomreductioncheck == 'Yes'%} style="background-color: #FFD580; font-weight: bold;" {% endif %}>Both{</div>
</div>
<div class="symptom-col-2" {% if iomreductioncheck == 'Yes' %} style="background-color: #FFD580;" {% endif %}>{{ iomreductioncheck }}</div>
<div class="symptom-col-1">Post-exertional malaise (PEM) </div>
<div class="symptom-col-1">Post-exertional malaise (PEM)</div>
<div class="symptom-col-2" {% if iompemcheck == 'Yes' %} style="background-color: #FFD580;" {% endif %}>{{ iompemcheck }}</div>
<div class="symptom-col-1">Unrefreshing sleep </div>
<div class="symptom-col-1">Unrefreshing sleep</div>
<div class="symptom-col-2" {% if iomsleepcheck == 'Yes' %} style="background-color: #FFD580;" {% endif %}>{{ iomsleepcheck }}</div>
<div class="symptom-col-1">Cognitive impairment </div>
<div class="symptom-col-1">Cognitive impairment</div>
<div class="symptom-col-2" {% if iomcogcheck == 'Yes' %} style="background-color: #FFD580;" {% endif %}>{{ iomcogcheck }}</div>
<div class="symptom-col-1">Orthostatic intolerance </div>
<div class="symptom-col-1">Orthostatic intolerance
<div class="symptom-logic-connector" {% if iomcogcheck == 'Yes' or iomorthocheck == 'Yes'%} style="background-color: #FFD580; font-weight: bold;" {% endif %}>Either{</div>
</div>
<div class="symptom-col-2" {% if iomorthocheck == 'Yes' %} style="background-color: #FFD580;" {% endif %}>{{ iomorthocheck }}</div>
<div class="symptom-col-1"><b>Diagnosis:</b></div>
<div class="symptom-col-2"><b>{{ iomdxcheck }}</b></div>
</div>
<div class="symptom-expand-button" id="iom">Click here to see more...</div>
</div>

<div class="case-results">
<h3 class="case-results-title">Canadian 2003 ME/CFS Case Definition</h3>
<div class="case-results-diagnosis">{{ ccc_msg }}</div>
<div class="case-results-symptom-header">Case Definition Requirements Met: </div>
<div class="symptom-list">
<div class="symptom-list closed" id="ccc">
<div class="symptom-col-1">Fatigue that persists at least 6 months</div>
<div class="symptom-col-2" {% if ccc_fatiguecheck == 'Yes' %} style="background-color: #FFD580;" {% endif %}>{{ ccc_fatiguecheck }}</div>
<div class="symptom-col-1">50% or more reduction in functioning</div>
Expand All @@ -55,6 +60,7 @@ <h3 class="case-results-title">Canadian 2003 ME/CFS Case Definition</h3>
<div class="symptom-col-1"><b>Diagnosis:</b></div>
<div class="symptom-col-2"><b>{{ ccc_dx }}</b></div>
</div>
<div class="symptom-expand-button" id="ccc">Click here to see more...</div>
</div>
<div class="container">
<div class="chart-center">
Expand All @@ -68,9 +74,12 @@ <h3 class="case-results-title">Canadian 2003 ME/CFS Case Definition</h3>
</div>
</div>

<button class="print-button" onclick="window.print();return false;" >
<b>Print/Save PDF</b>
</button>
<button class="print-button" onclick="window.print();return false;" >
<b>Print/Save PDF</b>
</button>

<p class="disclaimer"><i>Disclaimer: This screener is not meant to provide medical diagnoses. Please consult with your physician if you believe you may be suffering from ME/CFS.</i></p>

<script src="{{url_for('static', filename='js/expand_symptoms.js')}}"></script>

<p class="disclaimer"><i>Disclaimer: This screener is not meant to provide medical diagnoses. Please consult with your physician if you believe you may be suffering from ME/CFS.</i></p>
{% endblock %}

0 comments on commit d9b58c2

Please sign in to comment.