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

Issue/ml capacity #84

Merged
merged 7 commits into from
Jul 7, 2022
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
33 changes: 33 additions & 0 deletions nowcasting_datamodel/migrations/pv/versions/5268d6f39e84_.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
""" Add columns to pv systems

They are
- ml capacity
- ocf_id internal id

Revision ID: 5268d6f39e84
Revises: c061c49cbf37
Create Date: 2022-07-07 10:40:36.952739

"""
import sqlalchemy as sa
from alembic import op

# revision identifiers, used by Alembic.
revision = "5268d6f39e84"
down_revision = "c061c49cbf37"
branch_labels = None
depends_on = None


def upgrade(): # noqa
# ### commands auto generated by Alembic - please adjust! ###
op.add_column("pv_system", sa.Column("ml_capacity_kw", sa.Float(), nullable=True))
op.add_column("pv_system", sa.Column("ocf_id", sa.Integer(), nullable=True))
# ### end Alembic commands ###


def downgrade(): # noqa
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column("pv_system", "ocf_id")
op.drop_column("pv_system", "ml_capacity_kw")
# ### end Alembic commands ###
13 changes: 13 additions & 0 deletions nowcasting_datamodel/models/pv.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ class PVSystemSQL(Base_PV, CreatedMixin):
Float,
nullable=True,
)
ml_capacity_kw = Column(
Float,
nullable=True,
)
ocf_id = Column(Integer, nullable=True)
correct_data = Column(Boolean, default=True)

pv_yield = relationship("PVYieldSQL", back_populates="pv_system")
Expand All @@ -63,9 +68,15 @@ class PVSystem(EnhancedBaseModel):
installed_capacity_kw: Optional[float] = Field(
None, description="The capacity of the pv system in kw."
)
ml_capacity_kw: Optional[float] = Field(
None,
description="The capacity of the pv system in kw, user for ML models. "
"This may be different from the installed capacity",
)
correct_data: Optional[bool] = Field(
True, description="If the data from the pv system is not broken in some way"
)
ocf_id: int = Field(None, description="The PV system id that is unique to OCF")

@validator("provider")
def validate_provider(cls, v):
Expand All @@ -86,6 +97,8 @@ def to_orm(self) -> PVSystemSQL:
status_interval_minutes=self.status_interval_minutes,
correct_data=self.correct_data,
installed_capacity_kw=self.installed_capacity_kw,
ml_capacity_kw=self.ml_capacity_kw,
ocf_id=self.ocf_id,
)


Expand Down