Search in sources :

Example 21 with ChartDataEntity

use of org.talend.dq.indicators.preview.table.ChartDataEntity in project tdq-studio-se by Talend.

the class AnalysisExecutor method hasOutThreshold.

/**
 * DOC qiongli Comment method "hasOutThreshold".
 *
 * @param indicator
 * @return
 */
private boolean hasOutThreshold(Indicator indicator) {
    String[] indicatorThreshold = IndicatorHelper.getIndicatorThreshold(indicator);
    String[] indiPercentThreshold = IndicatorHelper.getIndicatorThresholdInPercent(indicator);
    Object obj = IndicatorCommonUtil.getIndicatorValue(indicator);
    if (indicatorThreshold != null || indiPercentThreshold != null) {
        // MOD qiongli 2011-11-15 TDQ-3690 avoid String "null",and get the value for ValueIndicator to transfer.
        if (obj != null && !PluginConstant.EMPTY_STRING.equals(obj.toString()) && !"null".equalsIgnoreCase(obj.toString())) {
            // $NON-NLS-1$
            String value = PluginConstant.EMPTY_STRING;
            if (indicator instanceof ValueIndicator) {
                value = ((ValueIndicator) indicator).getValue();
            }
            ChartDataEntity chartDataEntity = new ChartDataEntity(indicator, PluginConstant.EMPTY_STRING, value);
            if (obj instanceof PatternMatchingExt) {
                obj = (((PatternMatchingExt) obj).getMatchingValueCount());
            }
            if (chartDataEntity.isOutOfRange(obj.toString())) {
                return true;
            }
        }
    }
    List<Indicator> leaves = IndicatorHelper.getIndicatorLeaves(indicator);
    if (leaves.size() > 0 && !leaves.get(0).equals(indicator)) {
        for (Indicator leaveIndicator : leaves) {
            if (hasOutThreshold(leaveIndicator)) {
                return true;
            }
        }
    }
    return false;
}
Also used : ValueIndicator(org.talend.dataquality.indicators.ValueIndicator) PatternMatchingExt(org.talend.dq.indicators.ext.PatternMatchingExt) ChartDataEntity(org.talend.dq.indicators.preview.table.ChartDataEntity) Indicator(org.talend.dataquality.indicators.Indicator) ValueIndicator(org.talend.dataquality.indicators.ValueIndicator)

Example 22 with ChartDataEntity

use of org.talend.dq.indicators.preview.table.ChartDataEntity in project tdq-studio-se by Talend.

the class SummaryStatisticsTableState method getDataEntity.

/*
     * (non-Javadoc)
     * 
     * @see org.talend.dataprofiler.core.ui.editor.preview.model.states.table.AbstractTableTypeStates#getDataEntity()
     */
@Override
public ChartDataEntity[] getDataEntity() {
    List<ChartDataEntity> dataEnities = new ArrayList<ChartDataEntity>();
    for (IndicatorUnit unit : units) {
        String value = summaryUtil.getUnitValue(unit);
        ChartDataEntity entity = summaryUtil.createDataEntity(unit, value);
        dataEnities.add(entity);
    }
    return dataEnities.toArray(new ChartDataEntity[dataEnities.size()]);
}
Also used : ArrayList(java.util.ArrayList) IndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit) ChartDataEntity(org.talend.dq.indicators.preview.table.ChartDataEntity)

Example 23 with ChartDataEntity

use of org.talend.dq.indicators.preview.table.ChartDataEntity in project tdq-studio-se by Talend.

the class FrequencyTypeStateUtil method createChartEntity.

public static ChartDataEntity createChartEntity(Indicator indicator, FrequencyExt freqExt, String keyLabel, boolean isWithRowCountIndicator) {
    ChartDataEntity entity = new ChartDataEntity();
    entity.setIndicator(indicator);
    // MOD mzhao feature:6307 display soundex distinct count and real count.
    entity.setKey(freqExt == null ? null : freqExt.getKey());
    entity.setLabelNull(freqExt == null || freqExt.getKey() == null);
    entity.setLabel(keyLabel);
    entity.setValue(String.valueOf(freqExt == null ? StringUtils.EMPTY : freqExt.getValue()));
    if (freqExt == null) {
        entity.setPercent(0.0);
    } else if (indicator instanceof BenfordLawFrequencyIndicator) {
        entity.setPercent(freqExt.getFrequency());
    } else {
        Double percent = isWithRowCountIndicator ? freqExt.getFrequency() : Double.NaN;
        entity.setPercent(percent);
    }
    return entity;
}
Also used : BenfordLawFrequencyIndicator(org.talend.dataquality.indicators.BenfordLawFrequencyIndicator) ChartDataEntity(org.talend.dq.indicators.preview.table.ChartDataEntity)

Example 24 with ChartDataEntity

use of org.talend.dq.indicators.preview.table.ChartDataEntity in project tdq-studio-se by Talend.

the class ModeStatisticsStateUtil method createDataEntity.

/**
 * DOC yyin Comment method "createDataEntity".
 *
 * @param unit
 * @param label
 * @return
 */
public static ChartDataEntity createDataEntity(IndicatorUnit unit, String label) {
    ChartDataEntity entity = new ChartDataEntity();
    entity.setIndicator(unit.getIndicator());
    entity.setLabel(label);
    Object value = unit.getValue();
    entity.setValue(String.valueOf(value == null ? StringUtils.EMPTY : value));
    return entity;
}
Also used : ChartDataEntity(org.talend.dq.indicators.preview.table.ChartDataEntity)

Example 25 with ChartDataEntity

use of org.talend.dq.indicators.preview.table.ChartDataEntity in project tdq-studio-se by Talend.

the class PhoneNumbStatisticsStateUtil method createDataEntity.

/**
 * DOC yyin Comment method "createDataEntity".
 *
 * @param unit
 * @param value
 * @param label
 * @return
 */
public static ChartDataEntity createDataEntity(Indicator indicator, String value, String label) {
    ChartDataEntity entity = new ChartDataEntity();
    entity.setIndicator(indicator);
    entity.setLabel(label);
    entity.setValue(value);
    entity.setPercent(Double.parseDouble(value) / indicator.getCount());
    return entity;
}
Also used : ChartDataEntity(org.talend.dq.indicators.preview.table.ChartDataEntity)

Aggregations

ChartDataEntity (org.talend.dq.indicators.preview.table.ChartDataEntity)61 IndicatorUnit (org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit)17 ArrayList (java.util.ArrayList)16 Test (org.junit.Test)13 TdColumn (org.talend.cwm.relational.TdColumn)13 CustomerDefaultCategoryDataset (org.talend.dataprofiler.common.ui.editor.preview.CustomerDefaultCategoryDataset)12 Analysis (org.talend.dataquality.analysis.Analysis)11 IndicatorParameters (org.talend.dataquality.indicators.IndicatorParameters)10 TdTable (org.talend.cwm.relational.TdTable)9 TdExpression (org.talend.cwm.relational.TdExpression)8 AnalysisContext (org.talend.dataquality.analysis.AnalysisContext)8 FrequencyExt (org.talend.dq.indicators.ext.FrequencyExt)8 DatabaseConnection (org.talend.core.model.metadata.builder.connection.DatabaseConnection)7 TableWithData (org.talend.dataprofiler.core.ui.editor.preview.model.TableWithData)7 PatternMatchingIndicator (org.talend.dataquality.indicators.PatternMatchingIndicator)6 UDIndicatorDefinition (org.talend.dataquality.indicators.definition.userdefine.UDIndicatorDefinition)6 Expression (orgomg.cwm.objectmodel.core.Expression)6 Domain (org.talend.dataquality.domain.Domain)5 Pattern (org.talend.dataquality.domain.pattern.Pattern)5 RegularExpression (org.talend.dataquality.domain.pattern.RegularExpression)5