Skip to content

Commit 8b9e84c

Browse files
committed
Merge remote-tracking branch 'origin/devFixUsualSurveyUnitId' into dev/combined-rawdata
2 parents f89d126 + b1efc20 commit 8b9e84c

File tree

67 files changed

+675
-253
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+675
-253
lines changed

.github/workflows/create-release.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ jobs:
6969
distribution: 'temurin'
7070
java-version: '21'
7171

72+
- name: install model filiere
73+
run: mvn install:install-file -Dfile="$(pwd)/libs/modelefiliere-2.1.0.jar" -DgroupId=fr.insee -DartifactId=modelefiliere -Dversion=2.1.0 -Dpackaging=jar -DgeneratePom=true
74+
7275
- name: Clone BPM
7376
uses: actions/checkout@v6
7477
with:

.github/workflows/docker.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ jobs:
2626
distribution: "temurin"
2727
java-version: "21"
2828

29+
- name: install model filiere
30+
run: mvn install:install-file -Dfile="$(pwd)/libs/modelefiliere-2.1.0.jar" -DgroupId=fr.insee -DartifactId=modelefiliere -Dversion=2.1.0 -Dpackaging=jar -DgeneratePom=true
31+
2932
- name: Clone BPM
3033
uses: actions/checkout@master
3134
with:

.github/workflows/maven.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ on:
1212
push:
1313
branches: [ "main" ]
1414
pull_request:
15-
branches: [ "main" ]
15+
types: [opened, reopened, synchronize]
1616

1717
jobs:
1818
build:
@@ -29,6 +29,9 @@ jobs:
2929
distribution: 'temurin'
3030
cache: maven
3131

32+
- name: install model filiere
33+
run: mvn install:install-file -Dfile="$(pwd)/libs/modelefiliere-2.1.0.jar" -DgroupId=fr.insee -DartifactId=modelefiliere -Dversion=2.1.0 -Dpackaging=jar -DgeneratePom=true
34+
3235
- name: Clone BPM
3336
uses: actions/checkout@master
3437
with:

.github/workflows/scheduled-version-update.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ jobs:
8585
fi
8686
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
8787
88+
- name: install model filiere
89+
run: mvn install:install-file -Dfile="$(pwd)/libs/modelefiliere-2.1.0.jar" -DgroupId=fr.insee -DartifactId=modelefiliere -Dversion=2.1.0 -Dpackaging=jar -DgeneratePom=true
90+
8891
- name: Clone BPM
8992
uses: actions/checkout@master
9093
with:
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<component name="ProjectRunConfigurationManager">
2+
<configuration default="false" name="Unit tests GENESIS" type="JUnit" factoryName="JUnit">
3+
<module name="genesis-api" />
4+
<option name="PACKAGE_NAME" value="fr.insee.genesis" />
5+
<option name="MAIN_CLASS_NAME" value="" />
6+
<option name="METHOD_NAME" value="" />
7+
<option name="TEST_OBJECT" value="directory" />
8+
<dir value="$PROJECT_DIR$/src/test/java/fr/insee/genesis" />
9+
<method v="2">
10+
<option name="Make" enabled="true" />
11+
</method>
12+
</configuration>
13+
</component>

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
# Changelog
2+
## 2.0.0 [TODO]
3+
### Changed
4+
- Use filière model
5+
26
## 1.13.0 [2025-12-04]
37
### Changed
48
- New raw data process endpoint

libs/modelefiliere-2.1.0.jar

177 KB
Binary file not shown.

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<parent>
1212
<groupId>org.springframework.boot</groupId>
1313
<artifactId>spring-boot-starter-parent</artifactId>
14-
<version>3.5.8</version>
14+
<version>3.5.9</version>
1515
</parent>
1616

1717
<properties>
@@ -101,7 +101,7 @@
101101
<dependency>
102102
<groupId>fr.insee</groupId>
103103
<artifactId>modelefiliere</artifactId>
104-
<version>2.0.0</version>
104+
<version>2.1.0</version>
105105
</dependency>
106106
<dependency>
107107
<groupId>com.networknt</groupId>

src/main/java/fr/insee/genesis/controller/rest/responses/RawResponseController.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -237,15 +237,15 @@ public ResponseEntity<String> processJsonRawData(
237237
}
238238
}
239239

240-
@Operation(summary = "Process raw data of a questionnaire")
241-
@PostMapping(path = "/responses/raw/lunatic-json/{collectionInstrumentId}/process")
240+
@Operation(summary = "Process raw data of a questionnaire (old raw model)")
241+
@PostMapping(path = "/responses/raw/lunatic-json/{questionnaireId}/process")
242242
@PreAuthorize("hasRole('SCHEDULER')")
243243
public ResponseEntity<String> processJsonRawData(
244-
@PathVariable String collectionInstrumentId
244+
@PathVariable String questionnaireId
245245
) {
246-
log.info("Try to process raw JSON datas for questionnaire {}",collectionInstrumentId);
246+
log.info("Try to process raw JSON datas for questionnaire {}",questionnaireId);
247247
try {
248-
DataProcessResult result = lunaticJsonRawDataApiPort.processRawData(collectionInstrumentId);
248+
DataProcessResult result = lunaticJsonRawDataApiPort.processRawData(questionnaireId);
249249
return result.formattedDataCount() == 0 ?
250250
ResponseEntity.ok("%d document(s) processed".formatted(result.dataCount()))
251251
: ResponseEntity.ok("%d document(s) processed, including %d FORMATTED after data verification"

src/main/java/fr/insee/genesis/controller/rest/responses/ResponseController.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,11 @@
5353

5454
import javax.xml.parsers.ParserConfigurationException;
5555
import javax.xml.stream.XMLStreamException;
56-
import java.io.*;
56+
import java.io.File;
57+
import java.io.FileInputStream;
58+
import java.io.FileNotFoundException;
59+
import java.io.IOException;
60+
import java.io.InputStream;
5761
import java.net.MalformedURLException;
5862
import java.nio.file.Files;
5963
import java.nio.file.Path;
@@ -296,6 +300,7 @@ public ResponseEntity<SurveyUnitSimplified> getLatestByInterrogationOneObject(@R
296300
"For a given id, the endpoint returns a document by collection mode (if there is more than one).")
297301
@PostMapping(path = "/simplified/by-list-interrogation-and-collection-instrument/latest")
298302
@PreAuthorize("hasRole('USER_KRAFTWERK')")
303+
//TODO move logic and unit test to surveyUnitService (also extract some methods instead of multiple lambdas)
299304
public ResponseEntity<List<SurveyUnitSimplified>> getLatestForInterrogationListAndCollectionInstrument(
300305
@RequestParam("collectionInstrumentId") String collectionInstrumentId,
301306
@RequestBody List<InterrogationId> interrogationIds)
@@ -307,16 +312,20 @@ public ResponseEntity<List<SurveyUnitSimplified>> getLatestForInterrogationListA
307312
modes.forEach(mode -> {
308313
List<VariableModel> outputVariables = new ArrayList<>();
309314
List<VariableModel> outputExternalVariables = new ArrayList<>();
315+
List<String> usualSurveyUnitIds = new ArrayList<>();
310316
responses.stream().filter(rep -> rep.getMode().equals(mode)).forEach(response -> {
311317
outputVariables.addAll(response.getCollectedVariables());
312318
outputExternalVariables.addAll(response.getExternalVariables());
319+
if(response.getUsualSurveyUnitId() != null){
320+
usualSurveyUnitIds.add(response.getUsualSurveyUnitId());
321+
}
313322
});
314323
if (!outputVariables.isEmpty() || !outputExternalVariables.isEmpty()) {
315324
results.add(SurveyUnitSimplified.builder()
316325
.collectionInstrumentId(responses.getFirst().getCollectionInstrumentId())
317326
.campaignId(responses.getFirst().getCampaignId())
318-
.interrogationId(responses.getFirst().getInterrogationId())
319-
.usualSurveyUnitId(responses.getFirst().getUsualSurveyUnitId())
327+
.interrogationId(interrogationId.getInterrogationId())
328+
.usualSurveyUnitId(!usualSurveyUnitIds.isEmpty() ? usualSurveyUnitIds.getFirst() : null)
320329
.mode(mode)
321330
.variablesUpdate(outputVariables)
322331
.externalVariables(outputExternalVariables)

0 commit comments

Comments
 (0)