src/dlt/randomizer_utils.py
def generate_all_L_RAND(
    filepath: Optional[FilenameType] = None,
    filename: FilenameType = "ssn_output.csv.gz",
    ssn_min: int = 1_01_0001,
    ssn_max: int = 899_99_9999,
    chunksize: int = 10_0000,
):
    """
    A function that calculates L_RAND values for all possible SSN from 001_01_0001 to 899_99_9999.
    This exercise was necessary to ensure that the maximum value attainable from all reasonable SSNs
    would result in an L_RAND value less than 9_999_999_999.
    """
    if filepath is None:
        # default to the DATA_DIR / reference
        filepath = Path(get_global_config().DATA_DIR) / "reference"

    # Total list of valid SSNs
    list_of_ssn = np.arange(ssn_min, ssn_max)
    # Divide the total list into manageable chunks
    list_of_list_of_ssn = list(chunk_using_generators(list_of_ssn, chunksize))
    # Process each list using COBOL
    with ProcessPoolExecutor() as executor:
        ssn_outcomes = list(
            tqdm(
                executor.map(generate_outcomes, list_of_list_of_ssn, repeat("cobol")),
                total=len(list_of_list_of_ssn),
            )
        )

    # Output data into a gzip dataframe.
    pd.DataFrame(pd.concat(ssn_outcomes)).sort_values(
        by="L_RAND", ascending=False
    ).reset_index(drop=True).to_csv(
        filepath / filename, compression="gzip", index=False
    )

    A function that calculates L_RAND values for all possible SSN from 001_01_0001 to 899_99_9999.
    This exercise was necessary to ensure that the maximum value attainable from all reasonable SSNs
    would result in an L_RAND value less than 9_999_999_999.
    
A function that calculates L_RAND values for all possible SSN from 001_01_0001 to 899_99_9999.
This exercise was necessary to ensure that the maximum value attainable from all reasonable SSNs
would result in an L_RAND value less than 9_999_999_999.
A function that calculates L_RAND values for all possible SSN from 001_01_0001 to 899_99_9999 . This exercise was necessary to ensure that the maximum value attainable from all reasonable SSNs would result in an L_RAND value less than 9_999_999_999 .
def generate_all_L_RAND(
    filepath: Optional[FilenameType] = None,
    filename: FilenameType = "ssn_output.csv.gz",
    ssn_min: int = 1_01_0001,
    ssn_max: int = 899_99_9999,
    chunksize: int = 10_0000,
):
    if filepath is None:
        filepath = Path(get_global_config().DATA_DIR) / "reference"
    list_of_ssn = np.arange(ssn_min, ssn_max)
    list_of_list_of_ssn = list(chunk_using_generators(list_of_ssn, chunksize))
    with ProcessPoolExecutor() as executor:
        ssn_outcomes = list(
            tqdm(
                executor.map(generate_outcomes, list_of_list_of_ssn, repeat("cobol")),
                total=len(list_of_list_of_ssn),
            )
        )
    pd.DataFrame(pd.concat(ssn_outcomes)).sort_values(
        by="L_RAND", ascending=False
    ).reset_index(drop=True).to_csv(
        filepath / filename, compression="gzip", index=False
    )
def generate_all_L_RAND ( filepath : Optional [ FilenameType ] = None , filename : FilenameType = "ssn_output.csv.gz" , ssn_min : int = 1_01_0001 , ssn_max : int = 899_99_9999 , chunksize : int = 10_0000 , ) : if filepath is None : filepath = Path ( get_global_config ( ) . DATA_DIR ) / "reference" list_of_ssn = np . arange ( ssn_min , ssn_max ) list_of_list_of_ssn = list ( chunk_using_generators ( list_of_ssn , chunksize ) ) with ProcessPoolExecutor ( ) as executor : ssn_outcomes = list ( tqdm ( executor . map ( generate_outcomes , list_of_list_of_ssn , repeat ( "cobol" ) ) , total = len ( list_of_list_of_ssn ) , ) ) pd . DataFrame ( pd . concat ( ssn_outcomes ) ) . sort_values ( by = "L_RAND" , ascending = False ) . reset_index ( drop = True ) . to_csv ( filepath / filename , compression = "gzip" , index = False )
A function that calculates L_RAND values for all possible SSN from 001_01_0001 to 899_99_9999.
A function that calculates L_RAND values for all possible SSN from 001_01_0001 to 899_99_9999 .
"""
    A function that calculates L_RAND values for all possible SSN from 001_01_0001 to 899_99_9999.
    This exercise was necessary to ensure that the maximum value attainable from all reasonable SSNs
    would result in an L_RAND value less than 9_999_999_999.
    """ # default to the DATA_DIR / reference # Total list of valid SSNs # Divide the total list into manageable chunks # Process each list using COBOL # Output data into a gzip dataframe.
filepath
Optional[FilenameType]
filename
FilenameType
ssn_min
int
ssn_max
int
chunksize
int