Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Link between Genesis and Kraftwerk #35

Merged
merged 10 commits into from
Dec 15, 2023
Merged

Link between Genesis and Kraftwerk #35

merged 10 commits into from
Dec 15, 2023

Conversation

loichenninger
Copy link
Contributor

No description provided.

Copy link
Contributor

@alexisszmundy alexisszmundy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Petit code smell mais OK sinon

data.getQuestionnaires().add(questionnaire);
}

// /* Step 2.2 : Get paradata for the survey */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indiquer pourquoi c'est commenté ou supprimer (Sonar aime pas trop les blocs de code commenté)

vtlExecute.convertToVtlDataset(data, dataMode, vtlBindings);
}

// private void parseParadata(ModeInputs modeInputs, SurveyRawData data) throws NullException {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Idem

@alexisszmundy
Copy link
Contributor

La PR affecte la branche main, on envoie pas sur la develop avant ?

return response.getBody() != null ? Arrays.asList(response.getBody()) : null;
}

public List<SurveyUnitUpdateLatest> getUEsLatestState(String idQuestionnaire, List<SurveyUnitId> idUEs) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change name to be coherent with "POST"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As we are getting a list of SurveyUnit, we decided to keep the get at the beginning of the method name.

@@ -84,6 +95,18 @@ public ResponseEntity<String> mainLunaticOnly(
return ResponseEntity.ok(inDirectoryParam);
}

@PutMapping(value = "/main/genesis")
@Operation(operationId = "mainGenesis", summary = "${summary.mainGenesis}", description = "${description.mainGenesis}")
public ResponseEntity<String> mainGenesis(@RequestParam("idQuestionnaire") String idQuestionnaire) throws KraftwerkException, IOException {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kraftwerk exception is catched

}

public static Mode getEnumFromModeName(String modeName) {
for (Mode mode : Mode.values()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


private String idQuest;
private String idCampaign;
private String idUE;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

String idUE or SurveyUnitId ?

}

public static Mode getEnumFromModeName(String modeName) {
for (Mode mode : Mode.values()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

private Path convertToUserPath(String userField) {
if (userField != null && !"null".equals(userField) && !"".equals(userField)) {
return Paths.get(userField);
} else {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comment

try {
if (userField.startsWith("http")) {
return new URL(userField);
} else {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comment

return null;
}

private Path convertToPath(String userField) throws KraftwerkException {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

convertToPath, convertToUrl in the other class = maybe a class utils

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved the two methods in FileUtils

try {
variables = DDIReader.getVariablesFromDDI(modeInputsGenesis.getDdiUrl());
} catch (KraftwerkException e) {
log.error(e.getMessage());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe throw exception if no DDI ?

}

public Path getInDirectory(String inDirectoryParam) {
Path inDirectory = Paths.get(defaultDirectory, "in", inDirectoryParam);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"in" can be a constant

@alicela alicela merged commit 5e2b708 into main Dec 15, 2023
1 check passed
@alicela alicela deleted the devGenesisData branch December 15, 2023 08:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants