KWB-R / fhpredict

R Package for the Project Flusshygiene
https://kwb-r.github.io/fhpredict
MIT License
2 stars 0 forks source link

Error when calling prediction #66

Closed ff6347 closed 4 years ago

ff6347 commented 4 years ago

When I make a call to predction function predict_quality for spot 41 user 9 I get the following response:

{"event":"response","payload":{"data":{},"success":[false],"message":["Error : NAs are not allowed in 'newdata'.\n"]},"sessionID":"5a7ba7a0-a6a9-44ec-a827-81b5d9fb1304"}

hsonne commented 4 years ago

I can reproduce the error and investigate it now...

hsonne commented 4 years ago

Seems to work now. I did the following changes:

> fhpredict::predict_quality(9, 41)
Reading all models from the database ... ok. (0.39s) 
Reading model with id = 17 from the database ... ok. (0.10s) 
Getting URLs to Radolan files between 2020-04-03 and 2020-04-10 ... ok. (2.02s) 
Reading rain data from database ... ok. (0.68s) 
Importing rain data block 1/1 ... 
[...]
Reading rain data from database ... ok. (0.66s) 
Reading rain data from database ... ok. (0.62s) 
Reading discharge data from database ... ok. (0.14s) 
Reading irradiances data from database ... ok. (0.12s) 
Reading plant measurements data from database ... ok. (0.19s) 
Reading plant measurements data from database ... ok. (0.14s) 
Reading generic measurements data from database ... ok. (0.13s) 
Removing element 'hygiene_spot41' from list of data frames ... ok. (0.00s) 
Using 96 variables:
[...]
Reading timeseries data from database ... ok. (0.10s) 
$data
[1] 515 516
attr(,"updated")
integer(0)
attr(,"added")
[1] 515 516

$success
[1] TRUE

$message
[1] "2 predictions have been posted to the database (0 updates, 2 inserts)."

Predictions (for yesterday and today) have arrived:

> fhpredict::api_get_predictions(9, 41)
Reading timeseries data from database ... ok. (0.13s) 
   id   dateTime    prediction percentile2_5 percentile50 percentile90 percentile95 percentile97_5 credibleInterval2_5 credibleInterval97_5
1 459 2020-03-24 ausgezeichnet       1.09763     26.15416     194.0676     352.7113       622.2071                  NA                   NA
2 515 2020-04-08   ausreichend      67.91683    337.23761     887.3753    1216.8367      1611.5900                  NA                   NA
3 516 2020-04-09   ausreichend      62.09581    317.75635     860.4121    1149.4465      1432.6985                  NA                   NA
ff6347 commented 4 years ago

The NA value are an internal thing to the model, right? Nothing I can change?

hsonne commented 4 years ago

Yes, this is our part.