Commit a93c78ec authored by Venkat Malladi's avatar Venkat Malladi
Browse files

Commit some historic pathology transformation.

parent 86a5e141
Pipeline #10702 failed with stage
#!/usr/bin/env python3
'''Generate Pathology Table historic'''
import argparse
import datetime
import os
import pandas as pd
def main():
args = get_args()
surgery = args.file
date = args.date
surgery_map = args.surgery
out_path = args.out
# Make output files
surgery_table = os.path.join(out_path + 'surgery_table.csv')
surgery_procedure_table = os.path.join(out_path + 'surgery_procedure_table.csv')
unmapped_table = os.path.join(out_path + 'unmapped_surgery_table.csv')
# Read in files
surgery_df = pd.read_csv(surgery)
date_shift = pd.read_csv(date)
surgery_map = pd.read_csv(surgery_map, sep='\t')
# Reformat data
surgery_reformat = reformat_record(surgery_df)
# Convert Surgery
surgery_convert, conflicting_surgery = convert_surgery(surgery_reformat, surgery_map)
# Calculate Date Shift
shifted_df = calculate_shift(surgery_convert, date_shift)
# Write out surgery table
shifted_df.to_csv(surgery_table, index=False)
conflicting_surgery.to_csv(unmapped_table, index=False)
if __name__ == '__main__':
main()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment