@@ -25,6 +25,12 @@ class HipaaAddressGeneratorMetadata(BaseMetadata):
2525 realistic_synthetic_values : bool
2626 When ``True``, generates realistic-looking synthetic address values.
2727 Default is ``True``.
28+ use_three_digit_zips : bool
29+ When ``True`` zip codes are always truncated to three digits.
30+ Default is ``False``
31+ replace_foreign_zip_codes_with_zeros : bool
32+ When ``True`` foreign zip codes become all zeros
33+ Default is ``False``
2834 """
2935
3036 def __init__ (
@@ -35,6 +41,8 @@ def __init__(
3541 realistic_synthetic_values : bool = True ,
3642 swaps : Optional [Dict [str ,str ]] = {},
3743 constant_value : Optional [str ] = None ,
44+ use_three_digit_zips : bool = False ,
45+ replace_foreign_zip_codes_with_zeros : bool = False ,
3846 ):
3947 super ().__init__ (
4048 custom_generator = GeneratorType .HipaaAddressGenerator ,
@@ -45,6 +53,8 @@ def __init__(
4553 self ["useNonHipaaAddressGenerator" ] = use_non_hipaa_address_generator
4654 self ["replaceTruncatedZerosInZipCode" ] = replace_truncated_zeros_in_zip_code
4755 self ["realisticSyntheticValues" ] = realistic_synthetic_values
56+ self ["useThreeDigitZips" ] = use_three_digit_zips
57+ self ["replaceForeignZipCodesWithZeros" ] = replace_foreign_zip_codes_with_zeros
4858
4959 @property
5060 def use_non_hipaa_address_generator (self ) -> bool :
@@ -70,6 +80,22 @@ def realistic_synthetic_values(self) -> bool:
7080 def realistic_synthetic_values (self , value : bool ):
7181 self ["realisticSyntheticValues" ] = value
7282
83+ @property
84+ def use_three_digit_zips (self ) -> bool :
85+ return self ["useThreeDigitZips" ]
86+
87+ @use_three_digit_zips .setter
88+ def use_three_digit_zips (self , value : bool ):
89+ self ["useThreeDigitZips" ] = value
90+
91+ @property
92+ def replace_foreign_zip_codes_with_zeros (self ) -> bool :
93+ return self ["replaceForeignZipCodesWithZeros" ]
94+
95+ @replace_foreign_zip_codes_with_zeros .setter
96+ def replace_foreign_zip_codes_with_zeros (self , value : bool ):
97+ self ["replaceForeignZipCodesWithZeros" ] = value
98+
7399 def to_payload (self ) -> Dict :
74100 return dict (self )
75101
@@ -89,7 +115,9 @@ def from_payload(payload: Dict) -> "HipaaAddressGeneratorMetadata":
89115 replace_truncated_zeros_in_zip_code = payload .get ("replaceTruncatedZerosInZipCode" , True ),
90116 realistic_synthetic_values = payload .get ("realisticSyntheticValues" , True ),
91117 swaps = base_metadata .swaps ,
92- constant_value = base_metadata .constant_value
118+ constant_value = base_metadata .constant_value ,
119+ use_three_digit_zips = payload .get ("useThreeDigitZips" , False ),
120+ replace_foreign_zip_codes_with_zeros = payload .get ("replaceForeignZipCodesWithZeros" , False )
93121 )
94122
95123default_hipaa_address_generator_metadata = HipaaAddressGeneratorMetadata ()
0 commit comments