Skip to content

Commit

Permalink
fixed etl
Browse files Browse the repository at this point in the history
  • Loading branch information
Numero7 committed Jan 23, 2025
1 parent b8b4062 commit 26a95f7
Showing 1 changed file with 3 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,8 @@

import static fr.gouv.monprojetsup.data.Constants.LAS_CONSTANT;
import static fr.gouv.monprojetsup.data.etl.loaders.DataSources.RESUMES_MPS_RESUME_FORMATION;
import static fr.gouv.monprojetsup.data.etl.loaders.DataSources.RESUMES_MPS_RESUME_FORMATION_MOS;
import static fr.gouv.monprojetsup.data.etl.loaders.DataSources.RESUMES_MPS_RESUME_KEY;
import static fr.gouv.monprojetsup.data.etl.loaders.DataSources.RESUMES_MPS_RESUME_TYPE_FORMATION;
import static fr.gouv.monprojetsup.data.etl.loaders.DataSources.RESUMES_MPS_RESUME_TYPE_FORMATION_MOS;

public class DescriptifsLoader {
public static @NotNull DescriptifsFormationsMetiers loadDescriptifs(
Expand Down Expand Up @@ -73,9 +71,6 @@ private static void addMpsdescriptifs(DescriptifsFormationsMetiers descriptifs,
val lines = CsvTools.readCSV(
sources.getSourceDataFilePath(DataSources.RESUMES_MPS_PATH),
',');
String keyFlFr;
String keyDescFormation = RESUMES_MPS_RESUME_TYPE_FORMATION;
String keyDescFiliere = RESUMES_MPS_RESUME_FORMATION;
String keyTypeFor = "code type formation";

Map<String, String> resumesTypesformations = new HashMap<>();
Expand All @@ -86,13 +81,10 @@ private static void addMpsdescriptifs(DescriptifsFormationsMetiers descriptifs,
for (val line : lines) {
val frCod = line.get(keyTypeFor);
val descFormation = line.get(RESUMES_MPS_RESUME_TYPE_FORMATION);
val descFormationMos = line.get(RESUMES_MPS_RESUME_TYPE_FORMATION_MOS);
if(descFormation == null || descFormationMos == null) {
if(descFormation == null) {
throw new RuntimeException("No description for " + frCod);
}
if (!frCod.isBlank() && !descFormationMos.isBlank()) {
resumesTypesformations.put(frCod, descFormationMos.trim());
} else if (!frCod.isBlank() && !descFormation.isBlank()) {
if (!frCod.isBlank() && !descFormation.isBlank()) {
resumesTypesformations.put(frCod, descFormation.trim());
}
}
Expand All @@ -110,10 +102,7 @@ private static void addMpsdescriptifs(DescriptifsFormationsMetiers descriptifs,
String frcod = line.getOrDefault(keyTypeFor, "");

String descForm = resumesTypesformations.getOrDefault(frcod, "");
String descFiliere = line.get(RESUMES_MPS_RESUME_FORMATION_MOS).trim();
if(descFiliere.isBlank()) {
descFiliere = line.get(RESUMES_MPS_RESUME_FORMATION).trim();
}
String descFiliere = line.get(RESUMES_MPS_RESUME_FORMATION).trim();

var descriptif = descriptifs.keyToDescriptifs().computeIfAbsent(flfrcod, z -> new DescriptifFormation(line));
if (descriptif.getMultiUrls() == null) descriptif.setMultiUrls(new HashSet<>());
Expand Down

0 comments on commit 26a95f7

Please sign in to comment.