Skip to content
Snippets Groups Projects
Commit 8f1ea3f0 authored by Tor-Einar Skog's avatar Tor-Einar Skog
Browse files

Added support for field observations from IPM Decisions

parent d5feaa49
No related branches found
No related tags found
No related merge requests found
......@@ -19,7 +19,6 @@
package no.nibio.vips.core;
import java.util.HashSet;
import java.util.Set;
import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;
......@@ -53,6 +52,5 @@ public class VIPSCoreApplication extends Application
private void addRestResourceClasses(Set<Class<?>> resources) {
resources.add(no.nibio.vips.core.config.JacksonConfig.class);
resources.add(no.nibio.vips.core.service.ModelResourceImpl.class);
}
}
\ No newline at end of file
......@@ -45,10 +45,9 @@ import no.nibio.vips.model.factory.NoSuchModelException;
/**
* The available resources in this system
* @copyright 2013 {@link http://www.nibio.no NIBIO}
* @copyright 2020 {@link http://www.nibio.no NIBIO}
* @author Tor-Einar Skog <tor-einar.skog@nibio.no>
*/
//@Path("")
public class ModelResourceImpl implements ModelResource{
@Context
......@@ -317,11 +316,19 @@ public class ModelResourceImpl implements ModelResource{
try
{
DataTransformer dt = new DataTransformer();
config.setConfigParameter("observations", dt.getVIPSWeatherData(config.getWeatherData()));
if(config.getWeatherData() != null)
{
config.setConfigParameter("observations", dt.getVIPSWeatherData(config.getWeatherData()));
}
config.setConfigParameter("pestObservations", dt.getVIPSPestObservations(
(List) config.getConfigParameter("fieldObservations"),
(List) config.getConfigParameter("fieldObservationQuantifications")
)
);
Model calledModel = ModelFactory.getInstance().getModelInstance(modelId);
calledModel.setConfiguration(config);
List<Result> results = calledModel.getResult();
return Response.ok().entity(dt.getIPMDecisionsModelOutput(results)).build();
return Response.ok().entity(dt.getIPMDecisionsModelOutput(results)).build();
}
catch(Exception ex)
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment