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

Improvement/136 extraction pipeline #143

Merged
merged 30 commits into from
May 24, 2024
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
a988dca
:gem: all cahnges from github uptodate except dropping metrics columns
nils-schmitt May 18, 2024
a589874
:gem: clean up database and implement cohorts so the evaluation is en…
nils-schmitt May 18, 2024
66f9b81
:gem: delete metrics columns from output + adjust cohort prompt to bi…
nils-schmitt May 18, 2024
9d0689f
:gem: progress bar animation left to right
nils-schmitt May 19, 2024
723f60d
:gem: code check for 'logic' directory of 'extraction' :white_check_m…
nils-schmitt May 19, 2024
bdf3c58
:fire: satisfy pylint
nils-schmitt May 19, 2024
fa39353
:gem: code check extraction/logic directory
nils-schmitt May 22, 2024
908522a
:fire: remove unused import
nils-schmitt May 22, 2024
6526bf7
♻️ adjust docstrings in admin.py according to PEP-257
soeren227 May 23, 2024
6e954bd
♻️ adjust docstrings in apps.py according to PEP-257
soeren227 May 23, 2024
b5e7533
♻️ adjust docstrings in forms.py according to PEP-257 and minor reada…
soeren227 May 23, 2024
1486b9d
♻️ adjust docstrings in models.py according to PEP-257
soeren227 May 23, 2024
71c9244
♻️ adjust docstrings in tests.py according to PEP-257
soeren227 May 23, 2024
de05540
♻️ adjust docstrings in views.py according to PEP-257
soeren227 May 23, 2024
29b4bf0
:gem: update result template
nils-schmitt May 24, 2024
0563412
♻️ refactor template files
soeren227 May 24, 2024
8dd58bd
♻️ add typing where it makes sense and make some methods static
soeren227 May 24, 2024
c38f4cf
:fire: remove print
nils-schmitt May 24, 2024
cae2237
Merge remote-tracking branch 'origin/main' into improvement/136-extra…
nils-schmitt May 24, 2024
1c0c2ae
:fire: satisfy pylint
nils-schmitt May 24, 2024
f6f12cc
Apply suggestions from code review
nils-schmitt May 24, 2024
aca9ab8
:fire: implement Pits Change Requests
nils-schmitt May 24, 2024
a855158
:fire: add Typing import to utils
nils-schmitt May 24, 2024
472fd96
"Updated db.sqlite3 and added two new log entries to tokens_used.log"
nils-schmitt May 24, 2024
f2ce335
load new fixture
nils-schmitt May 24, 2024
5d4bdf0
:fire: implement pits change requests
nils-schmitt May 24, 2024
d03b91d
put pylint right
nils-schmitt May 24, 2024
c227dfb
Apply suggestions from code review
nils-schmitt May 24, 2024
35b0441
Apply suggestions from code review
nils-schmitt May 24, 2024
56b2e0c
last additional typing
nils-schmitt May 24, 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
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ plotly~=5.22.0
pandas~=2.1.3
numpy~=1.26.2
jinja2~=3.1.4
regex~=2024.5.15
Binary file modified tracex_project/db.sqlite3
Binary file not shown.
53 changes: 44 additions & 9 deletions tracex_project/extraction/admin.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,57 @@
"""Admin file for extraction app."""
from django.contrib import admin
from typing import Union
from extraction.models import Event, PatientJourney, Prompt, Trace, Cohort, Metric


class CohortInline(admin.StackedInline):
"""Inline for the Cohort model, used to display the related Cohort object in the Trace admin page."""
"""
Django admin interface for the Cohort model.

This inline admin interface is used to manage Cohort instances directly from the Trace admin page.
No extra blank forms are displayed for adding new Cohort instances, and deletion of Cohort instances
from the Trace admin page is not allowed.

Attributes:
model: Specifies the model that this inline admin interface is for.
extra: Defines how many extra blank forms are displayed on the admin page when a new Trace is created.
can_delete: Determines whether the deletion of instances of the model is allowed from the admin interface.
"""

model = Cohort
extra = 0
can_delete = False


class TraceInline(admin.TabularInline):
"""Inline for the Trace model, used to display the related Trace objects in the PatientJourney admin page."""
"""
Django admin interface for the Trace model.

This inline admin interface is used to manage Trace instances directly from the PatientJourney admin page.
No extra blank forms are displayed for adding new Trace instances.

Attributes:
model: Specifies the model that this inline admin interface is for.
extra: Defines how many extra blank forms are displayed on the admin page when a new PatientJourney is created.
"""

model = Trace
extra = 0 # Controls the number of empty forms displayed for adding related objects


class EventInline(admin.TabularInline):
"""Inline for the Event model, used to display the related Event objects in the Trace admin page."""
"""
Django admin interface for the Event model.

This inline admin interface is used to manage Event instances directly from the Trace admin page.
No extra blank forms are displayed for adding new Event instances. Certain fields related to metrics
are read-only.

Attributes:
model: Specifies the model that this inline admin interface is for.
extra: Defines how many extra blank forms are displayed on the admin page when a new Trace is created.
readonly_fields: Specifies which fields on the admin interface are read-only.
"""

model = Event
extra = 0
Expand All @@ -29,36 +61,39 @@ class EventInline(admin.TabularInline):
"metrics_correctness_confidence",
)

def metrics_activity_relevance(self, obj):
@staticmethod
def metrics_activity_relevance(obj: Event) -> Union[str, int]:
"""Returns the activity relevance metric for the event."""
return obj.metrics.activity_relevance if hasattr(obj, "metrics") else "-"

def metrics_timestamp_correctness(self, obj):
@staticmethod
def metrics_timestamp_correctness(obj: Event) -> Union[str, int]:
"""Returns the timestamp correctness metric for the event."""
return obj.metrics.timestamp_correctness if hasattr(obj, "metrics") else "-"

def metrics_correctness_confidence(self, obj):
@staticmethod
def metrics_correctness_confidence(obj: Event) -> Union[str, int]:
"""Returns the correctness confidence metric for the event."""
return obj.metrics.correctness_confidence if hasattr(obj, "metrics") else "-"


@admin.register(PatientJourney)
class PatientJourneyAdmin(admin.ModelAdmin):
"""Admin page for the PatientJourney model."""
"""Django admin interface for managing PatientJourney instances and related Trace instances."""

inlines = [TraceInline]


@admin.register(Trace)
class TraceAdmin(admin.ModelAdmin):
"""Admin page for the Trace model."""
"""Django admin interface for managing Trace instances and related Cohort and Event instances."""

inlines = [CohortInline, EventInline]


@admin.register(Event)
class EventAdmin(admin.ModelAdmin):
"""Admin page for the Event model."""
"""Django admin interface for managing Event instances."""


admin.site.register(Metric)
Expand Down
11 changes: 10 additions & 1 deletion tracex_project/extraction/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,16 @@


class ExtractionConfig(AppConfig):
"""App configuration class for django UI."""
"""
Configuration class for the 'extraction' Django application.

This class allows customization of application configuration. It sets the default type of auto-created
primary key fields to be 64-bit integers and specifies the name of the application.

Attributes:
default_auto_field: The type of auto-created primary key fields for models in this application.
name: The name of the application that is being configured.
"""

default_auto_field = "django.db.models.BigAutoField"
name = "extraction"

This file was deleted.

Loading
Loading