aboutsummaryrefslogtreecommitdiff
path: root/backend/api
diff options
context:
space:
mode:
Diffstat (limited to 'backend/api')
-rw-r--r--backend/api/api/Controllers/ExperimentController.cs14
-rw-r--r--backend/api/api/Controllers/PredictorController.cs12
-rw-r--r--backend/api/api/Models/Experiment.cs2
-rw-r--r--backend/api/api/Models/Predictor.cs2
-rw-r--r--backend/api/api/Services/IMlConnectionService.cs2
5 files changed, 30 insertions, 2 deletions
diff --git a/backend/api/api/Controllers/ExperimentController.cs b/backend/api/api/Controllers/ExperimentController.cs
index 2a2db31e..190c0e01 100644
--- a/backend/api/api/Controllers/ExperimentController.cs
+++ b/backend/api/api/Controllers/ExperimentController.cs
@@ -15,11 +15,15 @@ namespace api.Controllers
private readonly IExperimentService _experimentService;
private IJwtToken jwtToken;
+ private readonly IMlConnectionService _mlConnectionService;
+ private readonly IFileService _fileService;
- public ExperimentController(IExperimentService experimentService, IConfiguration configuration, IJwtToken Token)
+ public ExperimentController(IExperimentService experimentService, IConfiguration configuration, IJwtToken Token, IMlConnectionService mlConnectionService, IFileService fileService)
{
_experimentService = experimentService;
jwtToken = Token;
+ _mlConnectionService = mlConnectionService;
+ _fileService = fileService;
}
[HttpPost("add")]
@@ -35,6 +39,14 @@ namespace api.Controllers
uploaderId = jwtToken.TokenToId(parameter);
if (uploaderId == null)
return null;
+ else
+ {
+ FileModel fileModel = _fileService.getFile(experiment.fileId);
+ experiment.isPreProcess = false;
+ _experimentService.Create(experiment);
+ _mlConnectionService.PreProcess(experiment, fileModel.path);
+ return Ok();
+ }
}
else
return BadRequest();
diff --git a/backend/api/api/Controllers/PredictorController.cs b/backend/api/api/Controllers/PredictorController.cs
index 161271e2..20d8f962 100644
--- a/backend/api/api/Controllers/PredictorController.cs
+++ b/backend/api/api/Controllers/PredictorController.cs
@@ -15,11 +15,16 @@ namespace api.Controllers
{
private readonly IPredictorService _predictorService;
private IJwtToken jwtToken;
+ private readonly IMlConnectionService _mlConnectionService;
+ private readonly IFileService _fileService;
- public PredictorController(IPredictorService predictorService, IConfiguration configuration, IJwtToken Token)
+ public PredictorController(IPredictorService predictorService, IConfiguration configuration, IJwtToken Token, IMlConnectionService mlConnectionService, IFileService fileService)
{
_predictorService = predictorService;
jwtToken = Token;
+ _mlConnectionService = mlConnectionService;
+ _fileService = fileService;
+
}
// GET: api/<PredictorController>/mypredictors
@@ -183,6 +188,11 @@ namespace api.Controllers
_predictorService.Create(predictor);
return CreatedAtAction(nameof(Get), new { id = predictor._id }, predictor);
+ FileModel fileModel = _fileService.getFile(predictor.fileId);
+ predictor.isPreProcess = false;
+ _predictorService.Create(predictor);
+ _mlConnectionService.PreProcess(predictor, fileModel.path);
+ return Ok();
}
}
diff --git a/backend/api/api/Models/Experiment.cs b/backend/api/api/Models/Experiment.cs
index 6de3f169..903d6dae 100644
--- a/backend/api/api/Models/Experiment.cs
+++ b/backend/api/api/Models/Experiment.cs
@@ -18,6 +18,8 @@ namespace api.Models
public float randomTestSetDistribution { get; set; }
public string nullValues { get; set; }
public NullValues[] nullValuesReplacers { get; set; }
+ public string fileId { get; set; }
+ public bool isPreProcess { get; set; }
}
}
diff --git a/backend/api/api/Models/Predictor.cs b/backend/api/api/Models/Predictor.cs
index 5fd2aa09..d4ee9fa7 100644
--- a/backend/api/api/Models/Predictor.cs
+++ b/backend/api/api/Models/Predictor.cs
@@ -18,6 +18,8 @@ namespace api.Models
public bool accessibleByLink { get; set; }
public DateTime dateCreated { get; set; }
public string experimentId { get; set; }
+ public string fileId { get; set; }
+ public bool isPreProcess { get; set; }
}
}
diff --git a/backend/api/api/Services/IMlConnectionService.cs b/backend/api/api/Services/IMlConnectionService.cs
index ea73fb0f..8d7e207d 100644
--- a/backend/api/api/Services/IMlConnectionService.cs
+++ b/backend/api/api/Services/IMlConnectionService.cs
@@ -7,6 +7,8 @@ namespace api.Services
{
Task<string> SendModelAsync(object model, object dataset);
Task PreProcess(Dataset dataset, string filePath);
+ Task PreProcess(Experiment experiment, string filePath);
+ Task PreProcess(Predictor predictor, string filePath);
//Task<Dataset> PreProcess(Dataset dataset, byte[] file, string filename);
}
} \ No newline at end of file