Skip to content

Commit

Permalink
Improve english
Browse files Browse the repository at this point in the history
  • Loading branch information
alicela committed Oct 23, 2024
1 parent 70a0e33 commit d052d5a
Showing 1 changed file with 23 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,29 @@
import fr.insee.bpm.metadata.reader.lunatic.LunaticReader;
import fr.insee.genesis.Constants;
import fr.insee.genesis.controller.adapter.LunaticXmlAdapter;
import fr.insee.genesis.controller.dto.SurveyUnitSimplified;
import fr.insee.genesis.controller.dto.CampaignWithQuestionnaire;
import fr.insee.genesis.controller.dto.QuestionnaireWithCampaign;
import fr.insee.genesis.controller.dto.SurveyUnitDto;
import fr.insee.genesis.domain.model.surveyunit.SurveyUnitModel;
import fr.insee.genesis.domain.service.surveyunit.SurveyUnitQualityService;
import fr.insee.genesis.domain.service.volumetry.VolumetryLogService;
import fr.insee.genesis.controller.dto.SurveyUnitId;
import fr.insee.genesis.controller.dto.SurveyUnitSimplified;
import fr.insee.genesis.controller.sources.xml.LunaticXmlCampaign;
import fr.insee.genesis.controller.sources.xml.LunaticXmlDataParser;
import fr.insee.genesis.controller.sources.xml.LunaticXmlDataSequentialParser;
import fr.insee.genesis.controller.sources.xml.LunaticXmlSurveyUnit;
import fr.insee.genesis.controller.utils.ControllerUtils;
import fr.insee.genesis.controller.dto.CampaignWithQuestionnaire;
import fr.insee.genesis.domain.model.surveyunit.CollectedVariable;
import fr.insee.genesis.domain.model.surveyunit.Mode;
import fr.insee.genesis.controller.dto.QuestionnaireWithCampaign;
import fr.insee.genesis.controller.dto.SurveyUnitId;
import fr.insee.genesis.domain.model.surveyunit.SurveyUnitModel;
import fr.insee.genesis.domain.model.surveyunit.Variable;
import fr.insee.genesis.domain.ports.api.SurveyUnitApiPort;
import fr.insee.genesis.domain.service.surveyunit.SurveyUnitQualityService;
import fr.insee.genesis.domain.service.volumetry.VolumetryLogService;
import fr.insee.genesis.exceptions.GenesisError;
import fr.insee.genesis.exceptions.GenesisException;
import fr.insee.genesis.exceptions.NoDataError;
import fr.insee.genesis.infrastructure.utils.FileUtils;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
Expand Down Expand Up @@ -57,8 +58,9 @@
import java.util.Set;
import java.util.stream.Stream;

@RequestMapping(path = "/response")
@RequestMapping(path = "/response" )
@Controller
@Tag(name = "Response services for interrogations", description = "A **response** is considered the entire set of data associated with an interrogation (idUE x idQuestionnaire). \n These data may have different state (collected, edited, external, ...) ")
@Slf4j
public class ResponseController {

Expand All @@ -80,7 +82,7 @@ public ResponseController(SurveyUnitApiPort surveyUnitService, SurveyUnitQuality
}

//SAVE
@Operation(summary = "Save one file of responses in Genesis Database with its path")
@Operation(summary = "Save one file of responses to Genesis Database, passing its path as a parameter")
@PutMapping(path = "/save/lunatic-xml/one-file")
public ResponseEntity<Object> saveResponsesFromXmlFile(@RequestParam("pathLunaticXml") String xmlFile,
@RequestParam(value = "pathSpecFile") String metadataFilePath,
Expand Down Expand Up @@ -115,7 +117,7 @@ public ResponseEntity<Object> saveResponsesFromXmlFile(@RequestParam("pathLunati
}
}

@Operation(summary = "Save multiples files in Genesis Database from campaign root folder")
@Operation(summary = "Save multiple files to Genesis Database from the campaign root folder")
@PutMapping(path = "/save/lunatic-xml")
public ResponseEntity<Object> saveResponsesFromXmlCampaignFolder(@RequestParam("campaignName") String campaignName,
@RequestParam(value = "mode", required = false) Mode modeSpecified,
Expand All @@ -137,7 +139,7 @@ public ResponseEntity<Object> saveResponsesFromXmlCampaignFolder(@RequestParam("
}

//SAVE ALL
@Operation(summary = "Save all files in Genesis Database (differential data folder only)")
@Operation(summary = "Save all files to Genesis Database (differential data folder only), regardless of the campaign")
@PutMapping(path = "/save/lunatic-xml/all-campaigns")
public ResponseEntity<Object> saveResponsesFromAllCampaignFolders(){
List<GenesisError> errors = new ArrayList<>();
Expand Down Expand Up @@ -168,16 +170,16 @@ public ResponseEntity<Object> saveResponsesFromAllCampaignFolders(){
}
}

@Operation(summary = "Write volumetries of each campaign in a folder")
@Operation(summary = "Record volumetrics of each campaign in a folder")
@PutMapping(path = "/save-volumetry/all-campaigns")
public ResponseEntity<Object> saveVolumetry() throws IOException {
volumetryLogService.writeVolumetries(surveyUnitService);
volumetryLogService.cleanOldFiles();
return ResponseEntity.ok("Volumetry saved");
return ResponseEntity.ok("Volumetric saved");
}

//DELETE
@Operation(summary = "Delete all responses of one questionnaire")
@Operation(summary = "Delete all responses associated with a questionnaire")
@DeleteMapping(path = "/delete-responses/by-questionnaire")
public ResponseEntity<Object> deleteAllResponsesByQuestionnaire(@RequestParam("idQuestionnaire") String idQuestionnaire) {
log.info("Try to delete all responses of questionnaire : {}", idQuestionnaire);
Expand All @@ -187,15 +189,15 @@ public ResponseEntity<Object> deleteAllResponsesByQuestionnaire(@RequestParam("i
}

//GET
@Operation(summary = "Retrieve responses with IdUE and IdQuestionnaire from Genesis Database")
@Operation(summary = "Retrieve responses for an interrogation, using IdUE and IdQuestionnaire from Genesis Database")
@GetMapping(path = "/get-responses/by-ue-and-questionnaire")
public ResponseEntity<List<SurveyUnitModel>> findResponsesByUEAndQuestionnaire(@RequestParam("idUE") String idUE,
@RequestParam("idQuestionnaire") String idQuestionnaire) {
List<SurveyUnitModel> responses = surveyUnitService.findByIdsUEAndQuestionnaire(idUE, idQuestionnaire);
return ResponseEntity.ok(responses);
}

@Operation(summary = "Retrieve responses with IdUE and IdQuestionnaire from Genesis Database with each latest state for each variable")
@Operation(summary = "Retrieve responses for an interrogation, using IdUE and IdQuestionnaire from Genesis Database with the latest value for each available state of every variable")
@GetMapping(path = "/get-responses/by-ue-and-questionnaire/latest-states")
public ResponseEntity<SurveyUnitDto> findResponsesByUEAndQuestionnaireLastestStates(
@RequestParam("idUE") String idUE,
Expand All @@ -204,7 +206,7 @@ public ResponseEntity<SurveyUnitDto> findResponsesByUEAndQuestionnaireLastestSta
return ResponseEntity.ok(response);
}

@Operation(summary = "Retrieve all responses of one questionnaire")
@Operation(summary = "Retrieve all responses (for all interrogations) of one questionnaire")
@GetMapping(path = "/get-responses/by-questionnaire")
public ResponseEntity<Path> findAllResponsesByQuestionnaire(@RequestParam("idQuestionnaire") String idQuestionnaire) {
log.info("Try to find all responses of questionnaire : {}", idQuestionnaire);
Expand All @@ -226,7 +228,7 @@ public ResponseEntity<Path> findAllResponsesByQuestionnaire(@RequestParam("idQue
return ResponseEntity.ok(filepath);
}

@Operation(summary = "Retrieve responses latest state with IdUE and IdQuestionnaire")
@Operation(summary = "Retrieve responses for an interrogation, using IdUE and IdQuestionnaire from Genesis Database. It returns only the latest value of each variable regardless of the state.")
@GetMapping(path = "/get-responses/by-ue-and-questionnaire/latest")
public ResponseEntity<List<SurveyUnitModel>> getLatestByUE(@RequestParam("idUE") String idUE,
@RequestParam("idQuestionnaire") String idQuestionnaire) {
Expand Down Expand Up @@ -258,7 +260,7 @@ public ResponseEntity<SurveyUnitSimplified> getLatestByUEOneObject(@RequestParam

@Operation(summary = "Retrieve all responses for a questionnaire and a list of UE",
description = "Return the latest state for each variable for the given ids and a given questionnaire.<br>" +
"For a given id the endpoint returns a document by collection mode(if there is more than one).")
"For a given id, the endpoint returns a single document that merges all collection modes (if there is more than one).")
@PostMapping(path = "/get-simplified-responses/by-ue-and-questionnaire/latest")
public ResponseEntity<List<SurveyUnitSimplified>> getLatestForUEList(@RequestParam("idQuestionnaire") String idQuestionnaire,
@RequestBody List<SurveyUnitId> idUEs) {
Expand Down Expand Up @@ -295,14 +297,14 @@ public ResponseEntity<List<SurveyUnitId>> getAllIdUEsByQuestionnaire(@RequestPar
return ResponseEntity.ok(responses);
}

@Operation(summary = "List sources used for a given questionnaire")
@Operation(summary = "List sources/modes used for a given questionnaire")
@GetMapping(path = "/get-modes/by-questionnaire")
public ResponseEntity<List<Mode>> getModesByQuestionnaire(@RequestParam("idQuestionnaire") String idQuestionnaire) {
List<Mode> modes = surveyUnitService.findModesByIdQuestionnaire(idQuestionnaire);
return ResponseEntity.ok(modes);
}

@Operation(summary = "List sources used for a given campaign")
@Operation(summary = "List sources/modes used for a given campaign")
@GetMapping(path = "/get-modes/by-campaign")
public ResponseEntity<List<Mode>> getModesByCampaign(@RequestParam("idCampaign") String idCampaign) {
List<Mode> modes = surveyUnitService.findModesByIdCampaign(idCampaign);
Expand Down

0 comments on commit d052d5a

Please sign in to comment.