Coverage for jstark / mealkit / approx_recipe_count.py: 100%

12 statements  

« prev     ^ index     » next       coverage.py v7.13.4, created at 2026-03-23 22:34 +0000

1"""ApproxRecipeCount feature""" 

2 

3import pyspark.sql.functions as f 

4from pyspark.sql import Column 

5 

6from jstark.features.approxdistinctcount_feature import ApproxDistinctCount 

7 

8 

9class ApproxRecipeCount(ApproxDistinctCount): 

10 def column_expression(self) -> Column: 

11 return f.col("Recipe") 

12 

13 @property 

14 def description_subject(self) -> str: 

15 return "Approximate distinct count of Recipes" 

16 

17 @property 

18 def commentary(self) -> str: 

19 return ( 

20 "The approximate number of recipes. Similar to " 

21 + f"RecipeCount_{self.feature_period.mnemonic} " 

22 + "except that it uses an approximation algorithm which " 

23 + "will not be as accurate as " 

24 + f"RecipeCount_{self.feature_period.mnemonic} but will be a lot " 

25 + 'quicker to compute and in many cases will be "close enough".' 

26 )