Skip to content

Commit

Permalink
fix: Set file type "Non-GWAS-SSF" when force valid (#350)
Browse files Browse the repository at this point in the history
* fix: Set file type "Non-GWAS-SSF" when force valid

* fix: Determine correct file type in post endpoint
  • Loading branch information
karatugo authored Jun 26, 2024
1 parent 7ebb345 commit 3cf8f7e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
10 changes: 8 additions & 2 deletions sumstats_service/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,10 @@ def sumstats():
# option to bypass all validation and downstream steps
bypass = au.val_from_dict(key="skipValidation", dict=content, default=False)

file_type = au.determine_file_type(is_in_file=True, is_bypass=bypass)
file_type = au.determine_file_type(
is_in_file=True,
is_force_valid=bool(force_valid),
)

logger.info(f"{minrows=} {force_valid=} {bypass=} {file_type=}")

Expand Down Expand Up @@ -156,7 +159,10 @@ def validate_sumstats(callback_id: str):

# determine file_type
template = au.get_template(callback_id)
file_type = au.determine_file_type(is_in_file=bool(template), is_bypass=bypass)
file_type = au.determine_file_type(
is_in_file=bool(template),
is_force_valid=bool(force_valid),
)

validate_files_in_background.apply_async(
kwargs={
Expand Down
10 changes: 6 additions & 4 deletions sumstats_service/resources/api_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,10 +348,12 @@ def move_files_to_staging(study_list):
}


def determine_file_type(is_in_file, is_bypass) -> str:
if is_bypass:
return "Non-GWAS-SSF"
return config.SUMSTATS_FILE_TYPE + ("-incomplete-meta" if not is_in_file else "")
def determine_file_type(is_in_file, is_force_valid) -> str:
return (
"Non-GWAS-SSF"
if is_force_valid
else config.SUMSTATS_FILE_TYPE + ("-incomplete-meta" if not is_in_file else "")
)


def get_template(callback_id):
Expand Down

0 comments on commit 3cf8f7e

Please sign in to comment.