forked from bcgov/met-public
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changes to have all answer options to appear in the report (#24)
* adding table to store available option in analytic * etl changes to load available option table * fixing linting * fixing linting
- Loading branch information
1 parent
dcb9d28
commit 9e93cb2
Showing
5 changed files
with
149 additions
and
16 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
analytics-api/migrations/versions/e7fdf769e8ff_adding_available_response_options.py
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,41 @@ | ||
"""adding_available_response_options | ||
Revision ID: e7fdf769e8ff | ||
Revises: 3a705c422892 | ||
Create Date: 2023-11-21 12:45:34.871602 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision = 'e7fdf769e8ff' | ||
down_revision = '3a705c422892' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.create_table('available_response_option', | ||
sa.Column('created_date', sa.DateTime(), nullable=True), | ||
sa.Column('updated_date', sa.DateTime(), nullable=True), | ||
sa.Column('is_active', sa.Boolean(), nullable=True), | ||
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), | ||
sa.Column('participant_id', sa.Integer(), nullable=True), | ||
sa.Column('request_key', sa.String(length=100), nullable=False), | ||
sa.Column('value', sa.Text(), nullable=True), | ||
sa.Column('request_id', sa.String(length=20), nullable=True), | ||
sa.Column('survey_id', sa.Integer(), nullable=False), | ||
sa.Column('runcycle_id', sa.Integer(), nullable=True), | ||
sa.ForeignKeyConstraint(['survey_id'], ['survey.id'], ondelete='CASCADE'), | ||
sa.PrimaryKeyConstraint('id', 'request_key') | ||
) | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_table('available_response_option') | ||
# ### end Alembic commands ### |
12 changes: 12 additions & 0 deletions
12
analytics-api/src/analytics_api/models/available_response_option.py
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,12 @@ | ||
"""available_response_option model class. | ||
Manages the Available Options for a option type questions on a survey | ||
""" | ||
from .base_model import BaseModel | ||
from .response_mixin import ResponseMixin | ||
|
||
|
||
class AvailableResponseOption(BaseModel, ResponseMixin): # pylint: disable=too-few-public-methods | ||
"""Definition of the Available Response Options entity.""" | ||
|
||
__tablename__ = 'available_response_option' |
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 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 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