diff --git a/medcoder/main.py b/medcoder/main.py index ab32f81b2327f73e395b386fa009d18867216bc2..f1868c2e69675955c6ad43f8225e63fd49a5e8ea 100644 --- a/medcoder/main.py +++ b/medcoder/main.py @@ -291,8 +291,7 @@ def run_all(mapping_file, target_code_type, error_df = error_df.sort_values(by=["SOURCE", "VOCABULARY", "CONCEPT"]) error_df.to_csv(log_errors_path, index=False) - -if __name__ == '__main__': +def main(): parser = argparse.ArgumentParser(description="Script preprocess code lists and to map to given concept/phenotype", formatter_class=argparse.ArgumentDefaultsHelpFormatter) @@ -332,4 +331,8 @@ if __name__ == '__main__': if not config["error_log"] == None: params["log_errors_path"] = config["error_log"] - run_all(**params) \ No newline at end of file + run_all(**params) + + +if __name__ == '__main__': + main() \ No newline at end of file diff --git a/medcoder/parse.py b/medcoder/parse.py index a509369396e7a39f618717f5525a159237fae923..8a567cfe2f19ae8471c19bb40bd4ce522c04dbae 100644 --- a/medcoder/parse.py +++ b/medcoder/parse.py @@ -197,15 +197,15 @@ class Icd10_code(Proto_code): file_path=self.file_path, cause="QA In Database"), ) -# ( -# "ICD10 Regex", -# lambda codes : codes.str.match("[a-zA-Z][0-9][0-9]\.?[a-zA-Z0-9]*$"), #Alpha, Num, Num , Dot?, 4xAlphNum* -# lambda codes : log_invalid_code(codes, -# codes.str.match("[a-zA-Z][0-9][0-9]\.?[a-zA-Z0-9]*$"), #Log non-matching rows -# code_type="icd10_code", -# file_path=self.file_path), + # ( + # "ICD10 Regex", + # lambda codes : codes.str.match("[a-zA-Z][0-9][0-9]\.?[a-zA-Z0-9]*$"), #Alpha, Num, Num , Dot?, 4xAlphNum* + # lambda codes : log_invalid_code(codes, + # codes.str.match("[a-zA-Z][0-9][0-9]\.?[a-zA-Z0-9]*$"), #Log non-matching rows + # code_type="icd10_code", + # file_path=self.file_path), -# ) + # ) ] def trim_icd10(codes): diff --git a/medcoder/trud_api.py b/medcoder/trud_api.py index a7eade3d5ebf2a54509ece2c6cd4d62870ae4b9e..e4e54887b50192157d816564334475d66b724cff 100644 --- a/medcoder/trud_api.py +++ b/medcoder/trud_api.py @@ -206,12 +206,12 @@ def main(): formatter_class=argparse.ArgumentDefaultsHelpFormatter ) parser.add_argument("--key", type=str, help="TRUD API Key") -# parser.add_argument("item_ids", nargs="+", help="Item IDs to download releases for.") -# parser.add_argument("-l", "--latest", action="store_true", help="Download only the latest release") -# parser.add_argument("-c", "--checksum", action="store_true", help="Also download the checksum file") -# parser.add_argument("-s", "--signature", action="store_true", help="Also download the signature file") -# parser.add_argument("-p", "--public_key", action="store_true", help="Also download the public key file") - + # parser.add_argument("item_ids", nargs="+", help="Item IDs to download releases for.") + # parser.add_argument("-l", "--latest", action="store_true", help="Download only the latest release") + # parser.add_argument("-c", "--checksum", action="store_true", help="Also download the checksum file") + # parser.add_argument("-s", "--signature", action="store_true", help="Also download the signature file") + # parser.add_argument("-p", "--public_key", action="store_true", help="Also download the public key file") + args = parser.parse_args() items_latest = True diff --git a/pyproject.toml b/pyproject.toml index 060d7aab42f4228da5213808f170d13607273b2d..40bff1b127843f94d7e7f41e2a5d0d4b92d06a4d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,4 +12,9 @@ license = { file = "LICENSE" } dependencies = [ "pandas", "numpy" -] \ No newline at end of file +] + +[project.scripts] +medcoder = "medcoder.main:main" +medcoder_install_trud = "medcoder.trud_api:main" +medcoder_install_omop = "medcoder.omop_api:main" \ No newline at end of file