This repository hosts a set of libraries and command line tool for automating parts of the onboarding workflow. It gives the user the ability to apply rule-based mapping automation, ingestion of multiple source files, review loadsheet consistency, and validate entity definitions against a pre-defined ontology (consistent with Google's Digital Facilities).
This repo requires a few libraries be installed prior to use:
- pyyaml (for parsing YAML documents)
- pyfiglet (for fancy CLI name)
- openpyxl (for Excel read/write)
- pandas (for loadsheet backend)
- typing (for type checking)
If not installed, setup libraries using
python setup.py
This repo contains a few critical pieces:
- A well defined ontology (
./ontology
) - A command line interface for dynamically building and checking loadsheets (
./programs/cli.py
) - Associated support libraries for the command line interface (and for future enhancement):
- An ontology validator
- A loadsheet validator
- A handler class that sits atop all the relevant classes
- A rules engine for applying regular expression pattern matching.
- A representations class set for converting the loadsheet into ontology-usable objects
Loadsheet process:
-
Prepare the loadsheet
a. Get point list
b. Put it in the loadsheet template sheet
c. Run the RULE ENGINE over the data
d. Manually review the unmapped points
-
Validate the loadsheet
-
Create necessary types
Example workflow:
-
Import the ontology:
>>> import ontology '../ontology/yaml/resources'
Should run without error.
Add a fake field to the field list ('bacon_sensor') -- should return error
Add a fake field with valid subfields ('supply_sensor') -- will NOT return an error.
Add a new type with a fake field -- should return error
Add duplicate fields to fake type -- should return error
-
Import the raw loadsheet:
>>> import loadsheet '../loadsheet/Loadsheet_ALC.xlsx'
Should get CLI confirmation
-
Normalize the loadsheet:
>>> normalize '../resources/rules/google_rules.json'
Should get CLI confirmation
-
Export to a new loadsheet for review:
>>> export excel '../loadsheet/Loadsheet_ALC_Normalized.xlsx'
Should see a new file with normalized fields filled in. Rules should have been applied.
-
Perform a manual review and repeat steps 2, 3, and 4 as necessary.
-
Import and validate finished loadsheet:
`>>> import loadsheet '../loadsheet/Loadsheet_ALC_Final.xlsx'
>>> validate
Should run without errors
Mess with the loadsheet to show how validation works for the following:
- an invalid standard field name
- missing bacnet info
-
When no validation errors are issued, types can be matched:
>>> match
-
Perform a review of type matches and assign to a valid canonical type.
>>> review generalTypes
>>> review generalTypes VAV
>>> review generalTypes VAV 1
or
>>> review matches
-
Apply the matched types Either review all matches made using
>>> apply all
Or Autoapply exact matches and only review inexact using
>>> apply close
The following is a list of issues that need to be addressed before widespread use: - Add rigorous typing to all methods - make the necessary fields in handler and representations private