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

Adding comments and document_num to sanctaury model and schema #137

Merged
merged 1 commit into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
"""CHANGEME

Revision ID: 5a6e3d13358f
Revises: 38ecd95d6104
Create Date: 2024-03-22 18:05:23.388169

"""
from alembic import op
import sqlalchemy as sa

from alembic import context

# revision identifiers, used by Alembic.
revision = '5a6e3d13358f'
down_revision = '38ecd95d6104'
branch_labels = None
depends_on = None


def upgrade():
schema_upgrades()
if context.get_x_argument(as_dictionary=True).get("data", None):
data_upgrades()


def downgrade():
if context.get_x_argument(as_dictionary=True).get("data", None):
data_downgrades()
schema_downgrades()


def schema_upgrades():
"""schema upgrade migrations go here."""
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('intakes', sa.Column('document_num', sa.String(), nullable=True))
op.add_column('intakes', sa.Column('comment', sa.String(), nullable=True))
# ### end Alembic commands ###


def schema_downgrades():
"""schema downgrade migrations go here."""
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('intakes', 'comment')
op.drop_column('intakes', 'document_num')
# ### end Alembic commands ###


def data_upgrades():
"""Add any optional data upgrade migrations here!"""
pass


def data_downgrades():
"""Add any optional data downgrade migrations here!"""
pass
2 changes: 2 additions & 0 deletions app/api/models/intake.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ class Intake(BaseSanctuary, BasicMetrics):
discharge_date = Column(DateTime, nullable=True)
discharge_time = Column(DateTime, nullable=True)
discharge_method = Column(String, nullable=True)
document_num = Column(String, nullable=True)
comment = Column(String, nullable=True)

def get_intake_by_uuid(
db: Session, uuid: uuid.UUID
Expand Down
2 changes: 2 additions & 0 deletions app/api/schemas/intake.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class IntakeSchema(BaseModel):
An intake for a given patient.
"""

document_num: Optional[str]
guest_rfid: Optional[str]
arrival_date: datetime
arrival_time: datetime
Expand All @@ -23,6 +24,7 @@ class IntakeSchema(BaseModel):
discharge_date: datetime
discharge_time: datetime
discharge_method: Optional[str]
comment: Optional[str]

class Config:
orm_mode = True
Expand Down
Loading