Skip to content

Commit

Permalink
Merge pull request #142 from bptlab/refactor/133-tracex-pj-generator
Browse files Browse the repository at this point in the history
Refactor/133 tracex pj generator
  • Loading branch information
PitButtchereit authored May 26, 2024
2 parents 0dee86c + 3643fc6 commit 62e9d79
Show file tree
Hide file tree
Showing 42 changed files with 711 additions and 502 deletions.
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' %}">
</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/[email protected]/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/[email protected]/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

0 comments on commit 62e9d79

Please sign in to comment.