<jupyter_start><jupyter_text>Create dummy data  Lab results<jupyter_code>results = pd.DataFrame(columns=['stay_id', 'value', 'itemid', 'charttime'])
results
# Choose unique IDs 500 times with replacement
results.stay_id = random.choices(range(100, 200), k=500)

# Generate random test results
results.value = np.random.uniform(low=0.0, high=100.0, size=(500,))

# Seven tests => itemid ranges from 0 to 6 
results.itemid = random.choices(range(0,6), k=500)
# Generate timestamps
def random_dates(start, end, n):

    start_u = start.value//10**9
    end_u = end.value//10**9

    return pd.to_datetime(np.random.randint(start_u, end_u, n), unit='s')

start = pd.to_datetime('2015-01-05')
end = pd.to_datetime('2015-01-10')
results.charttime = random_dates(start, end, results.shape[0])
results.dtypes
print(results.shape)
results.head()<jupyter_output>(500, 4)<jupyter_text>Admission time and static vars<jupyter_code>adm = pd.DataFrame(columns=['stay_id', 'intime', 'age', 'sex'])
adm
# Copy unique stay IDs
adm.stay_id = results.stay_id.unique()

# Genarate timestamps
start = pd.to_datetime('2015-01-01')
end = pd.to_datetime('2015-01-05')
adm.intime = random_dates(start, end, adm.shape[0])

# Populate the age column
adm.age = random.choices(range(18, 90), k=adm.shape[0])

# Populate the sex column
adm.sex = random.choices(['F', 'M'], k=adm.shape[0])
print(adm.shape)
adm.head()<jupyter_output>(100, 4)<jupyter_text>Summary stats<jupyter_code>results.stay_id.nunique()
results.groupby('itemid').size()
results.groupby('stay_id').size()
results.groupby('stay_id').itemid.nunique()
assert (results.groupby('stay_id').size() >= results.groupby('stay_id').itemid.nunique()).all()
(results.groupby('stay_id').size() > results.groupby('stay_id').itemid.nunique()).sum()<jupyter_output><empty_output><jupyter_text>Merge dataframes<jupyter_code>final_df = results.merge(adm)<jupyter_output><empty_output><jupyter_text>Save data<jupyter_code>results.to_csv('../data/dummy_results.csv', index=False)
adm.to_csv('../data/dummy_admissions.csv', index=False)
final_df.to_csv('../data/dummy_data_combined.csv', index=False)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.17287977632805218, 'fraction_numerical': 0.03821062441752097, 'mean_word_length': 7.0111940298507465, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 22, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '445312', 'license': 'MIT', 'n_tokens_mistral': 880, 'n_tokens_neox': 796, 'n_words': 128, 'path': 'create-dummy-data.ipynb', 'repo_name': 'vlada-rozova/coagulation-prediction', 'size': '2146'}