/// <summary> /// Interprets the condition. /// </summary> /// <param name="action">The action.</param> /// <param name="condition">The condition.</param> /// <param name="entityParameter">The expression entity parameter.</param> /// <returns>The interpreted condition.</returns> private Expression InterpretCondition(Func<ParameterExpression, string, Expression> action, QueryFilterCondition condition, ParameterExpression entityParameter) { return condition != null ? action(entityParameter, condition.Property) : null; }
public void GivenPatientNameFilterCondition_WithFuzzyMatchingTrue_FuzzyMatchConditionAdded() { QueryExpression queryExpression = _queryParser.Parse( CreateParameters( new Dictionary <string, string> { { "PatientName", "CoronaPatient" }, { "StudyDate", "20200403" }, }, QueryResource.AllStudies, fuzzyMatching: true), QueryTagService.CoreQueryTags); Assert.Equal(2, queryExpression.FilterConditions.Count); var studyDateFilterCondition = queryExpression.FilterConditions.FirstOrDefault(c => c.QueryTag.Tag == DicomTag.StudyDate) as DateSingleValueMatchCondition; Assert.NotNull(studyDateFilterCondition); QueryFilterCondition patientNameCondition = queryExpression.FilterConditions.FirstOrDefault(c => c.QueryTag.Tag == DicomTag.PatientName); Assert.NotNull(patientNameCondition); var fuzzyCondition = patientNameCondition as PersonNameFuzzyMatchCondition; Assert.NotNull(fuzzyCondition); Assert.Equal("CoronaPatient", fuzzyCondition.Value); }
public void GivenPatientNameFilterCondition_WithFuzzyMatchingTrue_FuzzyMatchConditionAdded(string queryString, QueryResource resourceType) { EnsureArg.IsNotNull(queryString, nameof(queryString)); QueryExpression queryExpression = _queryParser.Parse(CreateRequest(GetQueryCollection(queryString), resourceType)); Assert.Equal(2, queryExpression.FilterConditions.Count); var studyDateFilterCondition = queryExpression.FilterConditions.FirstOrDefault(c => c.DicomTag == DicomTag.StudyDate) as DateSingleValueMatchCondition; Assert.NotNull(studyDateFilterCondition); QueryFilterCondition patientNameCondition = queryExpression.FilterConditions.FirstOrDefault(c => c.DicomTag == DicomTag.PatientName); Assert.NotNull(patientNameCondition); var fuzzyCondition = patientNameCondition as PersonNameFuzzyMatchCondition; Assert.NotNull(fuzzyCondition); Assert.Equal("CoronaPatient", fuzzyCondition.Value); }
private void AppendExtendedQueryTagKeyFilter(DicomTagSqlEntry dicomTagSqlEntry, string tableAlias, QueryFilterCondition filterCondition) { if (dicomTagSqlEntry.IsExtendedQueryTag) { _stringBuilder .Append(dicomTagSqlEntry.SqlKeyColumn, tableAlias) .Append("=") .Append(_parameters.AddParameter(dicomTagSqlEntry.SqlKeyColumn, filterCondition.QueryTag.ExtendedQueryTagStoreEntry.Key)) .AppendLine() .Append("AND "); } }