Skip to content
Snippets Groups Projects
Commit 1e099555 authored by mjbonifa's avatar mjbonifa
Browse files

(refactor) Changed codes to concepts directory for alignment with OMOP. Closes #52

parent a4172529
Branches
No related tags found
No related merge requests found
Showing
with 8 additions and 8 deletions
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment