Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor/133 tracex pj generator #142

Merged
merged 36 commits into from
May 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
14f9ce0
🐛 fix cohort database bug
PitButtchereit May 21, 2024
e6edf62
💎 remove print in pj generator
PitButtchereit May 21, 2024
ae1a6fa
💎 add function button
PitButtchereit May 21, 2024
ef3d803
♻️ refactor tracex logic and add docstrings
PitButtchereit May 21, 2024
69caf01
💎 update module docstring of utils.py
PitButtchereit May 21, 2024
6f19c3e
♻️ add typification for 2 methods
PitButtchereit May 21, 2024
aa78e5f
💎 update __init__ docstrings
PitButtchereit May 21, 2024
626c9c0
💎 add docstrings for forms.py
PitButtchereit May 21, 2024
fe7b7b5
💎 fix relative import
PitButtchereit May 21, 2024
975bc27
♻️ refactor views.py
PitButtchereit May 21, 2024
3c0ffa5
♻️ refactor patient journey generator
PitButtchereit May 22, 2024
2837b5f
💎 fix line to long
PitButtchereit May 22, 2024
4445ebf
♻️ final refactoring for patient journey generator
PitButtchereit May 22, 2024
969c615
♻️ refactor logic module
PitButtchereit May 22, 2024
ee7bccd
💎 rename styles.css
PitButtchereit May 22, 2024
27f0790
♻️ refactor
PitButtchereit May 22, 2024
d48038d
♻️ refactor tracex views
PitButtchereit May 23, 2024
feb2cb7
💎stylings for pylint
PitButtchereit May 23, 2024
c521198
♻️ add error redirect to pj generator
PitButtchereit May 24, 2024
e08f78f
💎 decrease pj generator logo size
PitButtchereit May 24, 2024
5a283e4
♻️ merge main into branch
PitButtchereit May 24, 2024
59ee554
💎 adjust function button style
PitButtchereit May 24, 2024
4db219d
💎 add function buttons in result view
PitButtchereit May 24, 2024
77c80d1
🐛 fix redirection from pj generator
PitButtchereit May 24, 2024
d47392e
♻️ remove unused HTML template
PitButtchereit May 24, 2024
9e23d8c
💎 update docstrings for pj generator
PitButtchereit May 24, 2024
8d3f910
💎 update docstrings in test_utils
PitButtchereit May 24, 2024
b07d6c8
💎 update db results templates
PitButtchereit May 24, 2024
ed462d8
💎 update extraction templates
PitButtchereit May 24, 2024
23653f2
💎 update pj generator templates
PitButtchereit May 24, 2024
4b54967
💎 update trace testing templates
PitButtchereit May 24, 2024
0ac55c4
💎 update tracex templates
PitButtchereit May 24, 2024
7e92ed6
♻️ merge main into branch
PitButtchereit May 25, 2024
ce6e8f5
🐛 fix cohort prompt
PitButtchereit May 25, 2024
77a4ed9
🐛 apply suggested changes from @Nils
PitButtchereit May 26, 2024
3643fc6
🐛 close temp_zip file
PitButtchereit May 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified tracex_project/db.sqlite3
Binary file not shown.
4 changes: 2 additions & 2 deletions tracex_project/db_results/templates/db_results_overview.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<title>Database Results</title>
{% load static %}
<link rel="stylesheet" type="text/css" href="{% static '/tracex/css/style.css' %}">
<link rel="stylesheet" type="text/css" href="{% static '/tracex/css/styles.css' %}">
PitButtchereit marked this conversation as resolved.
Show resolved Hide resolved
</head>
<body class="main_body">
<img src="{% static '/tracex/img/database_results_logo.png' %}" alt="Database Results Logo"
Expand All @@ -23,7 +23,7 @@ <h2>Welcome to the Database Results</h2>
</div>

<a href="{% url 'landing_page' %}">
<button class="menu_button">Return to TracEX menu</button>
<button class="menu_button">Return to TracEX Menu</button>
</a>
</body>
</html>
11 changes: 5 additions & 6 deletions tracex_project/db_results/templates/evaluation.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<title>Evaluation View</title>
{% load static %}
<link href="https://cdn.jsdelivr.net/npm/nouislider@14.6.3/distribute/nouislider.min.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="{% static '/tracex/css/style.css' %}">
<link rel="stylesheet" type="text/css" href="{% static '/tracex/css/styles.css' %}">
<script src="https://cdn.jsdelivr.net/npm/nouislider@14.6.3/distribute/nouislider.min.js"></script>
<script src="https://code.jquery.com/jquery-3.6.4.min.js"></script>
<script src="{% static '/db_results/js/filter_toggle.js' %}" defer></script>
Expand All @@ -17,7 +17,7 @@ <h1 style="text-align: center">Evaluation View</h1>

<!-- Display complete event log -->
<div>
<button id="toggleButton1">Show/Hide Event Log with applied filters</button>
<button id="toggleButton1" class="function_button">Show/Hide Event Log with applied filters</button>
<div id="contentWrapper1" style="display: none;">
{% if event_log_table %}
<p></p>
Expand All @@ -31,7 +31,7 @@ <h1 style="text-align: center">Evaluation View</h1>
</div>

<div>
<button id="toggleButton2" style="margin-top: 1em">Show/Hide Cohorts belonging to remaining entries</button>
<button id="toggleButton2" class="function_button" style="margin-top: 1em">Show/Hide Cohorts belonging to remaining entries</button>
<div id="contentWrapper2" style="display: none;">
{% if cohorts_table %}
<p></p>
Expand Down Expand Up @@ -143,12 +143,11 @@ <h1 style="text-align: center">Evaluation View</h1>

{{ form.errors }}

<input type="submit" value="Refresh Filter" class="button">
<input type="submit" value="Refresh Filter" class="function_button">
</form>
<br>

<!-- Trigger/Open The Modal (XES Download) -->
<button id="downloadBtn" class="button">Download XES File</button>
<button id="downloadBtn" class="function_button">Download XES File</button>
<div id="downloadModal" class="modal">
<div class="modal-content">
<span class="close">&times;</span>
Expand Down
4 changes: 2 additions & 2 deletions tracex_project/db_results/templates/metrics_dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<title>Metrics Dashboard</title>
{% load static %}
<link rel="stylesheet" type="text/css" href="{% static '/tracex/css/style.css' %}">
<link rel="stylesheet" type="text/css" href="{% static '/tracex/css/styles.css' %}">
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
<script src="{% static '/db_results/js/metrics-dashboard.js' %}" defer></script>
</head>
Expand Down Expand Up @@ -117,7 +117,7 @@ <h3>Timestamp Correctnes Bar Chart</h3>
<button class="menu_button">Return to Database Results Overview</button>
</a>
<a href="{% url 'landing_page' %}">
<button class="menu_button">Return to TracEX menu</button>
<button class="menu_button">Return to TracEX Menu</button>
</a>
</body>
</html>
6 changes: 3 additions & 3 deletions tracex_project/db_results/templates/metrics_pj_overview.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<title>Metrics Overview</title>
{% load static %}
<link rel="stylesheet" type="text/css" href="{% static '/tracex/css/style.css' %}">
<link rel="stylesheet" type="text/css" href="{% static '/tracex/css/styles.css' %}">
</head>
<body class="main_body">
<img src="{% static '/tracex/img/result_dashboard_logo.png' %}" alt="Metrics Dashboard" class="metrics_dashboard_logo">
Expand All @@ -15,15 +15,15 @@ <h2>Welcome to the Metrics Dashboard</h2>
<form method="post">
{% csrf_token %}
{{ form.as_p }}
<button type="submit" class="menu_button">Select this Patient Journey</button>
<button type="submit" class="function_button">Select this Patient Journey</button>
</form>

<a href="{% url 'db_results_overview' %}">
<button class="menu_button">Return to Database Results Overview</button>
</a>

<a href="{% url 'landing_page' %}">
<button class="menu_button">Return to TracEX menu</button>
<button class="menu_button">Return to TracEX Menu</button>
</a>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,8 @@ def __rate_timestamps_correctness(
}
)

timestamp_correctness, top_logprops = u.query_gpt(
messages, logprobs=True, top_logprobs=1
timestamp_correctness, linear_probability = u.query_gpt(
messages, return_linear_probability=True, top_logprobs=1
)
linear_prop = u.calculate_linear_probability(top_logprops[0].logprob)

return timestamp_correctness, linear_prop
return timestamp_correctness, linear_probability
4 changes: 2 additions & 2 deletions tracex_project/extraction/logic/orchestrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ def initialize_modules(self):
}
return modules

def run(self, view=None) -> pd.DataFrame:
def run(self, view=None) -> None:
"""Run the modules and set default values for modules not executed."""
modules = self.initialize_modules()
execution_step: int = 1
Expand Down Expand Up @@ -257,7 +257,7 @@ def set_default_values(self) -> None:
data = self.get_data()

if "time_extraction" not in config_modules:
DataFrameUtilities.set_default_timestamps(data)
data = DataFrameUtilities.set_default_timestamps(data)
if "event_type_classification" not in config_modules:
data["event_type"] = "N/A"
if "location_extraction" not in config_modules:
Expand Down
8 changes: 4 additions & 4 deletions tracex_project/extraction/templates/choose_input_method.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="UTF-8">
<title>Choose Input Method</title>
{% load static %}
<link rel="stylesheet" type="text/css" href="{% static 'tracex/css/style.css' %}">
<link rel="stylesheet" type="text/css" href="{% static '/tracex/css/styles.css' %}">
</head>
<body class="main_body">
<header>
Expand All @@ -16,19 +16,19 @@ <h2>Choose Input Method</h2>
<section class="form-row">
<div class="form-column">
<a href='{% url "journey_upload" %}'>
<button class="menu_button">Upload a patient journey</button>
<button class="menu_button">Upload a Patient Journey</button>
</a>
</div>
<div class="form-column">
<a href='{% url "journey_select" %}'>
<button class="menu_button">Select a patient journey</button>
<button class="menu_button">Select a Patient Journey</button>
</a>
</div>
</section>
</main>
<footer>
<a href="{% url 'landing_page' %}">
<button class="menu_button">Return to TracEX menu</button>
<button class="menu_button">Return to TracEX Menu</button>
</a>
</footer>
</body>
Expand Down
6 changes: 3 additions & 3 deletions tracex_project/extraction/templates/filter_journey.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<title>Upload Journey</title>
{% load static %}
<link rel="stylesheet" type="text/css" href="{% static '/tracex/css/loading-spinner.css' %}">
<link rel="stylesheet" type="text/css" href="{% static '/tracex/css/style.css' %}">
<link rel="stylesheet" type="text/css" href="{% static '/tracex/css/styles.css' %}">
<link rel="stylesheet" type="text/css" href="{% static '/tracex/css/progress-bar.css' %}">
<script src="{% static '/tracex/js/progress-bar.js' %}" defer></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
Expand Down Expand Up @@ -322,7 +322,7 @@ <h4>DFG activity key</h4>
<div class="progress-container">
</div>
</div>
<input type="submit" value="Execute Extraction Pipeline" id="progress_button" class="button"
<input type="submit" value="Execute Extraction Pipeline" id="progress_button" class="function_button"
onclick="disableButton()">
<script>
function disableButton() {
Expand All @@ -335,6 +335,6 @@ <h4>DFG activity key</h4>
<button class="menu_button">Previous</button>
</a>
<a href="{% url "landing_page" %}">
<button class="menu_button">Return to TracEX menu</button>
<button class="menu_button">Return to TracEX Menu</button>
</a>
</body>
6 changes: 3 additions & 3 deletions tracex_project/extraction/templates/journey_details.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="UTF-8">
<title>Select Journey</title>
{% load static %}
<link rel="stylesheet" type="text/css" href="{% static '/tracex/css/style.css' %}">
<link rel="stylesheet" type="text/css" href="{% static '/tracex/css/styles.css' %}">
</head>

<body class="main_body">
Expand All @@ -14,13 +14,13 @@ <h2>Content of "{{ patient_journey.name }}"</h2>

<form method="post" action="{% url 'journey_details' pk=patient_journey.pk %}">
{% csrf_token %}
<input type="submit" value="Next" class="button">
<input type="submit" class="function_button" value="Confirm Selection">
</form>
<a href="{% url "journey_select" %}">
<button class="menu_button">Previous</button>
</a>
<a href="{% url "landing_page" %}">
<button class="menu_button">Return to TracEX menu</button>
<button class="menu_button">Return to TracEX Menu</button>
</a>
</body>
</html>
15 changes: 8 additions & 7 deletions tracex_project/extraction/templates/result.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Result</title>
{% load static %}
<link rel="stylesheet" type="text/css" href="{% static '/tracex/css/style.css' %}">
<link rel="stylesheet" type="text/css" href="{% static '/tracex/css/styles.css' %}">
<script src="{% static '/tracex/js/pop_up_xes.js' %}" defer></script>
</head>
<body class="main_body">
Expand All @@ -28,7 +28,7 @@ <h1>Success! The TracEX pipeline produced the following results:</h1>
</script>

{% if trace_table %}
<button id="toggleButton1">Show/Hide extracted Event Log from Journey</button>
<button id="toggleButton1" class="function_button">Show/Hide extracted Trace from Journey</button>
<div id="contentWrapper1" style="display: none;">
<p><b>This is the event log extracted from the journey above.</b></p>
<div id="xesContent1" class="xes_container">{{ trace_table|safe }}</div>
Expand All @@ -38,7 +38,7 @@ <h1>Success! The TracEX pipeline produced the following results:</h1>
{% endif %}

{% if event_log_table %}
<button id="toggleButton2">Show/Hide enriched Event Log</button>
<button id="toggleButton2" class="function_button">Show/Hide enriched Event Log</button>
<div id="contentWrapper2" style="display: none;">
<p><b>This is the event log enriched by the extracted trace.</b></p>
<div id="xesContent2" class="xes_container">{{ event_log_table|safe }}</div>
Expand Down Expand Up @@ -111,10 +111,11 @@ <h4>DFG Activity Key</h4>
{% endfor %}
</div>
{% endif %}
<input type="submit" value="Refresh Filter" class="button">
<input type="submit" value="Refresh Filter" class="function_button">
</form>

<button id="downloadBtn" class="button">Download XES File</button>
<!-- Trigger/Open The Modal (XES Download) -->
<button id="downloadBtn" class="function_button">Download XES File</button>
<div id="downloadModal" class="modal">
<div class="modal-content">
<span class="close">&times;</span>
Expand All @@ -130,10 +131,10 @@ <h4>DFG Activity Key</h4>
</div>
</div>
<a href="{% url "save_success" %}">
<button class="menu_button">Save results to the database</button>
<button class="function_button">Save Results to the Database</button>
</a>
<a href="{% url "choose_input_method" %}">
<button class="menu_button">Return to input selection</button>
<button class="menu_button">Return to Input Selection</button>
</a>
<a href="{% url "landing_page" %}">
<button class="menu_button">Return to TracEX Menu</button>
Expand Down
6 changes: 3 additions & 3 deletions tracex_project/extraction/templates/save_success.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Result</title>
{% load static %}
<link rel="stylesheet" type="text/css" href="{% static '/tracex/css/style.css' %}">
<link rel="stylesheet" type="text/css" href="{% static '/tracex/css/styles.css' %}">
</head>
<body class="main_body">
<h1>Success! Results have been saved to the database.</h1>
<a href="{% url "choose_input_method" %}">
<button class="menu_button">Return to input selection</button>
<button class="menu_button">Return to Input Selection</button>
</a>
<a href="{% url "landing_page" %}">
<button class="menu_button">Return to TracEX menu</button>
<button class="menu_button">Return to TracEX Menu</button>
</a>
</body>
</html>
8 changes: 4 additions & 4 deletions tracex_project/extraction/templates/select_journey.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="UTF-8">
<title>Select Journey</title>
{% load static %}
<link rel="stylesheet" type="text/css" href="{% static '/tracex/css/style.css' %}">
<link rel="stylesheet" type="text/css" href="{% static '/tracex/css/styles.css' %}">
</head>

<body class="main_body">
Expand All @@ -15,14 +15,14 @@ <h2>Select Patient Journey from Database</h2>
<form method="post">
{% csrf_token %}
{{ form.as_p }}
<button type="submit" class="menu_button">Next</button>
<button type="submit" class="function_button">Select this Patient Journey</button>
</form>

<a href="{% url "choose_input_method" %}">
<button class="menu_button">Return to input method selection</button>
<button class="menu_button">Return to Input Method Selection</button>
</a>
<a href="{% url "landing_page" %}">
<button class="menu_button">Return to TracEX menu</button>
<button class="menu_button">Return to TracEX Menu</button>
</a>
</body>
</html>
6 changes: 3 additions & 3 deletions tracex_project/extraction/templates/upload_journey.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<head>
<title>Upload Journey</title>
{% load static %}
<link rel="stylesheet" type="text/css" href="{% static '/tracex/css/style.css' %}">
<link rel="stylesheet" type="text/css" href="{% static '/tracex/css/styles.css' %}">
</head>


Expand All @@ -29,10 +29,10 @@ <h2>Upload Patient Journey</h2>
</div>
</div>

<input type="submit" value="Next" class="button">
<input type="submit" class="function_button" value="Upload this Patient Journey">
</form>
<a href="{% url "choose_input_method" %}">
<button class="menu_button">Return to input method selection</button>
<button class="menu_button">Return to Input Method Selection</button>
</a>
<a href="{% url "landing_page" %}">
<button class="menu_button">Return to TracEX menu</button>
Expand Down
16 changes: 14 additions & 2 deletions tracex_project/patient_journey_generator/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,23 @@


class GenerationOverviewForm(forms.ModelForm):
"""Form for viewing generated patient journey."""
"""
Form for generating a patient journey.

By submitting this form, a patient journey is generated and saved in the orchestrator's configuration.
"""

class Meta:
"""Metaclass for GenerationForm, provides additional parameters for the form."""
"""
Metaclass that provides additional information.

Attributes:
model -- The model to use for the form.
fields -- The fields to include in the form.
help_texts -- The help texts for the fields.
widgets -- The widgets for the fields.
- "name" - A text input field to name the patient journey. Required, to save patient journey in the database.
"""
model = PatientJourney
fields = ["name"]
help_texts = {
Expand Down
Loading
Loading