Skip to content

Commit

Permalink
Create run_validation function for the package
Browse files Browse the repository at this point in the history
* create run_validation function

* update table result
  • Loading branch information
Anita Caron authored Jan 26, 2024
1 parent 4d39f73 commit 65d4f34
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
28 changes: 19 additions & 9 deletions src/relation_validator/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,13 @@
split_terms, verify_relationship)


def validate(args):
def run_validation(data: pd.DataFrame, relationships: dict) -> pd.DataFrame:
"""
Validate process
Validation process for each relationship
"""
config = get_config(args.input)
if not config:
return exit

data = pd.read_csv(config["filename"])
terms_pairs = get_pairs(data)

for _, rel in config["relationships"].items():
for _, rel in relationships.items():
_, terms_pairs = verify_relationship(terms_pairs, rel)

terms_s, terms_o = split_terms(terms_pairs)
Expand All @@ -26,7 +21,22 @@ def validate(args):
data[["s", "o"]].apply(tuple, 1).isin(zip(terms_s, terms_o))
]

rows_nv.to_csv(args.output, index=False)
return rows_nv


def validate(args):
"""
Validate process
"""
config = get_config(args.input)
if not config:
return exit

data = pd.read_csv(config["filename"])

report = run_validation(data, config["relationships"])

report.to_csv(args.output, index=False)


def ontologies_version(args):
Expand Down
1 change: 0 additions & 1 deletion tests/test-results.csv
Original file line number Diff line number Diff line change
Expand Up @@ -2226,7 +2226,6 @@ http://purl.org/ccf/latest/ccf.owl#VHFUrinaryBladder,http://purl.org/ccf/latest/
http://purl.org/ccf/latest/ccf.owl#VHFUterus,http://purl.org/ccf/latest/ccf.owl#VHFemaleOrgans_VH_F_body_of_uterus,UBERON:0009853,UBERON:0000002,body of uterus,uterine cervix
http://purl.org/ccf/latest/ccf.owl#VHFUterus,http://purl.org/ccf/latest/ccf.owl#VHFemaleOrgans_VH_F_internal_cervical_os,UBERON:0013759,UBERON:0000002,internal cervical os,uterine cervix
http://purl.org/ccf/latest/ccf.owl#VHFUterus,http://purl.org/ccf/latest/ccf.owl#VHFemaleOrgans_VH_F_external_cervical_os,UBERON:0013760,UBERON:0000002,external cervical os,uterine cervix
http://purl.org/ccf/latest/ccf.owl#VHFPlacenta,http://purl.org/ccf/latest/ccf.owl#VHFPlacenta,UBERON:0001987,UBERON:0004027,Placenta,chorionic plate
http://purl.org/ccf/latest/ccf.owl#VHFPlacenta,http://purl.org/ccf/latest/ccf.owl#VHFPlacenta,UBERON:0001987,UBERON:0000305,Placenta,amnion
http://purl.org/ccf/latest/ccf.owl#VHFPlacenta,http://purl.org/ccf/latest/ccf.owl#VHFemaleOrgans_VH_F_chorionic_plate,UBERON:0004027,UBERON:0000305,chorionic plate,amnion
http://purl.org/ccf/latest/ccf.owl#VHFPlacenta,http://purl.org/ccf/latest/ccf.owl#VHFemaleOrgans_VH_F_amnion,UBERON:0000305,UBERON:0004027,amnion,chorionic plate
Expand Down

0 comments on commit 65d4f34

Please sign in to comment.