Skip to content

Commit

Permalink
Add new pipeline DTOs
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelOwenDyer committed Feb 14, 2024
1 parent b6d5ff7 commit 403f118
Show file tree
Hide file tree
Showing 6 changed files with 88 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/domain/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
from domain.message import IrisMessage, IrisMessageRole
from domain.course import Course
from domain.exercise import ProgrammingExercise
from domain.submission import ProgrammingSubmission
from domain.codehint import CodeHint
15 changes: 15 additions & 0 deletions app/domain/codehint.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
class ProgrammingExerciseSolutionEntry:
def __init__(self, file_path: str, previous_line: int, line: int, previous_code: str, code: str):
self.file_path = file_path
self.previous_line = previous_line
self.line = line
self.previous_code = previous_code
self.code = code


class CodeHint:
def __init__(self, title: str, description: str, content: str, solution_entries: [ProgrammingExerciseSolutionEntry]):
self.title = title
self.description = description
self.content = content
self.solution_entries = solution_entries
4 changes: 4 additions & 0 deletions app/domain/course.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
class Course:
def __init__(self, title, description):
self.title = title
self.description = description
50 changes: 50 additions & 0 deletions app/domain/dtos.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
from domain import Course, ProgrammingExercise, IrisMessage, ProgrammingSubmission, CodeHint


class ProgrammingExerciseTutorChatDTO:
def __init__(self,
course: Course,
exercise: ProgrammingExercise,
submission: ProgrammingSubmission,
chat_history: [IrisMessage]
):
self.course = course
self.exercise = exercise
self.submission = submission
self.chat_history = chat_history


class CodeEditorChatDTO:
def __init__(self,
problem_statement: str,
solution_repository: dict[str, str],
template_repository: dict[str, str],
test_repository: dict[str, str],
chat_history: [IrisMessage]
):
self.problem_statement = problem_statement
self.solution_repository = solution_repository
self.template_repository = template_repository
self.test_repository = test_repository
self.chat_history = chat_history


class CodeEditorAdaptDTO:
def __init__(self,
problem_statement: str,
solution_repository: dict[str, str],
template_repository: dict[str, str],
test_repository: dict[str, str],
instructions: str
):
self.problem_statement = problem_statement
self.solution_repository = solution_repository
self.template_repository = template_repository
self.test_repository = test_repository
self.chat_history = instructions


class HestiaDTO:
def __init__(self, code_hint: CodeHint, exercise: ProgrammingExercise):
self.code_hint = code_hint
self.exercise = exercise
4 changes: 4 additions & 0 deletions app/domain/exercise.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
class ProgrammingExercise:
def __init__(self, title: str, problem_statement: str):
self.title = title
self.problem_statement = problem_statement
11 changes: 11 additions & 0 deletions app/domain/submission.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class BuildLogEntry:
def __init__(self, time: str, message: str):
self.time = time
self.message = message


class ProgrammingSubmission:
def __init__(self, commit_hash: str, build_failed: bool, build_log_entries: [BuildLogEntry]):
self.commit_hash = commit_hash
self.build_failed = build_failed
self.build_log_entries = build_log_entries

0 comments on commit 403f118

Please sign in to comment.