diff --git a/acmc/phen.py b/acmc/phen.py index 4ef51e66887dd8eeefb70ef211bf03fb89854411..86675bf0d303b8b3f5aac9f88d3bb79346bf29af 100644 --- a/acmc/phen.py +++ b/acmc/phen.py @@ -29,12 +29,12 @@ pd.set_option("mode.chained_assignment", None) PHEN_DIR = "phen" DEFAULT_PHEN_PATH = Path("./workspace") / PHEN_DIR -CODES_DIR = "codes" +CONCEPTS_DIR = "concepts" MAP_DIR = "map" CONCEPT_SET_DIR = "concept-set" CSV_PATH = Path(CONCEPT_SET_DIR) / "csv" OMOP_PATH = Path(CONCEPT_SET_DIR) / "omop" -DEFAULT_PHEN_DIR_LIST = [CODES_DIR, MAP_DIR, CONCEPT_SET_DIR] +DEFAULT_PHEN_DIR_LIST = [CONCEPTS_DIR, MAP_DIR, CONCEPT_SET_DIR] CONFIG_FILE = "config.yaml" VOCAB_VERSION_FILE = "vocab_version.yaml" @@ -327,10 +327,10 @@ def validate(phen_dir): f"Error: phen configuration file '{config_path}' does not exist." ) - codes_path = phen_path / CODES_DIR - if not codes_path.is_dir(): + concepts_path = phen_path / CONCEPTS_DIR + if not concepts_path.is_dir(): raise FileNotFoundError( - f"Error: source codes directory {source_codes_dir} does not exist." + f"Error: source concepts directory {concepts_path} does not exist." ) # Calidate the directory is a git repo @@ -384,7 +384,7 @@ def validate(phen_dir): # check codes definition for item in phenotype["concept_sets"]: # check concepte code file exists - concept_code_file_path = codes_path / item["file"]["path"] + concept_code_file_path = concepts_path / item["file"]["path"] if not concept_code_file_path.exists(): validation_errors.append( f"Coding file {str(concept_code_file_path.resolve())} does not exist" @@ -683,7 +683,7 @@ def map(phen_dir, target_code_type): def map_target_code_type(phen_path, phenotype, target_code_type): logger.debug(f"Target coding format: {target_code_type}") - codes_path = phen_path / CODES_DIR + concepts_path = phen_path / CONCEPTS_DIR # Create output dataframe out = pd.DataFrame([]) code_errors = [] @@ -693,7 +693,7 @@ def map_target_code_type(phen_path, phenotype, target_code_type): logger.debug(f"--- {concept_set['file']} ---") # Load code file - codes_file_path = Path(codes_path / concept_set["file"]["path"]) + codes_file_path = Path(concepts_path / concept_set["file"]["path"]) df = read_table_file(codes_file_path) # process structural actions diff --git a/examples/codes/clinical-codes-org/Cardiovascular events (ICD10)/Where this code list comes from .docx b/examples/concepts/clinical-codes-org/Cardiovascular events (ICD10)/Where this code list comes from .docx similarity index 100% rename from examples/codes/clinical-codes-org/Cardiovascular events (ICD10)/Where this code list comes from .docx rename to examples/concepts/clinical-codes-org/Cardiovascular events (ICD10)/Where this code list comes from .docx diff --git a/examples/codes/clinical-codes-org/Cardiovascular events (ICD10)/res52-cardiovascular-events-icd10.csv b/examples/concepts/clinical-codes-org/Cardiovascular events (ICD10)/res52-cardiovascular-events-icd10.csv similarity index 100% rename from examples/codes/clinical-codes-org/Cardiovascular events (ICD10)/res52-cardiovascular-events-icd10.csv rename to examples/concepts/clinical-codes-org/Cardiovascular events (ICD10)/res52-cardiovascular-events-icd10.csv diff --git a/examples/codes/clinical-codes-org/Non-attendance codes/Where this code list comes from .docx b/examples/concepts/clinical-codes-org/Non-attendance codes/Where this code list comes from .docx similarity index 100% rename from examples/codes/clinical-codes-org/Non-attendance codes/Where this code list comes from .docx rename to examples/concepts/clinical-codes-org/Non-attendance codes/Where this code list comes from .docx diff --git a/examples/codes/clinical-codes-org/Non-attendance codes/res201-did-not-attend-appointment.csv b/examples/concepts/clinical-codes-org/Non-attendance codes/res201-did-not-attend-appointment.csv similarity index 100% rename from examples/codes/clinical-codes-org/Non-attendance codes/res201-did-not-attend-appointment.csv rename to examples/concepts/clinical-codes-org/Non-attendance codes/res201-did-not-attend-appointment.csv diff --git a/examples/codes/clinical-codes-org/Symptom code lists/Abdominal pain/Where this code list comes from .docx b/examples/concepts/clinical-codes-org/Symptom code lists/Abdominal pain/Where this code list comes from .docx similarity index 100% rename from examples/codes/clinical-codes-org/Symptom code lists/Abdominal pain/Where this code list comes from .docx rename to examples/concepts/clinical-codes-org/Symptom code lists/Abdominal pain/Where this code list comes from .docx diff --git a/examples/codes/clinical-codes-org/Symptom code lists/Abdominal pain/res176-abdominal-pain.csv b/examples/concepts/clinical-codes-org/Symptom code lists/Abdominal pain/res176-abdominal-pain.csv similarity index 100% rename from examples/codes/clinical-codes-org/Symptom code lists/Abdominal pain/res176-abdominal-pain.csv rename to examples/concepts/clinical-codes-org/Symptom code lists/Abdominal pain/res176-abdominal-pain.csv diff --git a/examples/codes/clinical-codes-org/Symptom code lists/Falls/Where this code list comes from .docx b/examples/concepts/clinical-codes-org/Symptom code lists/Falls/Where this code list comes from .docx similarity index 100% rename from examples/codes/clinical-codes-org/Symptom code lists/Falls/Where this code list comes from .docx rename to examples/concepts/clinical-codes-org/Symptom code lists/Falls/Where this code list comes from .docx diff --git a/examples/codes/clinical-codes-org/Symptom code lists/Falls/res178-fall.csv b/examples/concepts/clinical-codes-org/Symptom code lists/Falls/res178-fall.csv similarity index 100% rename from examples/codes/clinical-codes-org/Symptom code lists/Falls/res178-fall.csv rename to examples/concepts/clinical-codes-org/Symptom code lists/Falls/res178-fall.csv diff --git a/examples/codes/clinical-codes-org/Symptom code lists/Falls/res202-falls-outcome.csv b/examples/concepts/clinical-codes-org/Symptom code lists/Falls/res202-falls-outcome.csv similarity index 100% rename from examples/codes/clinical-codes-org/Symptom code lists/Falls/res202-falls-outcome.csv rename to examples/concepts/clinical-codes-org/Symptom code lists/Falls/res202-falls-outcome.csv diff --git a/examples/codes/clinical-codes-org/Symptom code lists/Fatigue/Where this code list comes from .docx b/examples/concepts/clinical-codes-org/Symptom code lists/Fatigue/Where this code list comes from .docx similarity index 100% rename from examples/codes/clinical-codes-org/Symptom code lists/Fatigue/Where this code list comes from .docx rename to examples/concepts/clinical-codes-org/Symptom code lists/Fatigue/Where this code list comes from .docx diff --git a/examples/codes/clinical-codes-org/Symptom code lists/Fatigue/res175-fatigue.csv b/examples/concepts/clinical-codes-org/Symptom code lists/Fatigue/res175-fatigue.csv similarity index 100% rename from examples/codes/clinical-codes-org/Symptom code lists/Fatigue/res175-fatigue.csv rename to examples/concepts/clinical-codes-org/Symptom code lists/Fatigue/res175-fatigue.csv diff --git a/examples/codes/clinical-codes-org/Symptom code lists/Headache/Where this code list comes from .docx b/examples/concepts/clinical-codes-org/Symptom code lists/Headache/Where this code list comes from .docx similarity index 100% rename from examples/codes/clinical-codes-org/Symptom code lists/Headache/Where this code list comes from .docx rename to examples/concepts/clinical-codes-org/Symptom code lists/Headache/Where this code list comes from .docx diff --git a/examples/codes/clinical-codes-org/Symptom code lists/Headache/res175-headache.csv b/examples/concepts/clinical-codes-org/Symptom code lists/Headache/res175-headache.csv similarity index 100% rename from examples/codes/clinical-codes-org/Symptom code lists/Headache/res175-headache.csv rename to examples/concepts/clinical-codes-org/Symptom code lists/Headache/res175-headache.csv diff --git a/examples/codes/clinical-codes-org/Symptom code lists/Incontinence/Where this code list comes from .docx b/examples/concepts/clinical-codes-org/Symptom code lists/Incontinence/Where this code list comes from .docx similarity index 100% rename from examples/codes/clinical-codes-org/Symptom code lists/Incontinence/Where this code list comes from .docx rename to examples/concepts/clinical-codes-org/Symptom code lists/Incontinence/Where this code list comes from .docx diff --git a/examples/codes/clinical-codes-org/Symptom code lists/Incontinence/res11-incontinence.csv b/examples/concepts/clinical-codes-org/Symptom code lists/Incontinence/res11-incontinence.csv similarity index 100% rename from examples/codes/clinical-codes-org/Symptom code lists/Incontinence/res11-incontinence.csv rename to examples/concepts/clinical-codes-org/Symptom code lists/Incontinence/res11-incontinence.csv diff --git a/examples/codes/clinical-codes-org/Symptom code lists/Musculoskeletal pain/Where this code list comes from .docx b/examples/concepts/clinical-codes-org/Symptom code lists/Musculoskeletal pain/Where this code list comes from .docx similarity index 100% rename from examples/codes/clinical-codes-org/Symptom code lists/Musculoskeletal pain/Where this code list comes from .docx rename to examples/concepts/clinical-codes-org/Symptom code lists/Musculoskeletal pain/Where this code list comes from .docx diff --git a/examples/codes/clinical-codes-org/Symptom code lists/Musculoskeletal pain/res175-msk-pain.csv b/examples/concepts/clinical-codes-org/Symptom code lists/Musculoskeletal pain/res175-msk-pain.csv similarity index 100% rename from examples/codes/clinical-codes-org/Symptom code lists/Musculoskeletal pain/res175-msk-pain.csv rename to examples/concepts/clinical-codes-org/Symptom code lists/Musculoskeletal pain/res175-msk-pain.csv diff --git a/examples/codes/clinical-codes-org/Symptom code lists/Neuropathic pain/Where this code list comes from .docx b/examples/concepts/clinical-codes-org/Symptom code lists/Neuropathic pain/Where this code list comes from .docx similarity index 100% rename from examples/codes/clinical-codes-org/Symptom code lists/Neuropathic pain/Where this code list comes from .docx rename to examples/concepts/clinical-codes-org/Symptom code lists/Neuropathic pain/Where this code list comes from .docx diff --git a/examples/codes/clinical-codes-org/Symptom code lists/Neuropathic pain/res55-neuropathic_pain.csv b/examples/concepts/clinical-codes-org/Symptom code lists/Neuropathic pain/res55-neuropathic_pain.csv similarity index 100% rename from examples/codes/clinical-codes-org/Symptom code lists/Neuropathic pain/res55-neuropathic_pain.csv rename to examples/concepts/clinical-codes-org/Symptom code lists/Neuropathic pain/res55-neuropathic_pain.csv diff --git a/examples/codes/clinical-codes-org/Symptom code lists/Sleep problems/Where this code list comes from .docx b/examples/concepts/clinical-codes-org/Symptom code lists/Sleep problems/Where this code list comes from .docx similarity index 100% rename from examples/codes/clinical-codes-org/Symptom code lists/Sleep problems/Where this code list comes from .docx rename to examples/concepts/clinical-codes-org/Symptom code lists/Sleep problems/Where this code list comes from .docx diff --git a/examples/codes/clinical-codes-org/Symptom code lists/Sleep problems/res175-sleep-problems.csv b/examples/concepts/clinical-codes-org/Symptom code lists/Sleep problems/res175-sleep-problems.csv similarity index 100% rename from examples/codes/clinical-codes-org/Symptom code lists/Sleep problems/res175-sleep-problems.csv rename to examples/concepts/clinical-codes-org/Symptom code lists/Sleep problems/res175-sleep-problems.csv diff --git a/examples/codes/clinical-codes-org/Symptom code lists/Stress/Where this code list comes from .docx b/examples/concepts/clinical-codes-org/Symptom code lists/Stress/Where this code list comes from .docx similarity index 100% rename from examples/codes/clinical-codes-org/Symptom code lists/Stress/Where this code list comes from .docx rename to examples/concepts/clinical-codes-org/Symptom code lists/Stress/Where this code list comes from .docx diff --git a/examples/codes/clinical-codes-org/Symptom code lists/Stress/res175-stress.csv b/examples/concepts/clinical-codes-org/Symptom code lists/Stress/res175-stress.csv similarity index 100% rename from examples/codes/clinical-codes-org/Symptom code lists/Stress/res175-stress.csv rename to examples/concepts/clinical-codes-org/Symptom code lists/Stress/res175-stress.csv diff --git a/examples/codes/hanlon/Hanlon_drug_read_codes.csv b/examples/concepts/hanlon/Hanlon_drug_read_codes.csv similarity index 100% rename from examples/codes/hanlon/Hanlon_drug_read_codes.csv rename to examples/concepts/hanlon/Hanlon_drug_read_codes.csv diff --git a/examples/codes/hanlon/MM_code_names.csv b/examples/concepts/hanlon/MM_code_names.csv similarity index 100% rename from examples/codes/hanlon/MM_code_names.csv rename to examples/concepts/hanlon/MM_code_names.csv diff --git a/examples/codes/hanlon/Read_codes_for_diagnoses.csv b/examples/concepts/hanlon/Read_codes_for_diagnoses.csv similarity index 100% rename from examples/codes/hanlon/Read_codes_for_diagnoses.csv rename to examples/concepts/hanlon/Read_codes_for_diagnoses.csv diff --git a/examples/codes/hanlon/Read_codes_for_drug_mm_count_diagnoses.csv b/examples/concepts/hanlon/Read_codes_for_drug_mm_count_diagnoses.csv similarity index 100% rename from examples/codes/hanlon/Read_codes_for_drug_mm_count_diagnoses.csv rename to examples/concepts/hanlon/Read_codes_for_drug_mm_count_diagnoses.csv diff --git a/tests/test_acmc.py b/tests/test_acmc.py index 4b7e82df34b2c213fcc5606afaadf14593f7e56f..a9bda409c29f9c014257d6a39fa654dd84333644 100644 --- a/tests/test_acmc.py +++ b/tests/test_acmc.py @@ -5,7 +5,7 @@ import shutil import logging from pathlib import Path -from acmc import trud, omop, main, logging_config as lc +from acmc import trud, omop, main, phen, logging_config as lc # setup logging lc.setup_logger() @@ -71,7 +71,7 @@ def test_phen_workflow(tmp_dir, monkeypatch, caplog, config_file): with caplog.at_level(logging.DEBUG): # validate phenotype # copy examples across - shutil.rmtree(phen_path / "codes") + shutil.rmtree(phen_path / phen.CONCEPTS_DIR) ex_path = Path("./examples").resolve() for item in ex_path.iterdir(): source = ex_path / item.name @@ -182,7 +182,7 @@ def test_diff(tmp_dir, monkeypatch, caplog): main.main() # copy example codes - shutil.rmtree(phen_path / "codes") + shutil.rmtree(phen_path / phen.CONCEPTS_DIR) ex_path = Path("./examples").resolve() for item in ex_path.iterdir(): source = ex_path / item.name