added basic heating demand table and adding main fuel to existing property features

This commit is contained in:
Khalim Conn-Kowlessar 2023-08-02 18:20:39 +01:00
parent 85da1008b9
commit 89a8091103
3 changed files with 66 additions and 155 deletions

View file

@ -12,6 +12,7 @@ import {
} from "@/app/components/building-passport/FeatureTableColumns";
import {
formatGeneralFeatures,
formatHeatDemandFeatures,
formatRetrofitFeatures,
getConditionReport,
getPropertyMeta,
@ -121,149 +122,6 @@ export default async function PreAssessmentReport({
const propertyDetailsSpatial = {
inConservationArea: "No",
};
console.log("DATA!!");
console.log(conditionReportData);
// const conditionReportData: ConditionReportData = {
// id: 1,
// lastUpdated: "2023-07-12 11:51:31.000 +0100",
// fullAddress: "123 Fake Street, Fake Town",
// postcode: "AB1 2CD",
// currentEpcRating: "C",
// inConservationArea: "Yes",
// propertyType: "House",
// builtForm: "Detached",
// totalFloorArea: 60,
// tenure: "Rented (social)",
// yearBuilt: "1990",
// retrofitFeatures: [
// { feature: "Wall", description: "Cavity wall", rating: "Poor" },
// {
// feature: "Roof",
// description: "Flat, limited insulation (assumed)",
// rating: "Very poor",
// },
// { feature: "Windows", description: "Double glazing", rating: "Good" },
// { feature: "Heating", description: "Gas boiler", rating: "Good" },
// {
// feature: "Heating Control",
// description: "Programmer and appliance thermostats",
// rating: "Good",
// },
// {
// feature: "Hot Water",
// description: "Electric immersion, standard tariff",
// rating: "Good",
// },
// {
// feature: "Lighting",
// description: "Low energy lighting in all fixed outlets",
// rating: "Very good",
// },
// {
// feature: "Floor",
// description: "Suspended timber",
// rating: "Poor",
// },
// {
// feature: "Ventilation",
// description: "Natural",
// rating: "N/A",
// },
// {
// feature: "Solar Photo Voltaic",
// description: "Not present in the property",
// rating: "N/A",
// },
// {
// feature: "Solar Hot Water",
// description: "Heating is not solar powered",
// rating: "N/A",
// },
// {
// feature: "Wind Turbines",
// description: "No wind turbines present",
// rating: "N/A",
// },
// ],
// generalFeatures: [
// {
// feature: "Floor Height",
// description: 2.4,
// },
// {
// feature: "Number of heated rooms",
// description: 5,
// },
// {
// feature: "Heat loss corridor",
// description: "No",
// },
// {
// feature: "Heat loss corridor length",
// description: 0,
// },
// {
// feature: "Number of open fire places",
// description: 0,
// },
// {
// feature: "Number of extensions",
// description: 0,
// },
// {
// feature: "Floor level",
// description: "Ground",
// },
// {
// feature: "Number of storeys",
// description: 2,
// },
// {
// feature: "Mains gas available",
// description: "Yes",
// },
// {
// feature: "Energy tariff",
// description: "Standard",
// },
// ],
// heatingDemand: [
// {
// feature: "EPC primary energy consumption",
// description: "98 kWh/m2/year",
// },
// {
// feature: "EPC CO2 emissions",
// description: "2.8 tonnes/year",
// },
// {
// feature: "Elecrticity Supplier",
// description: "E.ON Energy",
// },
// {
// feature: "Gas Supplier",
// description: "British Gas",
// },
// {
// feature: "Meter reading total energy consumption",
// description: "108 kWh/m2/year",
// },
// {
// feature: "Meter reading electicity consumption",
// description: "22 kWh/m2/year",
// },
// {
// feature: "Meter reading gas consumption",
// description: "86 kWh/m2/year",
// },
// ],
// };
// const retrofitFeatures = conditionReportData.retrofitFeatures;
// const generalFeatures = conditionReportData.generalFeatures;
// const heatingDemand = conditionReportData.heatingDemand;
const generalFeatures = formatGeneralFeatures(
conditionReportData,
propertyMeta.propertyType
@ -271,6 +129,8 @@ export default async function PreAssessmentReport({
const retrofitFeatures = formatRetrofitFeatures(conditionReportData);
const heatingDemand = formatHeatDemandFeatures(conditionReportData);
return (
<div className="leading-loose tracking-wider">
<div className="flex py-8 text-lg">Pre Assessment Report</div>
@ -296,8 +156,8 @@ export default async function PreAssessmentReport({
<FeatureTable data={generalFeatures} columns={generalColumns} />
<div className="flex py-8 text-lg">Existing Property Features</div>
<FeatureTable data={retrofitFeatures} columns={retrofitColumns} />
{/* <div className="flex py-8 text-lg">Heating Demand</div>
<FeatureTable data={heatingDemand} columns={generalColumns} /> */}
<div className="flex py-8 text-lg">Heating Demand</div>
<FeatureTable data={heatingDemand} columns={generalColumns} />
</div>
);
}

View file

@ -103,47 +103,52 @@ export function formatRetrofitFeatures(
const retrofitFeatures: Feature[] = [
{
feature: "Wall",
description: conditionReportData.walls || "N/A",
description: conditionReportData.walls || "unknown",
rating: getRating(conditionReportData.wallsRating),
},
{
feature: "Roof",
description: conditionReportData.roof || "N/A",
description: conditionReportData.roof || "unknown",
rating: getRating(conditionReportData.roofRating),
},
{
feature: "Windows",
description: conditionReportData.windows || "N/A",
description: conditionReportData.windows || "unknown",
rating: getRating(conditionReportData.windowsRating),
},
{
feature: "Heating",
description: conditionReportData.heating || "N/A",
description: conditionReportData.heating || "unknown",
rating: getRating(conditionReportData.heatingRating),
},
{
feature: "Heating Control",
description: conditionReportData.heatingControls || "N/A",
description: conditionReportData.heatingControls || "unknown",
rating: getRating(conditionReportData.heatingControlsRating),
},
{
feature: "Hot Water",
description: conditionReportData.hotWater || "N/A",
description: conditionReportData.hotWater || "unknown",
rating: getRating(conditionReportData.hotWaterRating),
},
{
feature: "Lighting",
description: conditionReportData.lighting || "N/A",
description: conditionReportData.lighting || "unknown",
rating: getRating(conditionReportData.lightingRating),
},
{
feature: "Floor",
description: conditionReportData.floor || "N/A",
description: conditionReportData.floor || "unknown",
rating: getRating(conditionReportData.floorRating),
},
{
feature: "Ventilation",
description: conditionReportData.ventilation || "N/A",
description: conditionReportData.ventilation || "unknown",
rating: "N/A",
},
{
feature: "Main Fuel",
description: conditionReportData.mainfuel || "unknown",
rating: "N/A",
},
{
@ -173,3 +178,49 @@ export function formatRetrofitFeatures(
return retrofitFeatures;
}
export function formatHeatDemandFeatures(
conditionReportData: PropertyDetailsEpc
): GeneralFeature[] {
return [
{
feature: "EPC primary energy consumption",
description: conditionReportData.primaryEnergyConsumption
? `${conditionReportData.primaryEnergyConsumption} kWh/m2/year`
: "unknown",
},
{
feature: "EPC CO2 emissions",
description: conditionReportData.co2Emissions
? `${conditionReportData.co2Emissions} tonnes/year`
: "unknown",
},
// These features haven't been implemented yet
// {
// feature: "Electricity Supplier",
// description: conditionReportData.electricitySupplier || "unknown",
// },
// {
// feature: "Gas Supplier",
// description: conditionReportData.gasSupplier || "unknown",
// },
// {
// feature: "Meter reading total energy consumption",
// description: conditionReportData.totalEnergyConsumption
// ? `${conditionReportData.totalEnergyConsumption} kWh/m2/year`
// : "unknown",
// },
// {
// feature: "Meter reading electricity consumption",
// description: conditionReportData.electricityConsumption
// ? `${conditionReportData.electricityConsumption} kWh/m2/year`
// : "unknown",
// },
// {
// feature: "Meter reading gas consumption",
// description: conditionReportData.gasConsumption
// ? `${conditionReportData.gasConsumption} kWh/m2/year`
// : "unknown",
// },
];
}

View file

@ -17,7 +17,7 @@ export const getRating = (rating: number | null): Rating => {
5: "Very good",
};
return ratingMap[rating as 1 | 2 | 3 | 4 | 5]; // You can assert that rating is one of these values since you've already checked it
return ratingMap[rating as 1 | 2 | 3 | 4 | 5] as Rating; // You can assert that rating is one of these values since you've already checked it
};
export const serializeBigInt = (_: any, value: any): string | any => {