Package: buildingsync-asset-extractor
BuildingSync Asset Extractor (BAE)This package processes a BuildingSync file to extract asset information that can then be imported into SEEDInstallationInstall from PyPIpipinstallbuildingsync-asset-extractorInstall from sourcePoetryis required to install buildingsync-asset-extractor.# Copy repogitclonehttps://github.com/BuildingSync/BuildingSync-asset-extractor.git# install the packagecdBuildingSync-asset-extractor
poetryinstall# Test that it works, you should see a message describing the usagepoetryrunbuildingsync_asset_extractorUsageBuildingSync version 2.4.0.The pre-importer will identify assets defined in theasset_definitions.jsonfile stored in theconfigdirectory.  There are various methods of calculating assets:sqft.  The sqft method will calculate a 'primary' and 'secondary' value for the asset based on the area it serves. This is calculated from the floor areas defined in eachSectionelement.Conditionedfloor area values will be used if present;Grossotherwise.num. The num method will sum up all assets of the specified type and return a single overall number.avg. The avg method will return an average value for all assets of the specified type found.avg_sqft. The avg_sqft method will return a weighted average value for all assets of the specified type found based on the area they serve.age_oldest,age_newest,age_average. The age method will retrieve the 'YearOfManufacture' (or 'YearInstalled' if not present) element of a specified equipment type and return either the oldest or newest, or average age (year) as specified. Average age is calculated by a weighted average using the following (in order): capacity, served space area, regular average.custom. Use this method for particular asset that do not fit in the other categories; i.e. Heating Efficiency. Note that a dedicated method may need to be written to support this type of asset.When an asset has a unit associated with it, a separate asset will be generated to store the unit information. That asset will be named the same as the original asset, with ' Units' appended at the end.To test usage:pythonbuildingsync_asset_extractor/main.pyThis will extract assets fromtests/files/testfile.xmland save the results toassets_output.jsonThere are 2 methods of initializing the Processor: with either a filename or databp=BSyncProcessor(filename=filename)orbp=BSyncProcessor(data=file_data)AssumptionsAssuming 1 building per fileAssuming sqft method uses "Conditioned" floor area for calculations. If not present, uses "Gross"Assuming averages that use served space area must be defined in Sections (LinkedSectionIDs). LinkedBuildingID is not used.TODOthermal zones: when spaces are listed within them with spaces (or multiple thermal zones), this would change the average setpoint calculations. Is this an exception or a normal case to handle?Assets Definitions FileThis file is used to specify what assets to extract from a BuildingSync XML file. By default, the file found inconfig/asset_definitions.jsonis used, but a custom file can be specified with theset_asset_defs_filemethod in theBSyncProcessorclass.There are currently 5 types of assets that can be extracted:sqft: Sqft assets take into account the floor area served by a specific asset and returns 'Primary' and 'Secondary' values.  For example: Primary HVAC System and Secondary HVAC System.avg_sqft: Avg_sqft assets compute a weighted average to get the an average asset value.  For example:  Average Heating Setpoint.num: Num assets count the total number of the specified asset found.  For example, Total number of lighting systems.age_oldest, age_newest, and age_average: These types return the oldest or newest asset, or average age of a specific type.  For example: Oldest Boiler.custom: For asset that need particular handling, such as Heating Efficiency. The current assets that have custom methods are:Heating System EfficiencyCooling System EfficiencyLighting System EfficiencyWater Heater EfficiencyHeating Fuel TypeThe schema for the assets definition JSON file is inschemas/asset_definitions_schema.json.Extracted Assets FileThe schema for the extracted assets JSON file is inschemas/extracted_assets_schema.json.This file lists the extracted assets information in name, value, units triples.  Names will match theexport_namelisted in the asset_definitions JSON file, except for assets of type 'sqft', which will be prepended by 'Primary' and 'Secondary'.DevelopingPre-commitThis project usespre-commit <https://pre-commit.com/>_ to ensure code consistency.
To enable pre-commit on every commit run the following from the command line from within the git checkout of the BuildingSync-asset-extractorpre-commitinstallTo run pre-commit against the files without calling git commit, then run the following. This is useful when cleaning up the repo before committing.pre-commitrun--all-filesTestingpoetry run pytestReleasingpoetrybuild# config and push to testpypipoetryconfigrepositories.testpypihttps://test.pypi.org/legacy/
poetrypublish-rtestpypi# install from testpypipipinstall--index-urlhttps://test.pypi.org/simple/buildingsync-asset-extractorIf everything looks good, publish to pypi:poetrypublishIf you have environment variables setup for PYPI token username and password:poetrypublish--build--username$PYPI_USERNAME--password$PYPI_PASSWORD