1. Pearl API Versioning
The following are the steps for creating a new version for the Pearl API. The new version created in these steps is v1.1.0
Go to
pearlcertification.public_api.versions.ApiVersionand add new class attribute for the new versionV1p1p0="v1.1.0"Create the python package of the new version
v1p1p0Copy the same
urls.pymodule that was under the previous version and paste it under the new versionIn the new
urls.pyfile:Change the
app_namefromv1p0p0tov1p1p0Change
"pearlcertification.public_api.v1p0p0.urls"to"pearlcertification.public_api.v1p1p0.urls"Update the 2 instances of
ApiVersion.V1p0p0toApiVersion.V1p1p0(new version)
Add a new url for the new version under
pearlcertification/public_api/urls.pyStart making the necessary changes under the new version package:
A change in a method in the viewset requires creating a new viewset, subclassing the old then make the change and finally update the urls to point to the new viewset
A change in the serializer requires creating a new serializer that is a subclass of the old one, creating a new viewset that is a subclass of the old viewset, updating the serializer class of the viewset to point to the new serializer and updating the corresponding url to point to the new viewset.
A change in the data mapper requires creating a new data mapper that is a subclass of the old one, creating a new viewset that is a subclass of the old viewset, updating the data mapper class of the viewset to point to the new data mapper and updating the corresponding url to point to the new viewset.
Tests for the changes need to be added under
pearlcertification/public_api/tests/<new_version>/For the
pearlcertification.public_api.client.PublicApiClientUpdate the
api_versionargument of__init__to the new versionUpdate the
versioninpearlcertification.public_api.client.PublicApiClient.get_urlto the new version
Under
"pearlcertification/api/views.py"replace the redirect url to the latest versionUpdate the
versionand theviewnamein"pearlcertification.home_batches.preprocessing.assets.thermostat.Thermostat.get_url"to the new versionUpdate the
versionand theviewnamein"pearlcertification.home_batches.preprocessing.assets.filter.Filter.get_url"to the new versionAdd another
sectionfor the new version specifying the addedfeaturesandchangesUpdate clients in equity calculator project to point to the corresponding urls of the newly created version.
1.1. Audit API changes
Starting from v4.20 of the pearl project, we added the Audit API as a way to get a snapshot of a home data at a certain point in time. The API relies on the Pearl API serializers and data mappers to serialize the home data to json. Still, we have yet to clearly define how the API will be used by contractors/programs, so until that is done we will keep updating its v1.0.0 with every new Pearl API version (we are not creating a new version). Once its purpose is clearly defined, and it is exposed to API consumers we will, we will start creating a v1.1.0, v2.0.0 as necessary.
1.1.1. Steps for adding a new version of the Audit API in case of a new release of the public api
Audit API serializer is using a dictionary named assets_utils which contains models, serializers
and datamappers used in the public api to generate its fields dynamically.
We will need to create a new dictionary with the new serializers/datamappers we have in the new version of public api.
Go to
Snapshotmodel and add a new choice with the new Audit API version to the version field.Go to
pearlcertification.api.audit.base.asset_utilsyou’ll find a list of objects for each asset category. If you need to make a change in an asset category, create a new list for it to add the new serializer/datamapper classes from public api under the new version package in a new filevx/asset_utils.py, then create a newassets_utilsdictionary to update it with the new lists created. The newassets_utilsname should follow the following rule :assets_utils_vxwhere x is the new audit api version.Go to
pearlcertification.api.audit.version_manager, add to theutils_dictattribute a new key with the new version token having as value a dictionary containing the newassets_utilsyou created, if you didn’t make any change inAuditSerializerandAuditDataclasses you can keep them the same as the previous version.Please keep in mind that there is a case not covered by the current implementation: If the change in public api is about adding/editing a
MethodSerializerFieldit may trigger an error. If that is the case, consider making the change manually (check the implementation ofscoreandlevelfields inHomeInfoandaudit.base.serializers.HomeDetailsSerializer)add new version urls to
pearlcertification.audit.urls.
1.2. Changes included v6.2
1.2.1. New Features
Add choice
cold_climate_air_sourceto type field for theHeatPumpSystemsasset typeAdd the field
have_efficient_fan_controllerto theHeatPumpSystemsasset type with respective choicesyes,no,unknown.Add the fields
have_efficient_fan_controllerto theCoolingSystemsasset type with respective choicesyes,no,dont_know.Field is allowed to be populated only if
Heat Pump Typeis set toAir Source,Cold Climate Air SourceorGround Source.Add choice
lithium_iron_phosphateto type field for theSolarEnergyStorageasset typeAdd the field
have_efficient_fan_controllerto theHeatingSystemasset type with respective choicesyes,no,unknown.Field is allowed to be populated only if
Heating Systemprimary_heating_fuelis set togas,electricity,oilorpropaneandtypeis set tocentral_furnace,room_furnace_through_the_wallorfurnace.
1.3. Changes included v6.1
1.3.1. New Features
Add endpoint
homes/{home_id}/specific_utility_plan_providers/to list available specific utility plan providers.Add
is_energy_storage_includedboolean field to Solar Panel & Array asset.Add
utility_plan_typefield to Solar Panel & Array asset with choicesaverage_utility_rateandspecific_utility_plan.Add
specific_utility_plan_providerfield to Solar Panel & Array asset. This field should be only set ifutility_plan_typeis set tospecific_utility_plan. Provider’s name should be fetched from the list returned byhomes/{home_id}/specific_utility_plan_providers/endpoint.Add
specific_utility_planfield to Solar Panel & Array asset that includes to the utility plan external id. This field should be only set ifutility_plan_typeis set tospecific_utility_plan. Plan’s external_id should be fetched from the list of plans corresponding to the provider set inspecific_utility_plan_providerfield.homes/{home_id}/specific_utility_plan_providers/endpoint.Add
energy_billsfield to Solar Panel & Array asset that list the monthly energy bills (date and power). The list must contain 12 items with 12 consecutive months dates.Add
specific_utility_plan_nameread only field to Solar Panel & Array asset.homes/{home_id}/specific_utility_plan_providers/endpoint should be used to get this value.Add
specific_utility_plan_uriread only field to Solar Panel & Array asset.homes/{home_id}/specific_utility_plan_providers/endpoint should be used to get this value.Add
specific_utility_plan_is_defaultread only field to Solar Panel & Array asset.homes/{home_id}/specific_utility_plan_providers/endpoint should be used to get this value.
1.4. Changes included v6
1.4.1. New Features
Add the field
equipment_typeto thePoolPumpasset type with choicespool_pump,pool_heaterAdd the field
pool_heater_fuel_typeto thePoolPumpasset type with choiceselectric,heat_pump,solar,gasAdd the field
backup_system_fuel_typeto thePoolPumpasset type with choiceselectricity,gas,oil,propane,keroseneChange
typefield name topool_pump_type.pool_pump_type,horsepower,flow_rate,energy_factorfields are populated only ifequipment_typeis set topool_pump.pool_heater_fuel_typefield is populated only ifequipment_typeis set topool_heater.backup_system_fuel_typefield is populated only ifpool_heater_fuel_typeis set tosolar.Add endpoints to Create, Update, Retrieve and Delete the new
Fireplaceasset under theBaseloadcategory.Add the fields
is_permanentandlocationto theCookingApplianceasset type with respective choicesyes,noandindoor,outdoor.Both fields are allowed to be populated only if
Cooking appliance type?is set torangeorcooktop.For
WaterHeatingasset type addwater_heater_typequestion with choicesconventional_water_heaterandindirectAdd the fields
drying_machine_fuelto theClothesDryerasset type with respective choiceselectric,heat_pump,gas.
1.4.2. Backward incompatible changes
rename the
PoolPumpasset type toPoolEquipmentand change its url frompool_pumps/topool_equipment/
1.5. Changes included v5
1.5.1. New Features
Files with
category=green-door-shared-docare now automatically tagged withGD.For firms configured with only one collateral package, certification requests created without a collateral package will have the collateral package set automatically.
add 4 new asset endpoints:
kitchen_fixtures,bathroom_fixtures,cooking_appliancesandventilation.add the
year_manufacturedfield to the following asset endpoints:refrigerators,dishwashers,clothes_washersandclothes_dryers.add
proper_combustion_safety_testingandwater_filtration_systemto thehealth_and_indoor_air_qualityasset endpoint.add
appliances_with_smart_featuresto thesmart_home_devicesasset endpoint.
1.5.2. Backward incompatible changes
remove
nyserda_contractorfromsystem_typechoices in theexternal_identifiersendpointremove the
nabcep_accredited_companyfield from thesolar_installationsendpoint
1.6. Changes included v4.2
1.6.1. New Features
add a new field
auto_create_service_professional_information_assetto cert_request endpointbased on this field we decide whether to auto create a service professional information asset or not
1.7. Changes included v4.1
1.7.1. New Features
add new endpoints for solar valuation adjustments.
add new choices
sunpower_master_dealer,sunpower_non_installing_dealer,sunpower_elite,sunpower_authorized_dealerto the service_professional field in the Service Professional Information (spi) endpoint.add new field
radon_mitigation_featuresto the health_and_indoor_air_quality endpointadd new field
radon_levels_monitoring_and_reportingto the smart_home_devices endpoint
1.8. Changes included v4
1.8.1. Backward incompatible changes
In the
power_production_warrantyendpoint, change the field nameannual_degradation_factortodegradation_rate_year_twoand update the field label fromAnnual Degradation Factor?toDegradation Rate in Year Two Until End of Warranty?In the same endpoint, add a field name
degradation_rate_year_oneIn the
solar_invertersendpoint, add two fields with the namesmodel_numberandefficiency_raterespectively.
add a new optional “source” field to the create homes endpoint (
POST /homes)add new endpoints for solar_valuation to return the current estimated value of the home’s solar system
In the
solar_panels_and_arraysendpoint:add a
financedoption to theownershipfield and remove the optionsolar_loan_with_ucc_filing.add a new field
financing_typethat should be used only whenownershipis set asfinanced.solar_loan_with_ucc_filingwill be an option underfinancing_type.add a new field
array_typethat replacesmountandlocation.
1.8.2. New Features
add a new option
owens_corning_air_careto theservice_professionalfield in thespiendpointadd a new option
bpi_infiltration_and_duct_leakage_certificationto thecredentialsfield in thespiendpointadd a new field
model_numberforsolar_panels_and_arrays.add advanced fields for calculating losses for
solar_panels_and_arrays:soiling,shading,snow,mismatch,wiring,connections,light_induced_degradation,nameplate_rating,availability.The
year_builtfield now allows values until the next year.add new fields
model_numberandefficiency_rateto thesolar_invertersendpointadd the ability to authenticate using JWT
1.9. Changes included v3
1.9.1. New Features
add the
maintenance_templatesendpoint for listing the maintenance templates created by a firmadd the
assigned_maintenance_templatesendpoint for assigning/removing maintenance templates to/from a home
1.9.2. Backward incompatible changes
Update the choices for
premier_package_assetfield fromyesandnoto12_year,10_year,noandunknown. This affects the following endpoints:heat_pumpsheating_systemscooling_systemssmart_home_deviceshealth_and_indoor_air_quality
allow submitting
premier_package_assetandmodel_nameonly for Lennox dealers in the following endpoints:heat_pumpsheating_systemscooling_systemssmart_home_deviceshealth_and_indoor_air_quality
In the
solar_panels_and_arraysendpoint, change the field nameroof_installationtois_solar_roofing_tilesand update the field label fromIs this a solar roof installation?toIs this a solar tile/roof installation?
1.9.3. Other changes
update the label for
indoor_manufacturerfield inheat_pumpsandcooling_systemsendpoints fromIndoor ManufacturertoIndoor Unit Manufacturerupdate the label for
outdoor_manufacturerfield inheat_pumpsandcooling_systemsendpoints fromOutdoor ManufacturertoOutdoor Unit Manufacturer
1.10. Changes included v2
1.10.1. New Features
add the
fiberglassoption for theframingfield in thewindows_and_skylightsendpointadd
green-door-shared-doccategory for files shared with homeowners and add validation for setting this category based on the firm permission to issue green door loginsadd
roof_installationfield to the Solar Panel & Array endpointadd new questions to
energy_storageendpoint:installer,installation_warranty_term,model_number,power_rating,round_trip_efficiency,guaranteed_capacityadd new field
passive_cooling_architecture_plantocooling_systemsendpointadd
manufacturerfield to theattic_insulation,wall_insulation,floor_and_foundation,rim_joist,door,windows_and_skylights,distribution_systemsendpointsadd new choices to
filtration_efficiencyinhealth_and_indoor_air_qualityendpoint. The new choices are:merv9merv14merv15merv16andelectronic_air_cleaner.add new field
non_ozone_generating_uv_lighttohealth_and_indoor_air_qualityendpoint.add field with choices
smart_conditioning_control_systemtosmart_home_devicesendpoint choices are:yes,noandunknownadd multiselect field
indoor_air_quality_smart_controlsto thesmart_home_devicesendpoint choices are:in_full_bathroom,kitchen_hood_ventilation,whole_home_ventilationandunknown
1.10.2. Backward incompatible changes
rename the
MHPtag toGDand add validation for tagging files for green door based on the firm permission to issue green door loginsremove the deprecated
energy_managementendpointchange choices and add new ones to
whole_house_ventilationinhealth_and_indoor_air_qualityendpoint choices changed:intake_or_exhaust_ventilation->exhaust_onlyerv_or_hrv->balanced_energy_or_heat_recoverychoices added:supply_onlyandbalancedremove field
humidity_managementfromhealth_and_indoor_air_qualityendpointchange choices in
control_device:smart_home_devicesendpoint label is also changed fromHome has a device to monitor and automatically control excessive:toPermanently affixed humidifier or dehumidifier installed:choices changed:humidity->dehumidifierdryness->humidifier
1.10.3. Other changes
update the label for
warrantyfield in theenergy_storageendpoint fromWarranty Term (years)toManufacturer Warranty Term (years)
1.11. Changes included in v1.1
1.11.1. New Features
allow creating homes by submitting the
full_address. It is now possible to create homes using eitherfull_addressOR address components.add lennox fields (
model_name,premier_package_asset) to thehealth_and_indoor_air_quality,heat_pumps,heating_systems,cooling_systems,smart_home_devicesandenergy_managementendpoints.add
modelandsecondary_modelto theheat_pumpsendpoint. These fields are specific to ground heat pumps.add
indoor_manufacturerandoutdoor_manufacturerto theheat_pumpsendpoint. These fields are specific to mini-split heat pumps.add
indoor_manufacturerandoutdoor_manufacturerto thecooling_systemsendpoint.
1.11.2. Other changes
deprecate
energy_managementand addsmart_home_devicesas a replacement with the same functionality and behaviorallow
certification_email_recipientsto be empty to send the certification email to the default contact email of the firm (certification_requestsendpoint)allow creating contacts without an
email(contactsendpoint)