Repository: great-expectations/great_expectations

Issue:
evaluation parameter runtime values fail to render in data docs if arithmetic is present
**Describe the bug**
evaluation parameter runtime values fail to render in data docs if arithmetic is present

**To Reproduce**
Steps to reproduce the behavior:
1. run this snippet that creates a new suite with 2 expectations and 3 different examples of parameters
2. view the data docs and note ones without arithmetic render
```python
import datetime
import great_expectations as ge
import great_expectations.jupyter_ux
from great_expectations.data_context.types.resource_identifiers import (
    ValidationResultIdentifier,
)

context = ge.data_context.DataContext()
expectation_suite_name = "foo"
suite = context.create_expectation_suite(expectation_suite_name, overwrite_existing=True)
suite.expectations = []

batch_kwargs = {
    "data_asset_name": "foo",
    "datasource": "csvs",
    "path": "borked.csv",
}
batch = context.get_batch(batch_kwargs, suite)

batch.set_evaluation_parameter("urn:great_expectations:validations:stats.get_metrics:expect_column_mean_to_be_between.result.observed_value:column=age", 10)
batch.set_evaluation_parameter("min_param", 3)
batch.set_evaluation_parameter("col_count", 9)

batch.expect_table_row_count_to_be_between(
    max_value={"$PARAMETER": "urn:great_expectations:validations:stats.get_metrics:expect_column_mean_to_be_between.result.observed_value:column=age"},
    min_value={"$PARAMETER": "min_param * 2"},
)

batch.expect_table_column_count_to_equal({"$PARAMETER": "col_count * 2"})

batch.save_expectation_suite(discard_failed_expectations=False)
results = context.run_validation_operator(
    "action_list_operator",
    assets_to_validate=[batch],
    evaluation_parameters={
        "min_param": 2,
        "col_count": 1,
        "urn:great_expectations:validations:stats.get_metrics:expect_column_mean_to_be_between.result.observed_value:column=age": 13},
)

validation_result_identifier = results.list_validation_result_identifiers()[0]
context.build_data_docs(site_names=["local_site"], resource_identifiers=[validation_result_identifier])
context.open_data_docs(validation_result_identifier)
```

<img width="1455" alt="Data_documentation_compiled_by_Great_Expectations" src="https://user-images.githubusercontent.com/928247/103256477-a899ee80-494a-11eb-9fab-792c191d6c84.png">

**Expected behavior**
I expect runtime evaluation parameters to render.

**Environment (please complete the following information):**
 - OS: [e.g. iOS] macOS
 - GE Version: [e.g. 0.10.0] 0.13.4



Discussion:
The feature of rendering the value of evaluation parameters at the time of validation was added to Data Docs recently. The initial implementation did not cover the case of arithmetic expressions with evaluation parameters. This is a great enhancement for this feature - the core team will take it on.

Resolving patch:
diff --git a/great_expectations/expectations/util.py b/great_expectations/expectations/util.py
--- a/great_expectations/expectations/util.py
+++ b/great_expectations/expectations/util.py
@@ -26,21 +26,25 @@ def inner_func(*args, **kwargs):
                 eval_params = runtime_configuration.get("evaluation_parameters", {})
                 styling = runtime_configuration.get("styling")
                 for key, val in eval_params.items():
-                    if key in current_expectation_params:
-                        app_params = dict()
-                        app_params["eval_param"] = key
-                        app_params["eval_param_value"] = val
-                        to_append = RenderedStringTemplateContent(
-                            **{
-                                "content_block_type": "string_template",
-                                "string_template": {
-                                    "template": app_template_str,
-                                    "params": app_params,
-                                    "styling": styling,
-                                },
-                            }
-                        )
-                        rendered_string_template.append(to_append)
+                    # this needs to be more complicated?
+                    # the possibility that it is a substring?
+                    for param in current_expectation_params:
+                        # "key in param" condition allows for eval param values to be rendered if arithmetic is present
+                        if key == param or key in param:
+                            app_params = dict()
+                            app_params["eval_param"] = key
+                            app_params["eval_param_value"] = val
+                            to_append = RenderedStringTemplateContent(
+                                **{
+                                    "content_block_type": "string_template",
+                                    "string_template": {
+                                        "template": app_template_str,
+                                        "params": app_params,
+                                        "styling": styling,
+                                    },
+                                }
+                            )
+                            rendered_string_template.append(to_append)
             else:
                 raise GreatExpectationsError(
                     f"""GE was not able to render the value of evaluation parameters.


Test patch:
diff --git a/tests/render/test_column_section_renderer.py b/tests/render/test_column_section_renderer.py
--- a/tests/render/test_column_section_renderer.py
+++ b/tests/render/test_column_section_renderer.py
@@ -1413,7 +1413,7 @@ def test_ValidationResultsTableContentBlockRenderer_generate_expectation_row_hap
             expectation_type="expect_column_min_to_be_between",
             kwargs={
                 "column": "live",
-                "min_value": {"$PARAMETER": "MIN_VAL_PARAM"},
+                "min_value": {"$PARAMETER": "MIN_VAL_PARAM * 2"},
                 "max_value": {"$PARAMETER": "MAX_VAL_PARAM"},
                 "result_format": "SUMMARY",
             },
@@ -1423,7 +1423,7 @@ def test_ValidationResultsTableContentBlockRenderer_generate_expectation_row_hap
 
     # evaluation_parameters are usually stored at the ExpectationSuiteValidationResult
     # and passed along as a kwarg to the ValidationResultsTableContentBlockRenderer
-    evaluation_parameter = {"MIN_VAL_PARAM": 15, "MAX_VAL_PARAM": 20}
+    evaluation_parameter = {"MIN_VAL_PARAM": 10, "MAX_VAL_PARAM": 40}
     result = ValidationResultsTableContentBlockRenderer.render(
         [evr], evaluation_parameters=evaluation_parameter
     ).to_json_dict()
@@ -1474,7 +1474,7 @@ def test_ValidationResultsTableContentBlockRenderer_generate_expectation_row_hap
                             "template": "$column minimum value must be greater than or equal to $min_value and less than or equal to $max_value.",
                             "params": {
                                 "column": "live",
-                                "min_value": {"$PARAMETER": "MIN_VAL_PARAM"},
+                                "min_value": {"$PARAMETER": "MIN_VAL_PARAM * 2"},
                                 "max_value": {"$PARAMETER": "MAX_VAL_PARAM"},
                                 "result_format": "SUMMARY",
                                 "parse_strings_as_datetimes": None,
@@ -1497,7 +1497,7 @@ def test_ValidationResultsTableContentBlockRenderer_generate_expectation_row_hap
                             "template": "\n - $eval_param = $eval_param_value (at time of validation).",
                             "params": {
                                 "eval_param": "MIN_VAL_PARAM",
-                                "eval_param_value": 15,
+                                "eval_param_value": 10,
                             },
                             "styling": {
                                 "default": {"classes": ["badge", "badge-secondary"]},
@@ -1513,7 +1513,7 @@ def test_ValidationResultsTableContentBlockRenderer_generate_expectation_row_hap
                             "template": "\n - $eval_param = $eval_param_value (at time of validation).",
                             "params": {
                                 "eval_param": "MAX_VAL_PARAM",
-                                "eval_param_value": 20,
+                                "eval_param_value": 40,
                             },
                             "styling": {
                                 "default": {"classes": ["badge", "badge-secondary"]},