public static KiePMMLDroolsAST getKiePMMLDroolsAST(final List<Field<?>> fields,
                                                       final Scorecard model,
                                                       final Map<String, KiePMMLOriginalTypeGeneratedType> fieldTypeMap,
                                                       final List<KiePMMLDroolsType> types) {
        logger.trace("getKiePMMLDroolsAST {} {} {}", fields, model, fieldTypeMap);
        DATA_TYPE targetType = getTargetFieldType(fields, model);
        List<OutputField> outputFields = model.getOutput() != null ? model.getOutput().getOutputFields() :
                Collections.emptyList();
        KiePMMLScorecardModelCharacteristicASTFactory factory =
                KiePMMLScorecardModelCharacteristicASTFactory.factory(fieldTypeMap, outputFields, targetType);
        if (model.isUseReasonCodes()) {
            factory = factory.withReasonCodes(model.getBaselineScore(), REASONCODE_ALGORITHM.byName(model.getReasonCodeAlgorithm().value()));
        }
        final List<KiePMMLDroolsRule> rules = factory
                .declareRulesFromCharacteristics(model.getCharacteristics(), "", model.getInitialScore());
        return new KiePMMLDroolsAST(types, rules);
    }
@Test
    void getKiePMMLDroolsSampleAST() {
        final Map<String, KiePMMLOriginalTypeGeneratedType> fieldTypeMap = getFieldTypeMap(samplePmml.getDataDictionary(), samplePmml.getTransformationDictionary(),  scorecardModel.getLocalTransformations());
        List<KiePMMLDroolsType> types = Collections.emptyList();
        KiePMMLDroolsAST retrieved = KiePMMLScorecardModelASTFactory.getKiePMMLDroolsAST(getFieldsFromDataDictionary(samplePmml.getDataDictionary()), scorecardModel, fieldTypeMap, types);
        assertThat(retrieved).isNotNull();
        assertThat(retrieved.getTypes()).isEqualTo(types);
        assertThat(retrieved.getRules()).isNotEmpty();
    }