Skip to content

Commit

Permalink
Merge pull request #34 from pnnl/update_docs
Browse files Browse the repository at this point in the history
Update project documentation
  • Loading branch information
leijerry888 authored May 16, 2024
2 parents 77fb0af + 7e3e270 commit 573cfff
Show file tree
Hide file tree
Showing 17 changed files with 528 additions and 35 deletions.
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,12 @@ temp
test_cases/verif_mtd_pp/idfs/
*.sbatch
dist/
*.html
*.js
.buildinfo
.nojekyll
*.inv
docs/_modules
docs/_sources
docs/_static
docs/.doctrees
8 changes: 4 additions & 4 deletions constrain/api/verification_library.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
library_schema = {
"library_item_id": (int, str, float),
"description_brief": str,
"description_detail": str,
"description_detailed": str,
"description_index": list,
"description_datapoints": dict,
"description_assertions": list,
Expand Down Expand Up @@ -144,8 +144,8 @@ def validate_library(self, items: List[str] = None) -> Dict:

# verify the library.json file
for lib_key in library_schema.keys():
# check if lib keys exist. "description_detail" key is optional
if lib_key not in ["description_detail"] and not self.lib_items[
# check if lib keys exist. "description_detailed" key is optional
if lib_key not in ["description_detailed"] and not self.lib_items[
item
].get(lib_key):
logging.error(
Expand All @@ -169,7 +169,7 @@ def validate_library(self, items: List[str] = None) -> Dict:
)

except KeyError:
# if `description_detail` key doesn't exist, output a warning.
# if `description_detailed` key doesn't exist, output a warning.
validity_info[item][lib_key] = None
logging.warning(f"{lib_key} doesn't exist.")

Expand Down
6 changes: 1 addition & 5 deletions constrain/api/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,7 @@ def import_package(self) -> None:
"""Import third party packages based on the "imports" element values of the workflow json.
E.g.: {
...
"imports": [
"numpy as np",
"pandas as pd",
"datetime"
],
"imports": ["numpy as np","pandas as pd","datetime"],
...
}
"""
Expand Down
3 changes: 3 additions & 0 deletions docs/source/Acknowledgment.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Acknowledgement
================
**ConStrain** was developed at the Pacific Northwest National Laboratory, and was funded under contract with the U.S. Department of Energy (DOE). It is actively being developed as an open-source project.
10 changes: 10 additions & 0 deletions docs/source/Code Documentation.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
Code Documentation
===================

.. automodule:: checklib
:members:
:inherited-members:
:undoc-members:
:show-inheritance:
.. automodule:: api.brick_compliance
:members:
:inherited-members:
:undoc-members:
:show-inheritance:
.. automodule:: api.data_processing
:members:
:inherited-members:
Expand Down
22 changes: 22 additions & 0 deletions docs/source/Contributing.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Contributing
==============
Contributions are welcome and greatly appreciated.

Issues
-------
Users of **ConStrain** are welcome to open issues to:
1. Ask for help
2. Report issues with the current code base
3. Request new features to be implemented

Pull requests
--------------
Pull requests should be submitted through forks and tagged with appropriate available labels. The title and description of the pull request should be legible and clearly describe the proposed changes.

1. Bug fixes, improvements, and new features

Bug fixes, improvements and new features should be tied to one or multiple issues. Please open an issue(s) prior to opening a pull request and documenting the proposed change(s) to **ConStrain**. The development team is open to reviewing any proposed changes as long as the changes are explained in detail (using the code review feature of GitHub), and backed with sufficient research. Each pull request addressing bug fixes or improvements needs to include one or more unit tests.

2. Data

**ConStrain** uses a data-driven approach meaning that the more data it has access to, the better and the more relevant the curves generated by **ConStrain** will be. The development team welcomes contributions aiming to add data to **ConStrain**'s libraries. New data should be submitted through a pull request. The pull request should include the data in a format that can be used by **ConStrain** (For example, **ConStrain** currently uses performance curves, so no data tables should be submitted). To be included in **ConStrain**, the data should be publicly available, sharable, and accurate (and a reference should be provided for the team's review).
23 changes: 23 additions & 0 deletions docs/source/Expand Exisiting Verifications.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Expand Exisiting Verifications
===============================

.. role:: python(code)
:language: python

1. A new verification logic file should be added to the `contrain/library` folder which already includes several verification logic
- At a minimum (for rule-based verification) the logic should be wrapped into a :python:`verify()` function as shown below where :python:`df` is a :python:`pandas.DataFrame` that contains the data needed for the verification
- For more complicated verifications (e.g., procedure-based) the functions in the :meth:`checklib.CheckLibBase` class can be overloaded

.. sourcecode:: python

from constrain.checklib import RuleCheckBase


class NewVerificationLogicClassName(RuleCheckBase):
points = ["point_1", "point_2"]

def verify(self):
self.result = (self.df["point_1"] > self.df["point_2"])

2. The new verification class name should be added to the list of class already listed in the `__init__.py` file located in that same directory
3. A library file that includes all the information needed by the verification logic should be created or appended if it already exists
18 changes: 18 additions & 0 deletions docs/source/License.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
License
========

This material was prepared as an account of work sponsored by an agency of the United States Government. Neither the United States Government nor the United States Department of Energy, nor Battelle, nor any of their employees, nor any jurisdiction or organization that has cooperated in the development of these materials, makes any warranty, express or implied, or assumes any legal liability or responsibility for the accuracy, completeness, or usefulness or any information, apparatus, product, software, or process disclosed, or represents that its use would not infringe privately owned rights.

Reference herein to any specific commercial product, process, or service by tradename, trademark, manufacturer, or otherwise does not necessarily constitute or imply its endorsement, recommendation, or favoring by the United States Governmentor any agency thereof, or Battelle Memorial Institute. The views and opinions of authors expressed herein do not necessarily state or reflect those of the United States Government or any agency thereof.

PACIFIC NORTHWEST NATIONAL LABORATORY operated by BATTELLE for the UNITED STATES DEPARTMENT OF ENERGY under Contract DE-AC05-76RL01830

Control Strainer (ConStrain): A Data-driven Control Verification Framework (formally known as ANIMATE) Copyright (c) 2021, Battelle Memorial Institute All rights reserved.

1. Battelle Memorial Institute (hereinafter Battelle) hereby grants permission to any person or entity lawfully obtaining a copy of this software and associated documentation files (hereinafter “the Software”) to redistribute and use the Software in source and binary forms, with or without modification. Such person or entity may use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and may permit others to do so, subject to the following conditions:

- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimers.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- Other than as used herein, neither the name Battelle Memorial Institute or Battelle may be used in any form whatsoever without the express written consent of Battelle.

2. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BATTELLE OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Loading

0 comments on commit 573cfff

Please sign in to comment.