-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a9bbdf9
commit 622b3a3
Showing
15 changed files
with
302 additions
and
231 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
[flake8] | ||
ignore = E501, W503 | ||
max-line-length = 88 | ||
per-file-ignores = | ||
./app/models/__init__.py:F401, | ||
./app/models/*.py:F821 | ||
|
||
exclude = | ||
.venv, | ||
migrations |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import sqlalchemy as sa | ||
|
||
from app import db | ||
|
||
from .availability import Availability | ||
from .client import Client | ||
from .enums import Gender, SessionFormat, UserRole | ||
from .intervention import Intervention | ||
from .issue import Issue | ||
from .language import Language | ||
from .session_type import SessionType | ||
from .therapist import Therapist | ||
from .unavailability import Unavailability | ||
from .user import User | ||
|
||
client_issue = sa.Table( | ||
"client_issue", | ||
db.Model.metadata, | ||
sa.Column("client_id", sa.ForeignKey("client.id"), primary_key=True), | ||
sa.Column("issue_id", sa.ForeignKey("issue.id"), primary_key=True), | ||
) | ||
|
||
therapist_language = sa.Table( | ||
"therapist_language", | ||
db.Model.metadata, | ||
sa.Column("therapist_id", sa.ForeignKey("therapist.id"), primary_key=True), | ||
sa.Column("language_id", sa.ForeignKey("language.id"), primary_key=True), | ||
) | ||
|
||
therapist_format = sa.Table( | ||
"therapist_format", | ||
db.Model.metadata, | ||
sa.Column("therapist_id", sa.ForeignKey("therapist.id"), primary_key=True), | ||
sa.Column("session_format", sa.Enum(SessionFormat), primary_key=True), | ||
) | ||
|
||
therapist_issue = sa.Table( | ||
"therapist_issue", | ||
db.Model.metadata, | ||
sa.Column("therapist_id", sa.ForeignKey("therapist.id"), primary_key=True), | ||
sa.Column("issue_id", sa.ForeignKey("issue.id"), primary_key=True), | ||
) | ||
|
||
therapist_intervention = sa.Table( | ||
"therapist_intervention", | ||
db.Model.metadata, | ||
sa.Column("therapist_id", sa.ForeignKey("therapist.id"), primary_key=True), | ||
sa.Column("intervention_id", sa.ForeignKey("intervention.id"), primary_key=True), | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from datetime import date, time | ||
from typing import Optional | ||
|
||
import sqlalchemy as sa | ||
import sqlalchemy.orm as so | ||
|
||
from app import db | ||
|
||
|
||
class Availability(db.Model): | ||
id: so.Mapped[int] = so.mapped_column(primary_key=True) | ||
therapist_id: so.Mapped[int] = so.mapped_column( | ||
sa.ForeignKey("therapist.id"), index=True | ||
) | ||
day_of_week: so.Mapped[Optional[int]] = so.mapped_column( | ||
sa.Integer | ||
) # 0=Monday, 6=Sunday, None for specific dates | ||
start_time: so.Mapped[Optional[time]] = so.mapped_column(sa.Time) | ||
end_time: so.Mapped[Optional[time]] = so.mapped_column(sa.Time) | ||
specific_date: so.Mapped[Optional[date]] = so.mapped_column( | ||
sa.Date | ||
) # For non-recurring availability | ||
|
||
therapist: so.Mapped["Therapist"] = so.relationship(back_populates="availabilities") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from typing import List, Optional | ||
|
||
import sqlalchemy as sa | ||
import sqlalchemy.orm as so | ||
|
||
from app import db | ||
from app.models.enums import Gender | ||
|
||
|
||
class Client(db.Model): | ||
id: so.Mapped[int] = so.mapped_column(primary_key=True) | ||
user_id: so.Mapped[int] = so.mapped_column(sa.ForeignKey("user.id"), index=True) | ||
preferred_gender: so.Mapped[Optional["Gender"]] = so.mapped_column(sa.Enum(Gender)) | ||
preferred_language_id: so.Mapped[Optional[int]] = so.mapped_column( | ||
sa.ForeignKey("language.id") | ||
) | ||
|
||
user: so.Mapped["User"] = so.relationship(back_populates="client") | ||
issues: so.Mapped[List["Issue"]] = so.relationship( | ||
secondary="client_issue", back_populates="clients" | ||
) | ||
preferred_language: so.Mapped[Optional["Language"]] = so.relationship("Language") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from enum import Enum, unique | ||
|
||
|
||
@unique | ||
class UserRole(Enum): | ||
CLIENT = "client" | ||
THERAPIST = "therapist" | ||
|
||
|
||
@unique | ||
class SessionFormat(Enum): | ||
FACE = "Face to Face" | ||
AUDIO = "Audio Call" | ||
VIDEO = "Video Call" | ||
|
||
|
||
@unique | ||
class Gender(Enum): | ||
MALE = "Male" | ||
FEMALE = "Female" | ||
NON_BINARY = "Non-Binary" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from typing import List | ||
|
||
import sqlalchemy as sa | ||
import sqlalchemy.orm as so | ||
|
||
from app import db | ||
|
||
|
||
class Intervention(db.Model): | ||
id: so.Mapped[int] = so.mapped_column(primary_key=True) | ||
name: so.Mapped[str] = so.mapped_column(sa.String(50), unique=True) | ||
|
||
therapists: so.Mapped[List["Therapist"]] = so.relationship( | ||
secondary="therapist_intervention", back_populates="interventions" | ||
) |
Oops, something went wrong.