@@ -4,6 +4,7 @@ import { Component, OnInit } from '@angular/core';
44import { Router } from '@angular/router' ;
55import { HttpService } from '../http.service' ;
66import { PredictHouseInfo } from '../models/predict-house-info' ;
7+ import { AddressInfo } from '../models/address-info' ;
78import { library } from '@fortawesome/fontawesome-svg-core' ;
89import { MapsAPILoader } from '@agm/core' ;
910import { faImage , faClock , faBed , faCar , faBuilding , faDoorOpen , faFire , faHome , faSwimmer , faBath } from '@fortawesome/free-solid-svg-icons' ;
@@ -32,7 +33,9 @@ export class PredictOutputComponent implements OnInit {
3233 averageSalePrice :string ;
3334 showData :boolean ;
3435 showMessage :boolean ;
35- model :any ;
36+
37+ model : PredictHouseInfo ;
38+ addressModel : AddressInfo ;
3639
3740 constructor ( private _router :Router , private _httpService :HttpService ) {
3841 this . showData = false ;
@@ -45,21 +48,34 @@ export class PredictOutputComponent implements OnInit {
4548 this . fireplace = '' ;
4649 this . garage = '' ;
4750 this . bath = '' ;
48- this . model = [ ] ;
4951 this . salePrice = '' ;
5052 this . averageSalePrice = '' ;
53+
54+ this . model = new PredictHouseInfo ( '' , 'Select BldgType' , 'Select HouseStyle' , '' , '' , '' , '' , '' , '' , 'Select KitchenQual' , '' , 'Select Heating' , 'Select HeatingQC' , 'Select CentralAir' , 'Select Electrical' , 'Select RoofStyle' , 'Select ExterCond' , 'Select Foundation' , 'Select BsmtCond' , '' , 'Select PoolQC' , '' , 'Select FireplaceQu' , 'Select GarageType' , 'Select GarageFinish' , '' , 'Select GarageCond' , 'Select Fence' , '' , '' ) ;
55+
56+ this . addressModel = new AddressInfo ( '' , ' ' , '' , '' , '' , '' ) ;
57+
5158 }
5259
5360
5461 ngOnInit ( ) {
5562 this . showData = false ;
5663 this . showMessage = true ;
57- this . model = JSON . parse ( localStorage . getItem ( "predictOutput" ) ) ;
64+
65+ this . model = ( JSON . parse ( localStorage . getItem ( 'prediction_data' ) ) ) ;
66+
67+ if ( localStorage . getItem ( 'ml-model' ) === 'db2' ) {
68+ this . salePrice = ( JSON . parse ( localStorage . getItem ( 'predicted_value' ) ) [ 'salePrice' ] ) ;
69+ } else {
70+ this . salePrice = ( JSON . parse ( localStorage . getItem ( 'predicted_value' ) ) [ 'value' ] ) ;
71+ }
72+
73+ this . addressModel = ( JSON . parse ( localStorage . getItem ( 'address' ) ) ) ;
5874 this . getGeoCode ( ) ;
5975 }
6076
6177 getGeoCode ( ) {
62- var geo = this . _httpService . getCoordinates ( this . model [ 'address1' ] , this . model [ 'city' ] , this . model [ 'state' ] , this . model [ 'zipcode' ] ) ;
78+ var geo = this . _httpService . getCoordinates ( this . addressModel [ 'address1' ] , this . addressModel [ 'city' ] , this . addressModel [ 'state' ] , this . addressModel [ 'zipcode' ] ) ;
6379 geo . subscribe ( data => {
6480 console . log ( data ) ;
6581 if ( data [ 'success' ] != 1 ) {
0 commit comments