NREL-Sienna / InfrastructureSystems.jl

Utility package for Sienna's simulation infrastructure
https://nrel-sienna.github.io/InfrastructureSystems.jl/
BSD 3-Clause "New" or "Revised" License
36 stars 20 forks source link

Add functionality to serialize a system without time series #333

Closed daniel-thom closed 4 months ago

daniel-thom commented 4 months ago

There are three sets of changes here:

  1. Add a to_dict method so that the IS system and components can be serialized to a JSON string without the time series data.
  2. Remove serialization of a system’s validation descriptors. This is a breaking change in that any custom packages that were defining their own validation descriptors will need to pass them at deserialization time (there probably aren’t any). This actually fixes an issue where the descriptors were not upgraded by PSY during an upgrade across major versions.
  3. Update the test code that compares objects recursively to exclude comparison of time series fields that will not be valid in this scenario.
codecov[bot] commented 4 months ago

Codecov Report

Attention: Patch coverage is 86.79245% with 7 lines in your changes are missing coverage. Please review.

Project coverage is 79.84%. Comparing base (1500174) to head (f2f9963). Report is 8 commits behind head on main.

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/NREL-Sienna/InfrastructureSystems.jl/pull/333/graphs/tree.svg?width=650&height=150&src=pr&token=I73yjxYxgn&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=NREL-Sienna)](https://app.codecov.io/gh/NREL-Sienna/InfrastructureSystems.jl/pull/333?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=NREL-Sienna) ```diff @@ Coverage Diff @@ ## main #333 +/- ## ========================================== + Coverage 79.58% 79.84% +0.26% ========================================== Files 53 54 +1 Lines 4241 4337 +96 ========================================== + Hits 3375 3463 +88 - Misses 866 874 +8 ``` | [Flag](https://app.codecov.io/gh/NREL-Sienna/InfrastructureSystems.jl/pull/333/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=NREL-Sienna) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/NREL-Sienna/InfrastructureSystems.jl/pull/333/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=NREL-Sienna) | `79.84% <86.79%> (+0.26%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=NREL-Sienna#carryforward-flags-in-the-pull-request-comment) to find out more. | [Files](https://app.codecov.io/gh/NREL-Sienna/InfrastructureSystems.jl/pull/333?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=NREL-Sienna) | Coverage Δ | | |---|---|---| | [src/components.jl](https://app.codecov.io/gh/NREL-Sienna/InfrastructureSystems.jl/pull/333?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=NREL-Sienna#diff-c3JjL2NvbXBvbmVudHMuamw=) | `90.07% <100.00%> (+0.07%)` | :arrow_up: | | [src/hdf5\_time\_series\_storage.jl](https://app.codecov.io/gh/NREL-Sienna/InfrastructureSystems.jl/pull/333?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=NREL-Sienna#diff-c3JjL2hkZjVfdGltZV9zZXJpZXNfc3RvcmFnZS5qbA==) | `91.31% <100.00%> (ø)` | | | [src/in\_memory\_time\_series\_storage.jl](https://app.codecov.io/gh/NREL-Sienna/InfrastructureSystems.jl/pull/333?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=NREL-Sienna#diff-c3JjL2luX21lbW9yeV90aW1lX3Nlcmllc19zdG9yYWdlLmps) | `73.22% <ø> (ø)` | | | [src/internal.jl](https://app.codecov.io/gh/NREL-Sienna/InfrastructureSystems.jl/pull/333?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=NREL-Sienna#diff-c3JjL2ludGVybmFsLmps) | `80.70% <100.00%> (ø)` | | | [src/system\_data.jl](https://app.codecov.io/gh/NREL-Sienna/InfrastructureSystems.jl/pull/333?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=NREL-Sienna#diff-c3JjL3N5c3RlbV9kYXRhLmps) | `90.97% <91.66%> (-0.03%)` | :arrow_down: | | [src/utils/utils.jl](https://app.codecov.io/gh/NREL-Sienna/InfrastructureSystems.jl/pull/333?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=NREL-Sienna#diff-c3JjL3V0aWxzL3V0aWxzLmps) | `62.86% <63.63%> (+0.17%)` | :arrow_up: | ... and [5 files with indirect coverage changes](https://app.codecov.io/gh/NREL-Sienna/InfrastructureSystems.jl/pull/333/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=NREL-Sienna)
daniel-thom commented 4 months ago

If I follow the logic behind this case, then the objective is to not check for UUIDs in the validation step

In the case where we serialize/de-serialize the system to/from a JSON string, losing the time series, we need to be able to exclude comparison of time series fields while traversing the components. The new exclude parameter allows us to skip custom fields.