Incremental progress for ancestor/descendant filters.
This commit is contained in:
parent
9b4671c05e
commit
7c5cf9f1f4
|
@ -872,19 +872,17 @@ public abstract class BaseHapiTerminologySvcImpl implements IHapiTerminologySvc,
|
||||||
break;
|
break;
|
||||||
case "parent":
|
case "parent":
|
||||||
case "child":
|
case "child":
|
||||||
if (isCodeSystemLoinc(theSystem)) {
|
isCodeSystemLoingOrThrowInvalidRequestException(theSystem, theFilter.getProperty());
|
||||||
handleFilterLoincParentChild(theQb, theBool, theFilter);
|
handleFilterLoincParentChild(theQb, theBool, theFilter);
|
||||||
} else {
|
break;
|
||||||
throw new InvalidRequestException("Invalid filter, property " + theFilter.getProperty() + " is LOINC-specific and cannot be used with system: " + theSystem);
|
case "ancestor":
|
||||||
}
|
case "descendant":
|
||||||
|
isCodeSystemLoingOrThrowInvalidRequestException(theSystem, theFilter.getProperty());
|
||||||
|
handleFilterLoincAncestorDescendant(theQb, theBool, theFilter);
|
||||||
break;
|
break;
|
||||||
// FIXME: DM 2019-09-24 - Need to implement LOINC-specific filters for "ancestor" and "descendant".
|
|
||||||
case "copyright":
|
case "copyright":
|
||||||
if (isCodeSystemLoinc(theSystem)) {
|
isCodeSystemLoingOrThrowInvalidRequestException(theSystem, theFilter.getProperty());
|
||||||
handleFilterLoincCopyright(theQb, theBool, theFilter);
|
handleFilterLoincCopyright(theQb, theBool, theFilter);
|
||||||
} else {
|
|
||||||
throw new InvalidRequestException("Invalid filter, property " + theFilter.getProperty() + " is LOINC-specific and cannot be used with system: " + theSystem);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
handleFilterRegex(theBool, theFilter);
|
handleFilterRegex(theBool, theFilter);
|
||||||
|
@ -892,6 +890,13 @@ public abstract class BaseHapiTerminologySvcImpl implements IHapiTerminologySvc,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isCodeSystemLoingOrThrowInvalidRequestException(String theSystem, String theProperty) {
|
||||||
|
if (!isCodeSystemLoinc(theSystem)) {
|
||||||
|
throw new InvalidRequestException("Invalid filter, property " + theProperty + " is LOINC-specific and cannot be used with system: " + theSystem);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
private boolean isCodeSystemLoinc(String theSystem) {
|
private boolean isCodeSystemLoinc(String theSystem) {
|
||||||
return IHapiTerminologyLoaderSvc.LOINC_URI.equals(theSystem);
|
return IHapiTerminologyLoaderSvc.LOINC_URI.equals(theSystem);
|
||||||
}
|
}
|
||||||
|
@ -965,6 +970,30 @@ public abstract class BaseHapiTerminologySvcImpl implements IHapiTerminologySvc,
|
||||||
return new Term(TermConceptPropertyFieldBridge.CONCEPT_FIELD_PROPERTY_PREFIX + theProperty, theValue);
|
return new Term(TermConceptPropertyFieldBridge.CONCEPT_FIELD_PROPERTY_PREFIX + theProperty, theValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void handleFilterLoincAncestorDescendant(QueryBuilder theQb, BooleanJunction<?> theBool, ValueSet.ConceptSetFilterComponent theFilter) {
|
||||||
|
if (theFilter.getOp() == ValueSet.FilterOperator.EQUAL) {
|
||||||
|
addLoincFilterAncestorDescendantEqual(theBool, theFilter.getProperty(), theFilter.getValue());
|
||||||
|
} else if (theFilter.getOp() == ValueSet.FilterOperator.IN) {
|
||||||
|
addLoincFilterAncestorDescendantIn(theBool, theFilter);
|
||||||
|
} else {
|
||||||
|
throw new InvalidRequestException("Don't know how to handle op=" + theFilter.getOp() + " on property " + theFilter.getProperty());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addLoincFilterAncestorDescendantEqual(BooleanJunction<?> theBool, String theProperty, String theValue) {
|
||||||
|
logFilteringValueOnProperty(theValue, theProperty);
|
||||||
|
// FIXME: DM 2019-09-25 - Filter with op=EQUAL on ancestor/descendant
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addLoincFilterAncestorDescendantIn(BooleanJunction<?> theBool, ValueSet.ConceptSetFilterComponent theFilter) {
|
||||||
|
String[] values = theFilter.getValue().split(",");
|
||||||
|
List<Term> terms = new ArrayList<>();
|
||||||
|
for (String value : values) {
|
||||||
|
logFilteringValueOnProperty(value, theFilter.getProperty());
|
||||||
|
// FIXME: DM 2019-09-25 - Filter with op=IN on ancestor/descendant
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void handleFilterLoincCopyright(QueryBuilder theQb, BooleanJunction<?> theBool, ValueSet.ConceptSetFilterComponent theFilter) {
|
private void handleFilterLoincCopyright(QueryBuilder theQb, BooleanJunction<?> theBool, ValueSet.ConceptSetFilterComponent theFilter) {
|
||||||
if (theFilter.getOp() == ValueSet.FilterOperator.EQUAL) {
|
if (theFilter.getOp() == ValueSet.FilterOperator.EQUAL) {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue