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

Remove obsolete data classes #695

Merged
merged 60 commits into from Aug 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
1307f30
Fix doctests
Flix6x May 22, 2023
c5239f4
Remove obsolete view utils
Flix6x May 22, 2023
41c1861
Remove obsolete api utils
Flix6x May 22, 2023
e0ef8b8
Sunset old save_to_db, already announced in v0.8.0
Flix6x May 22, 2023
d2ba30b
Remove obsolete portfolio queries
Flix6x May 22, 2023
b18687d
Remove obsolete analytics queries
Flix6x May 22, 2023
a7cd166
Remove obsolete resource utils
Flix6x May 22, 2023
c9c3619
Remove obsolete resource class
Flix6x May 23, 2023
1857efd
Remove obsolete AssetSchema
Flix6x May 23, 2023
06af86c
refactor: Rename module
Flix6x May 23, 2023
66a86f5
Update test: user deletion does not remove their organisation's data
Flix6x May 23, 2023
a530d50
temporary fix for printing out old Asset instances
Flix6x May 23, 2023
8c0ae9e
Clean up UI conftest
Flix6x May 23, 2023
34ba601
Remove obsolete Power class
Flix6x May 23, 2023
7318714
Remove obsolete Price class
Flix6x May 23, 2023
21cc35f
Remove obsolete Weather class
Flix6x May 23, 2023
c59dc1e
Update conftest to stop using Market class
Flix6x May 23, 2023
30d8dd8
Remove obsolete Market and MarketType classes
Flix6x May 23, 2023
953081a
flake8
Flix6x May 23, 2023
dd51388
docs: Update notation.rst by removing mentions of sunset API versions
Flix6x Jun 4, 2023
9aa2c87
Merge branch 'main' into remove-obsolete-data-classes
nhoening Jul 11, 2023
ede6df9
fix merge conflict residue
nhoening Jul 11, 2023
d38cb68
fix: broken import after merge
Flix6x Jul 13, 2023
37e2972
sunset: fm0 scheme
Flix6x Jul 13, 2023
dd717d8
docs: sunset fm0 scheme
Flix6x Jul 13, 2023
5fb02c3
erratum: fm0 was not compatible with API v3
Flix6x Jul 13, 2023
a1ceaf6
delete: obsolete API utils
Flix6x Jul 13, 2023
d7af7d5
update docstring and set default to fm1 scheme
Flix6x Jul 13, 2023
ae84eeb
delete: remove obsolete WeatherSensor class
Flix6x Jul 13, 2023
63d4cb7
delete: remove obsolete WeatherSensorType class and weather module
Flix6x Jul 13, 2023
090529b
Merge branch 'remove-obsolete-data-classes' of github.com:FlexMeasure…
nhoening Jul 13, 2023
c577eba
fix: find closest weather sensor
Flix6x Jul 14, 2023
c98f0b3
delete: remove obsolete Asset and AssetType class from conftests
Flix6x Jul 14, 2023
6b63c25
delete: remove obsolete Asset and AssetType class and corresponding m…
Flix6x Jul 15, 2023
c34efa1
style: black and flake8
Flix6x Jul 15, 2023
b3fcff8
delete: remove obsolete deprecation utils for fm0 scheme
Flix6x Jul 15, 2023
2c4c2ca
delete: remove obsolete TimedValue class
Flix6x Jul 15, 2023
ff5d1ee
delete: remove obsolete API utils
Flix6x Jul 15, 2023
93a48e5
fix: update test
Flix6x Jul 15, 2023
64e14cf
style: black and flake8
Flix6x Jul 15, 2023
9a9bbce
delete: daterangepicker.js and moment.js dependencies
Flix6x Jul 15, 2023
6408576
Update documentation notes on data model transition
Flix6x Jul 15, 2023
83dba25
delete: obsolete coding utils
Flix6x Jul 15, 2023
4c61494
Merge remote-tracking branch 'origin/main' into remove-obsolete-data-…
Flix6x Jul 15, 2023
6fc431f
chore: update visualize_data_model.py
nhoening Jul 17, 2023
4ee8d5f
refactor: move towards a single function to set session variables fro…
Flix6x Jul 26, 2023
5fe8a32
delete: remove obsolete session variables and corresponding view utils
Flix6x Jul 26, 2023
77b2d0c
feat: set 'sensor' as default entity type
Flix6x Jul 26, 2023
c632d25
refactor: retire the 'modern' label on save_to_db
Flix6x Jul 26, 2023
1d51a16
fix: inline comment
Flix6x Jul 26, 2023
2b5cd23
Merge remote-tracking branch 'origin/main' into remove-obsolete-data-…
Flix6x Aug 1, 2023
b481457
fix fixture
victorgarcia98 Aug 1, 2023
1560d17
Merge remote-tracking branch 'origin/main' into remove-obsolete-data-…
Flix6x Aug 1, 2023
4d4cc78
docs: remove mentions of portfolio, analytics and control pages
Flix6x Aug 1, 2023
8f6a28c
ui: remove mentions of portfolio, analytics and control pages from ba…
Flix6x Aug 1, 2023
3bc71d3
docs: remove documentation pages for portfolio, analytics and control…
Flix6x Aug 1, 2023
033e841
style: black
Flix6x Aug 1, 2023
a162f44
style: flake8
Flix6x Aug 1, 2023
7a28646
docs: changelog entry
Flix6x Aug 3, 2023
f3dee71
Merge remote-tracking branch 'origin/main' into remove-obsolete-data-…
Flix6x Aug 3, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 2 additions & 7 deletions documentation/api/notation.rst
Expand Up @@ -94,7 +94,7 @@ It uses the fact that all FlexMeasures sensors have unique IDs.

The ``fm0`` scheme is the original scheme.
It identified different types of sensors (such as grid connections, weather sensors and markets) in different ways.
The ``fm0`` scheme has been deprecated and is no longer supported officially.
The ``fm0`` scheme has been sunset since API version 3.


Timeseries
Expand Down Expand Up @@ -393,22 +393,17 @@ For example, to obtain data originating from data source 42, include the followi

Data source IDs can be found by hovering over data in charts.

.. note:: Older API version (< 3) accepted user IDs (integers), account roles (strings) and lists thereof, instead of data source IDs (integers).


.. _units:

Units
^^^^^

From API version 3 onwards, we are much more flexible with sent units.
The FlexMeasures API is quite flexible with sent units.
A valid unit for timeseries data is any unit that is convertible to the configured sensor unit registered in FlexMeasures.
So, for example, you can send timeseries data with "W" unit to a "kW" sensor.
And if you wish to do so, you can even send a timeseries with "kWh" unit to a "kW" sensor.
In this case, FlexMeasures will convert the data using the resolution of the timeseries.

For API versions 1 and 2, the unit sent needs to be an exact match with the sensor unit, and only "MW" is allowed for power sensors.

.. _signs:

Signs of power values
Expand Down
1 change: 1 addition & 0 deletions documentation/changelog.rst
Expand Up @@ -35,6 +35,7 @@ Infrastructure / Support
* Document the `device_scheduler` linear program [see `PR #764 <https://www.github.com/FlexMeasures/flexmeasures/pull/764>`_].
* Add support for `HiGHS <https://highs.dev/>`_ solver [see `PR #766 <https://www.github.com/FlexMeasures/flexmeasures/pull/766>`_].
* Add support for installing FlexMeasures under Python 3.11 [see `PR #771 <https://www.github.com/FlexMeasures/flexmeasures/pull/771>`_].
* Removed obsolete code dealing with deprecated data models (e.g. assets, markets and weather sensors), and sunset the fm0 scheme for entity addresses [see `PR #695 <https://www.github.com/FlexMeasures/flexmeasures/pull/695>`_ and `project 11 <https://www.github.com/FlexMeasures/flexmeasures/projects/11>`_]

v0.14.2 | July 25, 2023
============================
Expand Down
2 changes: 1 addition & 1 deletion documentation/configuration.rst
Expand Up @@ -179,7 +179,7 @@ For more fine-grained control, the entries can also be tuples of view names and

.. note:: This fine-grained control requires FlexMeasures version 0.6.0

Default: ``["dashboard", "analytics", "portfolio", "assets", "users"]``
Default: ``["dashboard"]``


FLEXMEASURES_MENU_LISTED_VIEW_ICONS
Expand Down
32 changes: 18 additions & 14 deletions documentation/dev/note-on-datamodel-transition.rst
Expand Up @@ -11,41 +11,42 @@
A note on the ongoing data model transition
============================================

FlexMeasures is already ~3 years in the making. It's a normal process for well-maintained software to update architectural principles during such a time.
FlexMeasures is already ~5 years in the making. It's a normal process for well-maintained software to update architectural principles during such a time.

We are in the middle of a refactoring which affects the data model, and if you are using FlexMeasures on your own server, we want you to know the following:
We are finishing up a refactoring which affects the data model, and if you are using FlexMeasures on your own server, we want you to know the following:


We have your back
------------------

If you work with the current model, there will be support to transition data to the new model once it's active. Actually, we are already working with the new model in some projects, so talk to us if you're interested.
By upgrading FlexMeasures one minor version at a time, you get the most out of our transition tools, including database upgrades (moving data over from the old to the new model automatically), plugin compatibility warnings, deprecation warnings for upcoming sunsets, and blackout tests (:ref:`more info here<api_deprecation>`).
If you still work with the old model and are having trouble to transition data to the current model, let us know.


This transition is in your interest, as well
----------------------------------------------

We do this transition so we can make FlexMeasures even more useful. For instance: support for more kinds of assets (energy plus related sensors). Or better forecasting and scheduling support.
We did this transition so we could make FlexMeasures even more useful. For instance: support for more kinds of assets (energy plus related sensors), and better support for forecasting, scheduling and reporting.


What are the big changes?
-----------------------------

There are two important transitions happening in this transition:
There are two important transitions that happened in this transition:

1. First, we'll be deprecating the specific data types ``Asset``, ``Market`` and ``WeatherSensor``. We learned that to manage energy flexibility, you need all sort of sensors, and thus a more generalisable data model. When we model assets and sensors, we'll also better be able to differentiate the business from the data world.
2. Second, we'll fully integrate the `timely-beliefs framework <https://github.com/SeitaBV/timely-beliefs>`_ as the model for our time series data, which brings some major benefits for programmers as it lets us handle uncertain, multi-source time series data in a special Pandas data frame.
1. First, we deprecated the specific data types ``Asset``, ``Market`` and ``WeatherSensor``. We learned that to manage energy flexibility, you need all sort of sensors, and thus a more generalisable data model. When we modelled assets and sensors, we were also better able to differentiate the business from the data world.
2. Second, we fully integrated the `timely-beliefs framework <https://github.com/SeitaBV/timely-beliefs>`_ as the model for our time series data, which brings some major benefits for programmers as it lets us handle uncertain, multi-source time series data in a special Pandas data frame.

For the curious, here are visualisations of where we're now and where we're going (click image for large versions).
For the curious, here are visualisations of where we were before and where we're going (click image for large versions).

The current model:
The old model:

.. image:: https://raw.githubusercontent.com/FlexMeasures/screenshots/main/architecture/FlexMeasures-CurrentDataModel.png
:target: https://raw.githubusercontent.com/FlexMeasures/screenshots/main/architecture/FlexMeasures-CurrentDataModel.png
:align: center
.. :scale: 40%

The new model (work in progress):
The future model (work in progress):

.. image:: https://raw.githubusercontent.com/FlexMeasures/screenshots/main/architecture/FlexMeasures-NewDataModel.png
:target: https://raw.githubusercontent.com/FlexMeasures/screenshots/main/architecture/FlexMeasures-NewDataModel.png
Expand All @@ -64,19 +65,22 @@ Here is a brief list:
- |check_| `Support Sensor and Asset diversity <https://github.com/FlexMeasures/flexmeasures/projects/9>`_: We are generalizing our database structure for organising energy data, to support all sorts of sensors and assets, and are letting users move their data to the new database model. We do this so we can better support the diverse set of use cases for energy flexibility.
- |check_| `Update API endpoints for time series communication <https://github.com/FlexMeasures/flexmeasures/projects/13>`_: We are updating our API with new endpoints for communicating time series data, thereby consolidating a few older endpoints into a better standard. We do this so we can both simplify our API and documentation, and support a diversity of sensors.
- |check_| `Update CLI commands for setting up Sensors and Assets <https://github.com/FlexMeasures/flexmeasures/projects/14>`_: We are updating our CLI commands to reflect the new database structure. We do this to facilitate setting up structure for new users.
- |uncheck_| `Update UI views for Sensors and Assets <https://github.com/FlexMeasures/flexmeasures/projects/10>`_: We are updating our UI views (dashboard maps and analytics charts) according to our new database structure for organising energy data. We do this so users can customize what they want to see.
- |check_| `Update UI views for Sensors and Assets <https://github.com/FlexMeasures/flexmeasures/projects/10>`_: We are updating our UI views (dashboard maps and analytics charts) according to our new database structure for organising energy data. We do this so users can customize what they want to see.
- |check_| `Deprecate old database models <https://github.com/FlexMeasures/flexmeasures/projects/11>`_: We are deprecating the Power, Price and Weather tables in favour of the TimedBelief table, and deprecating the Asset, Market and WeatherSensor tables in favour of the Sensor and GenericAsset tables. We are doing this to clean up the code and database structure.
- |uncheck_| `Infrastructure for reporting on sensors <https://github.com/FlexMeasures/flexmeasures/projects/19>`_: We are working on a backend infrastructure for sensors that record reports based on other sensors, like daily costs and aggregate power flow.
- |uncheck_| `Scheduling of sensors <https://github.com/FlexMeasures/flexmeasures/projects/6>`_: We are extending our database structure for Sensors with actuator functionality, and are moving to a model store where scheduling models can be registered. We do this so we can provide better plugin support for scheduling a diverse set of devices.
- |uncheck_| `Forecasting of sensors <https://github.com/FlexMeasures/flexmeasures/projects/8>`_: We are revising our forecasting tooling to support fixed-viewpoint forecasts. We do this so we can better support decision moments with the most recent expectations about relevant sensors.
- |uncheck_| `Deprecate old database models <https://github.com/FlexMeasures/flexmeasures/projects/11>`_: We are deprecating the Power, Price and Weather tables in favour of the TimedBelief table, and deprecating the Asset, Market and WeatherSensor tables in favour of the Sensor and GeneralizedAsset tables. We are doing this to clean up the code and database structure.


The state of the transition (March 2022, v0.9.0)
The state of the transition (July 2023, v0.15.0)
---------------------------------------------------

Project 9 was implemented with the release of v0.8.0. This work moved a lot of structure over, as well as actual data and some UI (dashboard, assets). We believe that was the hardest part.

We are now working on deprecating the old database models (see project 11). As part of that move, we decided to begin the work on a new API version (v3) which supports only the new data model (and is more REST-like). That work was done in project 13. The new APIs for assets and sensor data had already been working before (at /api/dev) and had been powering what is shown in the UI since v0.8.0.
In project 13, we began work on a new API version (v3) that supports only the new data model (and is more REST-like). The new APIs for assets and sensor data had already been working before (at /api/dev) and had been powering what is shown in the UI since v0.8.0.

We also implemented many CLI commands which support the new model (project 14).

We have deprecated and sunset all API versions before v3, while offering the ability for FlexMeasures hosts to organise blackout tests, and have removed the old database models (see project 11).

We take care to support people on the old data model so the transition will be as smooth as possible, as we said above. One part of this is that the ``flexmeasures db upgrade`` command copies your data to the new model. Also, creating new data (e.g. old-style assets) creates new-style data (e.g. assets/sensors) automatically. However, some edge cases are not supported in this way. For instance, edited asset meta data might have to be re-entered later. Feel free to contact us to discuss the transition if needed.
2 changes: 0 additions & 2 deletions documentation/host/modes.rst
Expand Up @@ -16,8 +16,6 @@ In this mode, the server is assumed to be used as a demonstration tool. Most of
- [UI] Logged-in users can view queues on the demo server (usually only admins can do that)
- [UI] Demo servers often display login credentials, so visitors can try out functionality. Use the :ref:`demo-credentials-config` config setting to do this.
- [UI] The dashboard shows all non-empty asset groups, instead of only the ones for the current user.
- [UI] The analytics page mocks confidence intervals around power, price and weather data, so that the demo data doesn't need to have them.
- [UI] The portfolio page mocks flexibility numbers and a mocked control action.

Play
------
Expand Down
1 change: 0 additions & 1 deletion documentation/index.rst
Expand Up @@ -169,7 +169,6 @@ The platform operator of FlexMeasures can be an Aggregator.
:maxdepth: 1

concepts/benefits
concepts/benefits_of_flex
concepts/inbuilt-smart-functionality
concepts/algorithms
concepts/security_auth
Expand Down
2 changes: 1 addition & 1 deletion documentation/tut/forecasting_scheduling.rst
Expand Up @@ -40,7 +40,7 @@ You can also clear the job queues:

When the main FlexMeasures process runs (e.g. by ``flexmeasures run``\ ), the queues of forecasting and scheduling jobs can be visited at ``http://localhost:5000/tasks/forecasting`` and ``http://localhost:5000/tasks/schedules``\ , respectively (by admins).

When forecasts and schedules have been generated, they should be visible at ``http://localhost:5000/analytics``.
When forecasts and schedules have been generated, they should be visible at ``http://localhost:5000/assets/<id>``.


.. note:: You can run workers who process jobs on different computers than the main server process. This can be a great architectural choice. Just keep in mind to use the same databases (postgres/redis) and to stick to the same FlexMeasures version on both.
Expand Down
54 changes: 0 additions & 54 deletions documentation/views/analytics.rst

This file was deleted.

37 changes: 0 additions & 37 deletions documentation/views/control.rst

This file was deleted.

5 changes: 2 additions & 3 deletions documentation/views/dashboard.rst
Expand Up @@ -24,8 +24,7 @@ Interactive map of assets
=========================

The map shows all of the user's assets with icons for each asset type.
Clicking on an asset allows the user to see its current state (e.g. latest measurement of wind power production) and to navigate to the :ref:`analytics` page
to see more details, for instance forecasts.
Hovering over an asset allows users to see its name and ownership, and clicking on an asset allows the user to navigate to its page to see more details, for instance forecasts.


.. _dashboard_summary:
Expand All @@ -34,7 +33,7 @@ Summary of asset types
======================

The summary below the map lists all asset types that the user has hooked up to the platform and how many of each there are.
Clicking on the asset type name leads to the :ref:`analytics` page, where data is shown aggregated for that asset type.
Clicking on the asset type name leads to the asset's page, where its data is shown.


Grouping by accounts
Expand Down