Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ private static SurveyUnitModel getStateDataFromSurveyUnit(LunaticXmlSurveyUnit s
.state(dataState)
.mode(mode)
.recordDate(Instant.now())
.fileDate(su.getFileDate())
.rawRecordDate(su.getFileDate())
.rawRecordDate(su.getRawRecordDate())
.build();

return getCollectedDataFromSurveyUnit(su, surveyUnitModel, variablesMap, dataState);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ private Document readXmlFile(Path filePath) throws IOException, SAXException, Ge
return document;
}

private LocalDateTime getFileDate(Path filePath) throws IOException {
private LocalDateTime getRawRecordDate(Path filePath) throws IOException {
BasicFileAttributes attr = Files.readAttributes(filePath, BasicFileAttributes.class);
return LocalDateTime.ofInstant(attr.lastModifiedTime().toInstant(), ZoneId.of("Europe/Paris"));
}
Expand All @@ -68,9 +68,8 @@ public LunaticXmlCampaign parseDataFile(Path filePath) throws GenesisException,
if (surveyUnit.getNodeType() == Node.ELEMENT_NODE) {
Element surveyUnitElement = (Element) surveyUnit;
LunaticXmlSurveyUnit lunaticXmlSurveyUnit = new LunaticXmlSurveyUnit();
LocalDateTime rawRecordDate = getFileDate(filePath);
LocalDateTime rawRecordDate = getRawRecordDate(filePath);
lunaticXmlSurveyUnit.setRawRecordDate(rawRecordDate);
lunaticXmlSurveyUnit.setFileDate(rawRecordDate);
lunaticXmlSurveyUnit.setId(surveyUnitElement.getElementsByTagName("Id").item(0).getFirstChild().getNodeValue());
lunaticXmlSurveyUnit.setQuestionnaireModelId(surveyUnitElement.getElementsByTagName("QuestionnaireModelId").item(0).getFirstChild().getNodeValue());
Node data = surveyUnitElement.getElementsByTagName("Data").item(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class LunaticXmlDataSequentialParser{


public LunaticXmlDataSequentialParser(final Path filePath, final InputStream stream) throws IOException, XMLStreamException {
this.rawRecordDate = getFileDate(filePath);
this.rawRecordDate = getRawRecordDate(filePath);

XMLInputFactory factory = XMLInputFactory.newInstance();
factory.setProperty(XMLInputFactory.SUPPORT_DTD, false);
Expand Down Expand Up @@ -90,7 +90,6 @@ public LunaticXmlSurveyUnit readNextSurveyUnit() throws XMLStreamException {
*/
private LunaticXmlSurveyUnit parseSurveyUnit(final XMLEventReader reader) throws XMLStreamException {
LunaticXmlSurveyUnit xmlSurveyUnit = new LunaticXmlSurveyUnit();
xmlSurveyUnit.setFileDate(this.rawRecordDate);
xmlSurveyUnit.setRawRecordDate(this.rawRecordDate);

LunaticXmlData data = new LunaticXmlData();
Expand Down Expand Up @@ -276,7 +275,7 @@ private List<LunaticXmlOtherData> readCalculatedOrExternal(XMLEventReader reader
return lunaticXmlOtherDataList;
}

private LocalDateTime getFileDate(Path filePath) throws IOException {
private LocalDateTime getRawRecordDate(Path filePath) throws IOException {
BasicFileAttributes attr = Files.readAttributes(filePath, BasicFileAttributes.class);
return LocalDateTime.ofInstant(attr.lastModifiedTime().toInstant(), ZoneId.of("Europe/Paris"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ public List<SurveyUnitModel> convertRawDataAndCollectEmptyModels(
.validationDate(payloadParser.getValidationDate(rawData))
.isCapturedIndirectly(payloadParser.getIsCapturedIndirectly(rawData))
.state(dataState)
.fileDate(rawData.recordDate())
.rawRecordDate(rawData.recordDate())
.recordDate(Instant.now())
.collectedVariables(new ArrayList<>())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ private SurveyUnitModel buildSurveyUnitModel(RawResponseModel rawResponseModel,
.validationDate(rawResponsePayloadParser.getValidationDate(rawResponseModel))
.isCapturedIndirectly(rawResponsePayloadParser.getIsCapturedIndirectly(rawResponseModel))
.state(dataState)
.fileDate(rawResponseModel.recordDate())
.rawRecordDate(rawResponseModel.recordDate())
.recordDate(Instant.now())
.collectedVariables(new ArrayList<>())
.externalVariables(new ArrayList<>())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ private static SurveyUnitModel createFormattedSurveyUnitModel(
.state(DataState.FORMATTED)
.mode(sampleSurveyUnitModel.getMode())
.recordDate(Instant.now().plusSeconds(1)) // Add 1 second to avoid same recordDate as COLLECTED
.fileDate(sampleSurveyUnitModel.getFileDate())
.rawRecordDate(sampleSurveyUnitModel.getRawRecordDate())
.collectedVariables(new ArrayList<>())
.externalVariables(new ArrayList<>())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public interface SurveyUnitDocumentMapper {
@Mapping(target = "mode", source = "mode", qualifiedByName = "mapMode")
SurveyUnitModel documentToModel(SurveyUnitDocument surveyUnit);

@Mapping(target = "fileDate", ignore = true)
SurveyUnitDocument modelToDocument(SurveyUnitModel surveyUnitModel);

@Mapping(target = "mode", source = "mode", qualifiedByName = "mapMode")
Expand All @@ -39,6 +40,10 @@ default void handleDeprecatedFields(SurveyUnitDocument doc,
model.setCollectionInstrumentId(doc.getQuestionnaireId());
}

if (model.getRawRecordDate() == null) {
model.setRawRecordDate(doc.getFileDate());
}

}

@Named("mapMode")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,13 +236,13 @@
void convert_shouldSetRecordDateCloseToNow() {
// GIVEN
LunaticXmlSurveyUnit su = buildSurveyUnit(List.of(collectedDataWithValue("VAR1", "val")));
Instant before = Instant.now();

Check warning on line 239 in src/test/java/fr/insee/genesis/controller/adapter/LunaticXmlAdapterTest.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Do not use the system clock in tests.

See more on https://sonarcloud.io/project/issues?id=InseeFr_genesis-api&issues=AZ6Xswdq3aHhgl0wbz-l&open=AZ6Xswdq3aHhgl0wbz-l&pullRequest=482

// WHEN
SurveyUnitModel collected = getCollected(LunaticXmlAdapter.convert(su, VARIABLES_MAP, MODE));

// THEN
Instant after = Instant.now();

Check warning on line 245 in src/test/java/fr/insee/genesis/controller/adapter/LunaticXmlAdapterTest.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Do not use the system clock in tests.

See more on https://sonarcloud.io/project/issues?id=InseeFr_genesis-api&issues=AZ6Xswdq3aHhgl0wbz-m&open=AZ6Xswdq3aHhgl0wbz-m&pullRequest=482
assertThat(collected.getRecordDate())
.isNotNull()
.isAfterOrEqualTo(before)
Expand All @@ -253,16 +253,14 @@
@DisplayName("Should map rawRecordDate from survey unit")
void convert_shouldMapRawRecordDate() {
// GIVEN
LocalDateTime rawRecordDate = LocalDateTime.of(2024, 1, 15, 10, 0);

Check warning on line 256 in src/test/java/fr/insee/genesis/controller/adapter/LunaticXmlAdapterTest.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use a "java.time.Month" enum constant instead of this int literal.

See more on https://sonarcloud.io/project/issues?id=InseeFr_genesis-api&issues=AZ6Xswdq3aHhgl0wbz-n&open=AZ6Xswdq3aHhgl0wbz-n&pullRequest=482
LunaticXmlSurveyUnit su = buildSurveyUnit(List.of(collectedDataWithValue("VAR1", "val")));
su.setFileDate(rawRecordDate);
su.setRawRecordDate(rawRecordDate);

// WHEN
SurveyUnitModel collected = getCollected(LunaticXmlAdapter.convert(su, VARIABLES_MAP, MODE));

// THEN
assertThat(collected.getFileDate()).isEqualTo(rawRecordDate);
assertThat(collected.getRawRecordDate()).isEqualTo(rawRecordDate);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
@BeforeEach
void setUp() {
mockMode = Mode.WEB;
now = LocalDateTime.of(2025, 6, 15, 10, 30);

Check warning on line 34 in src/test/java/fr/insee/genesis/domain/model/surveyunit/SurveyUnitModelTest.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use a "java.time.Month" enum constant instead of this int literal.

See more on https://sonarcloud.io/project/issues?id=InseeFr_genesis-api&issues=AZ6XswdO3aHhgl0wbz-k&open=AZ6XswdO3aHhgl0wbz-k&pullRequest=482
}

@Nested
Expand All @@ -55,7 +55,6 @@
assertThat(model.getQuestionnaireState()).isNull();
assertThat(model.getValidationDate()).isNull();
assertThat(model.getRecordDate()).isNull();
assertThat(model.getFileDate()).isNull();
assertThat(model.getRawRecordDate()).isNull();
assertThat(model.getCollectedVariables()).isNull();
assertThat(model.getExternalVariables()).isNull();
Expand Down Expand Up @@ -112,7 +111,6 @@
assertThat(model.getQuestionnaireState()).isEqualTo(RawResponseDto.QuestionnaireStateEnum.FINISHED);
assertThat(model.getValidationDate()).isEqualTo(now);
assertThat(model.getRecordDate()).isEqualTo(now.toInstant(ZoneOffset.UTC));
assertThat(model.getFileDate()).isEqualTo(now);
assertThat(model.getRawRecordDate()).isEqualTo(now);
assertThat(model.getCollectedVariables()).isEqualTo(collected);
assertThat(model.getExternalVariables()).isEqualTo(external);
Expand Down Expand Up @@ -164,7 +162,6 @@
assertThat(model.getQuestionnaireState()).isEqualTo(RawResponseDto.QuestionnaireStateEnum.FINISHED);
assertThat(model.getValidationDate()).isEqualTo(now);
assertThat(model.getRecordDate()).isEqualTo(now.toInstant(ZoneOffset.UTC));
assertThat(model.getFileDate()).isEqualTo(now);
assertThat(model.getRawRecordDate()).isEqualTo(now);
assertThat(model.getCollectedVariables()).isEqualTo(collected);
assertThat(model.getExternalVariables()).isEqualTo(external);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@
surveyUnitDocumentStatic.setUsualSurveyUnitId(USUAL_SURVEY_UNIT_ID);
surveyUnitDocumentStatic.setInterrogationId(INTERROGATION_ID);
surveyUnitDocumentStatic.setState("COLLECTED");
LocalDateTime rawRecordDate = LocalDateTime.of(2023, 1, 1, 0, 0, 0);

Check warning on line 53 in src/test/java/fr/insee/genesis/infrastructure/mapper/SurveyUnitDocumentMapperImplTest.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use a "java.time.Month" enum constant instead of this int literal.

See more on https://sonarcloud.io/project/issues?id=InseeFr_genesis-api&issues=AZ6XswZ-3aHhgl0wbz-c&open=AZ6XswZ-3aHhgl0wbz-c&pullRequest=482
surveyUnitDocumentStatic.setFileDate(rawRecordDate);
surveyUnitDocumentStatic.setRawRecordDate(rawRecordDate);

List<VariableDocument> documentExternalVariableList = new ArrayList<>();
Expand Down Expand Up @@ -90,7 +89,6 @@
deprecatedSurveyUnitDocumentStatic.setIdUE(ID_UE);
deprecatedSurveyUnitDocumentStatic.setInterrogationId(INTERROGATION_ID);
deprecatedSurveyUnitDocumentStatic.setState("COLLECTED");
deprecatedSurveyUnitDocumentStatic.setFileDate(rawRecordDate);
deprecatedSurveyUnitDocumentStatic.setRawRecordDate(rawRecordDate);

documentExternalVariableList = new ArrayList<>();
Expand Down Expand Up @@ -130,7 +128,7 @@
.state(DataState.COLLECTED)
.fileDate(rawRecordDate)
.rawRecordDate(rawRecordDate)
.recordDate(LocalDateTime.of(2024,1,1,0,0,0).toInstant(ZoneOffset.UTC))

Check warning on line 131 in src/test/java/fr/insee/genesis/infrastructure/mapper/SurveyUnitDocumentMapperImplTest.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use a "java.time.Month" enum constant instead of this int literal.

See more on https://sonarcloud.io/project/issues?id=InseeFr_genesis-api&issues=AZ6XswZ-3aHhgl0wbz-d&open=AZ6XswZ-3aHhgl0wbz-d&pullRequest=482
.externalVariables(externalVariableModelList)
.collectedVariables(collectedVariableList)
.build();
Expand All @@ -151,14 +149,13 @@
@DisplayName("Should convert survey unit document to model")
void shouldReturnModelFromDocument(){
SurveyUnitModel surveyUnit = surveyUnitDocumentMapperImplStatic.documentToModel(surveyUnitDocumentStatic);
LocalDateTime rawRecordDate = LocalDateTime.of(2023,1,1,0,0,0);

Check warning on line 152 in src/test/java/fr/insee/genesis/infrastructure/mapper/SurveyUnitDocumentMapperImplTest.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use a "java.time.Month" enum constant instead of this int literal.

See more on https://sonarcloud.io/project/issues?id=InseeFr_genesis-api&issues=AZ6XswZ-3aHhgl0wbz-e&open=AZ6XswZ-3aHhgl0wbz-e&pullRequest=482

Assertions.assertThat(surveyUnit.getMode()).isEqualTo(Mode.WEB);
Assertions.assertThat(surveyUnit.getInterrogationId()).isEqualTo(INTERROGATION_ID);
Assertions.assertThat(surveyUnit.getCollectionInstrumentId()).isEqualTo(COLLECTION_INSTRUMENT_ID);
Assertions.assertThat(surveyUnit.getUsualSurveyUnitId()).isEqualTo(USUAL_SURVEY_UNIT_ID);
Assertions.assertThat(surveyUnit.getState()).isEqualTo(DataState.COLLECTED);
Assertions.assertThat(surveyUnit.getFileDate()).isEqualTo(rawRecordDate);
Assertions.assertThat(surveyUnit.getRawRecordDate()).isEqualTo(rawRecordDate);

Assertions.assertThat(surveyUnit.getExternalVariables()).filteredOn(externalVariableModel ->
Expand All @@ -177,14 +174,13 @@
@DisplayName("Should convert deprecated survey unit document to model")
void shouldReturnModelFromDeprecatedDocument(){
SurveyUnitModel surveyUnit = surveyUnitDocumentMapperImplStatic.documentToModel(deprecatedSurveyUnitDocumentStatic);
LocalDateTime rawRecordDate = LocalDateTime.of(2023,1,1,0,0,0);

Check warning on line 177 in src/test/java/fr/insee/genesis/infrastructure/mapper/SurveyUnitDocumentMapperImplTest.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use a "java.time.Month" enum constant instead of this int literal.

See more on https://sonarcloud.io/project/issues?id=InseeFr_genesis-api&issues=AZ6XswZ-3aHhgl0wbz-f&open=AZ6XswZ-3aHhgl0wbz-f&pullRequest=482

Assertions.assertThat(surveyUnit.getMode()).isEqualTo(Mode.WEB);
Assertions.assertThat(surveyUnit.getInterrogationId()).isEqualTo(INTERROGATION_ID);
Assertions.assertThat(surveyUnit.getCollectionInstrumentId()).isEqualTo(QUESTIONNAIRE_ID);
Assertions.assertThat(surveyUnit.getUsualSurveyUnitId()).isEqualTo(ID_UE);
Assertions.assertThat(surveyUnit.getState()).isEqualTo(DataState.COLLECTED);
Assertions.assertThat(surveyUnit.getFileDate()).isEqualTo(rawRecordDate);
Assertions.assertThat(surveyUnit.getRawRecordDate()).isEqualTo(rawRecordDate);

Assertions.assertThat(surveyUnit.getExternalVariables()).filteredOn(externalVariableModel ->
Expand All @@ -203,13 +199,12 @@
@DisplayName("Should convert survey unit model to document")
void shouldReturnDocumentFromModel(){
SurveyUnitDocument surveyUnitDocument = surveyUnitDocumentMapperImplStatic.modelToDocument(surveyUnitStatic);
LocalDateTime rawRecordDate = LocalDateTime.of(2023,1,1,0,0,0);

Check warning on line 202 in src/test/java/fr/insee/genesis/infrastructure/mapper/SurveyUnitDocumentMapperImplTest.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use a "java.time.Month" enum constant instead of this int literal.

See more on https://sonarcloud.io/project/issues?id=InseeFr_genesis-api&issues=AZ6XswZ-3aHhgl0wbz-g&open=AZ6XswZ-3aHhgl0wbz-g&pullRequest=482

Assertions.assertThat(surveyUnitDocument.getMode()).isEqualTo(MODE);
Assertions.assertThat(surveyUnitDocument.getInterrogationId()).isEqualTo(INTERROGATION_ID);
Assertions.assertThat(surveyUnitDocument.getCollectionInstrumentId()).isEqualTo(COLLECTION_INSTRUMENT_ID);
Assertions.assertThat(surveyUnitDocument.getState()).isEqualTo("COLLECTED");
Assertions.assertThat(surveyUnitDocument.getFileDate()).isEqualTo(rawRecordDate);
Assertions.assertThat(surveyUnitDocument.getRawRecordDate()).isEqualTo(rawRecordDate);

Assertions.assertThat(surveyUnitDocument.getExternalVariables()).filteredOn(externalVariableDocument ->
Expand All @@ -232,14 +227,13 @@
surveyUnitDocumentList.add(surveyUnitDocumentStatic);

List<SurveyUnitModel> surveyUnitList = surveyUnitDocumentMapperImplStatic.listDocumentToListModel(surveyUnitDocumentList);
LocalDateTime rawRecordDate = LocalDateTime.of(2023,1,1,0,0,0);

Check warning on line 230 in src/test/java/fr/insee/genesis/infrastructure/mapper/SurveyUnitDocumentMapperImplTest.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use a "java.time.Month" enum constant instead of this int literal.

See more on https://sonarcloud.io/project/issues?id=InseeFr_genesis-api&issues=AZ6XswZ-3aHhgl0wbz-h&open=AZ6XswZ-3aHhgl0wbz-h&pullRequest=482

Assertions.assertThat(surveyUnitList.getFirst().getMode()).isEqualTo(Mode.WEB);
Assertions.assertThat(surveyUnitList.getFirst().getInterrogationId()).isEqualTo(INTERROGATION_ID);
Assertions.assertThat(surveyUnitList.getFirst().getCollectionInstrumentId()).isEqualTo(COLLECTION_INSTRUMENT_ID);
Assertions.assertThat(surveyUnitList.getFirst().getUsualSurveyUnitId()).isEqualTo(USUAL_SURVEY_UNIT_ID);
Assertions.assertThat(surveyUnitList.getFirst().getState()).isEqualTo(DataState.COLLECTED);
Assertions.assertThat(surveyUnitList.getFirst().getFileDate()).isEqualTo(rawRecordDate);
Assertions.assertThat(surveyUnitList.getFirst().getRawRecordDate()).isEqualTo(rawRecordDate);

Assertions.assertThat(surveyUnitList.getFirst().getExternalVariables()).filteredOn(externalVariableModel ->
Expand All @@ -260,14 +254,13 @@
surveyUnitDocumentList.add(deprecatedSurveyUnitDocumentStatic);

List<SurveyUnitModel> surveyUnitList = surveyUnitDocumentMapperImplStatic.listDocumentToListModel(surveyUnitDocumentList);
LocalDateTime rawRecordDate = LocalDateTime.of(2023,1,1,0,0,0);

Check warning on line 257 in src/test/java/fr/insee/genesis/infrastructure/mapper/SurveyUnitDocumentMapperImplTest.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use a "java.time.Month" enum constant instead of this int literal.

See more on https://sonarcloud.io/project/issues?id=InseeFr_genesis-api&issues=AZ6XswZ-3aHhgl0wbz-i&open=AZ6XswZ-3aHhgl0wbz-i&pullRequest=482

Assertions.assertThat(surveyUnitList.getFirst().getMode()).isEqualTo(Mode.WEB);
Assertions.assertThat(surveyUnitList.getFirst().getInterrogationId()).isEqualTo(INTERROGATION_ID);
Assertions.assertThat(surveyUnitList.getFirst().getCollectionInstrumentId()).isEqualTo(QUESTIONNAIRE_ID);
Assertions.assertThat(surveyUnitList.getFirst().getUsualSurveyUnitId()).isEqualTo(ID_UE);
Assertions.assertThat(surveyUnitList.getFirst().getState()).isEqualTo(DataState.COLLECTED);
Assertions.assertThat(surveyUnitList.getFirst().getFileDate()).isEqualTo(rawRecordDate);
Assertions.assertThat(surveyUnitList.getFirst().getRawRecordDate()).isEqualTo(rawRecordDate);

Assertions.assertThat(surveyUnitList.getFirst().getExternalVariables()).filteredOn(externalVariableModel ->
Expand All @@ -288,12 +281,11 @@
surveyUnitList.add(surveyUnitStatic);

List<SurveyUnitDocument> surveyUnitDocumentList = surveyUnitDocumentMapperImplStatic.listModelToListDocument(surveyUnitList);
LocalDateTime rawRecordDate = LocalDateTime.of(2023,1,1,0,0,0);

Check warning on line 284 in src/test/java/fr/insee/genesis/infrastructure/mapper/SurveyUnitDocumentMapperImplTest.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use a "java.time.Month" enum constant instead of this int literal.

See more on https://sonarcloud.io/project/issues?id=InseeFr_genesis-api&issues=AZ6XswZ-3aHhgl0wbz-j&open=AZ6XswZ-3aHhgl0wbz-j&pullRequest=482
Assertions.assertThat(surveyUnitDocumentList.getFirst().getMode()).isEqualTo(MODE);
Assertions.assertThat(surveyUnitDocumentList.getFirst().getInterrogationId()).isEqualTo(INTERROGATION_ID);
Assertions.assertThat(surveyUnitDocumentList.getFirst().getCollectionInstrumentId()).isEqualTo(COLLECTION_INSTRUMENT_ID);
Assertions.assertThat(surveyUnitDocumentList.getFirst().getState()).isEqualTo("COLLECTED");
Assertions.assertThat(surveyUnitDocumentList.getFirst().getFileDate()).isEqualTo(rawRecordDate);
Assertions.assertThat(surveyUnitDocumentList.getFirst().getRawRecordDate()).isEqualTo(rawRecordDate);

Assertions.assertThat(surveyUnitDocumentList.getFirst().getExternalVariables()).filteredOn(externalVariableDocument ->
Expand Down
Loading