diff --git a/docs/ecolyo/functionalities/profile_type.md b/docs/ecolyo/functionalities/profile_type.md index 4003506d65d32422ed54b980d98383076f00956a..00bdeef20c8cecc9c12cbd5bf9f4518154c59dae 100644 --- a/docs/ecolyo/functionalities/profile_type.md +++ b/docs/ecolyo/functionalities/profile_type.md @@ -1,4 +1,4 @@ -This section explains the profileType creation process in order to make different comparisons between the actual user's consumtion and its profile type. +This section explains the profileType creation process in order to make different comparisons between the actual user's consumption and its profile type. ## Profile type data @@ -8,19 +8,21 @@ The profileType data are stored in the profile doctype and includes the followin { housingType: HousingType constructionYear: ConstructionYear - area: number + area: string occupantsNumber: number outsideFacingWalls: OutsideFacingWalls floor: Floor heating: IndividualOrCollective - hotWater: IndividualOrCollective coldWater: IndividualOrCollective - individualInsulationWork: IndividualInsulationWork - facilitiesInstallation: FacilitiesInstallation - hotWaterEquipment: HotWaterEquipment[] - warmingFluid: FluidType | null + hotWater: IndividualOrCollective + individualInsulationWork: IndividualInsulationWork[] + hasInstalledVentilation: ThreeChoicesAnswer + hasReplacedHeater: ThreeChoicesAnswer + hotWaterEquipment: HotWaterEquipment + warmingFluid: WarmingType | null hotWaterFluid: FluidType | null cookingFluid: FluidType + updateDate: DateTime } ``` @@ -33,7 +35,45 @@ Here is the flow of questions:  -## Profile type methods + +## Profile types handling over time +A user can have many profileTypes, Ecolyo takes into account that one can move from his home, have more occupants, start renovating works and so on. + +That's why a profileType is only active for a given time period, this is how its time logic works. + +#### No filled profileType + +A default profileType is loaded in redux to operate basic operations. When the user looks at its analysis or options, ecolyo suggest user to fill a more accurate profileType. + +#### First profileType + +The profileType will follow the form logic above (see ProfileType form section). *updateDate* field will be the current month and year. +Since this profileType will be the only one in database, *getProfileType()* method will always return it, therefore it will be used for all past time period on analysis. + +#### Following profileTypes + +Each new profileType form will show a calendar picking section at the end of the form. +By default, current month and year will be selected. + +If current year is not yet completed (december not reached), month dropdown menu will only propose past and present months for this year. + +When finishing, before the new profileType is saved. Checks if other profileTypes exist on the period between selected month/year and present day. +- If profileTypes are found, they are deleted (newest profileType always prevails on older ones, so that user had forgotten to fill some informations before, this new profiletype will be more accurate). Then save profileType on given month/year. +- If no other profileTypes are found, save profileType on given month/year. + +## Profile type entity service + +Here you can see the different methods provided by the profileType service. These methods allows to calculate the average consumption depending on the information gathered in user's profileType. + +| Method | Description | +| ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------- | +| getProfileType(date?: DateTime) : Promise-ProfileType, null | Returns a profiletype closest to the given param date. When no param date, returns most recent profiletype | +| getAllProfileTypes(timePeriod?: TimePeriod) : Promise-ProfileType[], null | Returns all profiletypes for given time period, if no param returns all profiletypes | +| updateProfileType(attributes: Partial-ProfileType): Promise-ProfileType, null | Saves profiletype in couchdb | +| deleteProfileTypes(profileTypes: ProfileType[]): Promise-boolean | Delete array of profileTypes | +| parseProfileTypeEntityToProfileType(profileTypeEntity: ProfileType): ProfileType | Retrieves ProfileType from the ProfileTypeEntity | + +## Profile type service Here you can see the different methods provided by the profileType service. These methods allows to calculate the average consumption depending on the information gathered in user's profileType. @@ -41,7 +81,7 @@ Here you can see the different methods provided by the profileType service. Thes | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------- | | getMonthlyForecast(month: number) : Promise-MonthlyForecast | Used to get the monthly forecast for a given month | | getFluidForecast(fluidType: FluidType, month: number) : Promise-FluidForecast | Used to get the monthly forecast for a given FluidType | -| getDetailsMonthlyForecast(fluidType: FluidType, month: number): Promise-DetailsMonthlyForecast | Used to get the details of a fluidForecast. For each fluid return the related consumptions. | +| getDetailsMonthlyForecast(fluidType: FluidType, month: number): Promise-DetailsMonthlyForecast | Used to get the details of a fluidForecast. For each fluid return the related consumptions | | getMonthColdWaterConsumption(month: number): number | Returns the cold water consumption in L for a given month | | getMonthElectricSpecificConsumption(month: number): number | Returns the electric specific consumption in kWh for a given month | | getMonthCookingConsumption(month: number): number | Returns the cooking consumption in kWh for a given month |