Skip to content

Commit

Permalink
Merge pull request #91 from COVID19Tracking/rename-pcr-to-viral
Browse files Browse the repository at this point in the history
Renaming "PCR" columns to "viral", including a DB migration.
  • Loading branch information
julia326 committed Jun 26, 2020
2 parents 6342600 + 5222fac commit 555b731
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 20 deletions.
24 changes: 4 additions & 20 deletions app/models/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,10 @@ class CoreData(db.Model, DataMixin):
antibodyTotal = db.Column(db.Integer, info={"includeInUSDaily": True})
antibodyPositive = db.Column(db.Integer, info={"includeInUSDaily": True})
antibodyNegative = db.Column(db.Integer, info={"includeInUSDaily": True})
pcrTotalTests = db.Column(db.Integer, info={"includeInUSDaily": True})
pcrPositiveTests = db.Column(db.Integer, info={"includeInUSDaily": True})
pcrNegativeTests = db.Column(db.Integer, info={"includeInUSDaily": True})
pcrPositiveCases = db.Column(db.Integer, info={"includeInUSDaily": True})
totalTestsViral = db.Column(db.Integer, info={"includeInUSDaily": True})
positiveTestsViral = db.Column(db.Integer, info={"includeInUSDaily": True})
negativeTestsViral = db.Column(db.Integer, info={"includeInUSDaily": True})
positiveCasesViral = db.Column(db.Integer, info={"includeInUSDaily": True})
totalTestsPeople = db.Column(db.Integer, info={"includeInUSDaily": True})
positiveConfirmed = db.Column(db.Integer, info={"includeInUSDaily": True})

Expand Down Expand Up @@ -203,22 +203,6 @@ def totalTestResults(self):
return self.positive
return self.positive + self.negative

@hybrid_property
def positiveTestsViral(self):
return self.pcrPositiveTests

@hybrid_property
def negativeTestsViral(self):
return self.pcrNegativeTests

@hybrid_property
def positiveCasesViral(self):
return self.pcrPositiveCases

@hybrid_property
def totalTestsViral(self):
return self.pcrTotalTests

# Converts the input to a string and returns parsed datetime.date object
@staticmethod
def parse_str_to_date(date_input):
Expand Down
31 changes: 31 additions & 0 deletions migrations/versions/0c6db53f2db2_.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
"""empty message
Revision ID: 0c6db53f2db2
Revises: 62a65242ccf3
Create Date: 2020-06-26 17:55:26.309606
"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '0c6db53f2db2'
down_revision = '62a65242ccf3'
branch_labels = None
depends_on = None


def upgrade():
op.alter_column('coreData', 'pcrNegativeTests', new_column_name='negativeTestsViral')
op.alter_column('coreData', 'pcrPositiveTests', new_column_name='positiveTestsViral')
op.alter_column('coreData', 'pcrTotalTests', new_column_name='totalTestsViral')
op.alter_column('coreData', 'pcrPositiveCases', new_column_name='positiveCasesViral')


def downgrade():
op.alter_column('coreData', 'negativeTestsViral', new_column_name='pcrNegativeTests')
op.alter_column('coreData', 'positiveTestsViral', new_column_name='pcrPositiveTests')
op.alter_column('coreData', 'totalTestsViral', new_column_name='pcrTotalTests')
op.alter_column('coreData', 'positiveCasesViral', new_column_name='pcrPositiveCases')

0 comments on commit 555b731

Please sign in to comment.