From 6cff579a207d0d61b8719a5284eb959b33077a26 Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Tue, 15 Aug 2023 10:09:45 +0100 Subject: [PATCH] Fixed serialisation bug --- causal_testing/testing/causal_test_result.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/causal_testing/testing/causal_test_result.py b/causal_testing/testing/causal_test_result.py index b5075ccd..c0af8bc9 100644 --- a/causal_testing/testing/causal_test_result.py +++ b/causal_testing/testing/causal_test_result.py @@ -85,9 +85,11 @@ def to_dict(self, json=False): "outcome": self.estimator.outcome, "adjustment_set": list(self.adjustment_set) if json else self.adjustment_set, "effect_measure": self.test_value.type, - "effect_estimate": self.test_value.value, - "ci_low": self.ci_low(), - "ci_high": self.ci_high(), + "effect_estimate": self.test_value.value.to_dict() + if json and hasattr(self.test_value.value, "to_dict") + else self.test_value.value, + "ci_low": self.ci_low().to_dict() if json and hasattr(self.ci_low(), "to_dict") else self.ci_low(), + "ci_high": self.ci_high().to_dict() if json and hasattr(self.ci_high(), "to_dict") else self.ci_high(), } if self.adequacy: base_dict["adequacy"] = self.adequacy.to_dict()