Skip to content

Commit

Permalink
Updating implementation of tdwg/bdq#86 to use FILLED_IN instead of AM…
Browse files Browse the repository at this point in the history
…ENDED when proposing changes to empty terms. Updated method, tests, and comments.
  • Loading branch information
chicoreus committed Aug 30, 2022
1 parent dd7daf6 commit f727c91
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
12 changes: 6 additions & 6 deletions src/main/java/org/filteredpush/qc/date/DwCEventDQ.java
Original file line number Diff line number Diff line change
Expand Up @@ -318,11 +318,11 @@ public static DQResponse<AmendmentValue> amendmentEventdateFromVerbatim(
DQResponse<AmendmentValue> result = new DQResponse<AmendmentValue>();

// Specification
// INTERNAL_PREREQUISITES_NOT_MET if dwc:eventDate is not EMPTY
// or the value of dwc:verbatimEventDate is EMPTY or not unambiguously
// interpretable as an ISO 8601-1:2019 date; AMENDED if the
// value of dwc:eventDate was unambiguously interpreted from
// dwc:verbatimEventDate; otherwise NOT_AMENDED
// INTERNAL_PREREQUISITES_NOT_MET if dwc:eventDate is not EMPTY
// or the value of dwc:verbatimEventDate is EMPTY or not unambiguously
// interpretable as an ISO 8601-1:2019 date; FILLED_IN the value
// of dwc:eventDate if an unambiguous ISO 8601-1:2019 date was
// interpreted from dwc:verbatimEventDate; otherwise NOT_AMENDED

if (DateUtils.isEmpty(eventDate)) {
if (!DateUtils.isEmpty(verbatimEventDate)) {
Expand All @@ -334,7 +334,7 @@ public static DQResponse<AmendmentValue> amendmentEventdateFromVerbatim(
Map<String, String> extractedValues = new HashMap<>();
extractedValues.put("dwc:eventDate", extractResponse.getResult());
result.setValue(new AmendmentValue(extractedValues));
result.setResultState(ResultState.AMENDED);
result.setResultState(ResultState.FILLED_IN);
} else if (!extractResponse.getResultState().equals(EventResult.EventQCResultState.NOT_RUN) &&
( extractResponse.getResultState().equals(EventResult.EventQCResultState.AMBIGUOUS) ||
extractResponse.getResultState().equals(EventResult.EventQCResultState.SUSPECT)))
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/filteredpush/qc/date/Runner.java
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ record = recordIterator.next();
if (current==null) { current = 0; }
current = current + 1;
acounter.put(name, current);
if (response.getResultState().equals(ResultState.AMENDED)) {
if (response.getResultState().equals(ResultState.FILLED_IN)) {
eventDate = ((AmendmentValue)response.getValue()).getObject().get("dwc:eventDate");
}

Expand All @@ -408,7 +408,7 @@ record = recordIterator.next();
if (current==null) { current = 0; }
current = current + 1;
acounter.put(name, current);
if (response.getResultState().equals(ResultState.AMENDED)) {
if (response.getResultState().equals(ResultState.FILLED_IN)) {
if (((AmendmentValue)response.getValue()).getObject().get("dwc:day")!=null) {
day = ((AmendmentValue)response.getValue()).getObject().get("dwc:day");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ public void testAmendmentEventdateFromVerbatim() {
eventDate = "";
verbatimEventDate = "1932/11/23";
response = DwCEventDQ.amendmentEventdateFromVerbatim(eventDate, verbatimEventDate);
assertEquals(ResultState.AMENDED.getLabel(), response.getResultState().getLabel());
assertEquals(ResultState.FILLED_IN.getLabel(), response.getResultState().getLabel());
assertEquals(1, response.getValue().getObject().size());
assertEquals("{dwc:eventDate=1932-11-23}", response.getValue().getObject().toString());
logger.debug(response.getComment());
Expand All @@ -578,15 +578,15 @@ public void testAmendmentEventdateFromVerbatim() {
eventDate = "";
verbatimEventDate = "1932.10.6";
response = DwCEventDQ.amendmentEventdateFromVerbatim(eventDate, verbatimEventDate);
assertEquals(ResultState.AMENDED.getLabel(), response.getResultState().getLabel());
assertEquals(ResultState.FILLED_IN.getLabel(), response.getResultState().getLabel());
assertEquals(1, response.getValue().getObject().size());
assertEquals("1932-10-06", response.getValue().getObject().get("dwc:eventDate"));
logger.debug(response.getComment());

eventDate = "";
verbatimEventDate = "Friday 29th Oct. 2021";
response = DwCEventDQ.amendmentEventdateFromVerbatim(eventDate, verbatimEventDate);
assertEquals(ResultState.AMENDED.getLabel(), response.getResultState().getLabel());
assertEquals(ResultState.FILLED_IN.getLabel(), response.getResultState().getLabel());
assertEquals(1, response.getValue().getObject().size());
assertEquals("2021-10-29", response.getValue().getObject().get("dwc:eventDate"));
logger.debug(response.getComment());
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/org/filteredpush/qc/date/DwcEventDQTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -448,13 +448,13 @@ public void testAmendmentEventdateFromVerbatim() {
String eventDate = "";
String verbatimEventDate = "Jan 1884";
DQResponse<AmendmentValue> result = DwCEventDQ.amendmentEventdateFromVerbatim(eventDate,verbatimEventDate);
assertEquals(ResultState.AMENDED, result.getResultState());
assertEquals(ResultState.FILLED_IN, result.getResultState());
assertEquals("1884-01",result.getValue().getObject().get("dwc:eventDate"));
assertEquals(1,result.getValue().getObject().size());

verbatimEventDate = "1 Mar 1884";
result = DwCEventDQ.amendmentEventdateFromVerbatim(eventDate,verbatimEventDate);
assertEquals(ResultState.AMENDED, result.getResultState());
assertEquals(ResultState.FILLED_IN, result.getResultState());
assertEquals("1884-03-01",result.getValue().getObject().get("dwc:eventDate"));
assertEquals(1,result.getValue().getObject().size());

Expand Down

0 comments on commit f727c91

Please sign in to comment.