Skip to content

remove pv database #297

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ All models are in `nowcasting_datamodel.models.py`.
The diagram below shows how the different tables are connected.

![Models](diagram.png)
![Models](diagram_pv.png)

### connection.py

Expand Down
Binary file removed diagram_pv.png
Binary file not shown.
6 changes: 0 additions & 6 deletions nowcasting_datamodel/fake.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
MetricSQL,
MetricValueSQL,
MLModelSQL,
PVSystemSQL,
national_gb_label,
)
from nowcasting_datamodel.models.forecast import ForecastSQL, ForecastValueSQL
Expand All @@ -32,11 +31,6 @@ def make_fake_location(gsp_id: int) -> LocationSQL:
return LocationSQL(label=f"GSP_{gsp_id}", gsp_id=gsp_id)


def make_fake_pv_system() -> PVSystemSQL:
"""Make fake location with gsp id"""
return PVSystemSQL(pv_system_id=1, provider="pvoutput.org", latitude=55, longitude=0)


def make_fake_input_data_last_updated() -> InputDataLastUpdatedSQL:
"""Make fake input data last updated"""
now = datetime.now(tz=timezone.utc)
Expand Down
4 changes: 1 addition & 3 deletions nowcasting_datamodel/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
5. Input data status, shows when the data was collected (models.py)
6. Forecasts, a forecast that is made for one gsp,
for several time steps into the future (models.py)
7. PV system for storing PV data (pv.py)
8. PV yield for storing PV data (pv.py)


Current these models have a primary index of 'id'.
This keeps things very simple at the start.
Expand All @@ -25,4 +24,3 @@
from .gsp import * # noqa F403
from .metric import * # noqa F403
from .models import * # noqa F403
from .pv import * # noqa F403
1 change: 0 additions & 1 deletion nowcasting_datamodel/models/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@
from sqlalchemy.orm import declarative_base

Base_Forecast = declarative_base() # noqa
Base_PV = declarative_base() # noqa
155 changes: 0 additions & 155 deletions nowcasting_datamodel/models/pv.py

This file was deleted.

29 changes: 0 additions & 29 deletions nowcasting_datamodel/read/read.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
InputDataLastUpdatedSQL,
LocationSQL,
MLModelSQL,
PVSystemSQL,
StatusSQL,
national_gb_label,
)
Expand Down Expand Up @@ -757,31 +756,3 @@ def get_all_locations(session: Session, gsp_ids: List[int] = None) -> List[Locat
locations = [nation] + locations

return locations


def get_pv_system(
session: Session, pv_system_id: int, provider: Optional[str] = "pvoutput.org"
) -> PVSystemSQL:
"""
Get model object from name and version

:param session: database session
:param pv_system_id: pv system id
:param provider: the pv provider, defaulted to pvoutput.org

return: PVSystem object
"""

# start main query
query = session.query(PVSystemSQL)

# filter on pv_system_id and provider
query = query.filter(PVSystemSQL.pv_system_id == pv_system_id)
query = query.filter(PVSystemSQL.provider == provider)

# get all results
pv_systems = query.all()

pv_system = pv_systems[0]

return pv_system
Loading
Loading