Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cherry-picked and edited BCO Score in services.py #336

Merged
merged 1 commit into from
Jul 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 25 additions & 3 deletions biocompute/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -608,14 +608,36 @@ def bco_score(bco_instance: Bco) -> Bco:
if "usability_domain" not in contents:
bco_instance.score = 0
return bco_instance

try:
usability_domain_length = sum(len(s) for s in contents['usability_domain'])
score = {"usability_domain_length": usability_domain_length}
except TypeError:
score = {"usability_domain_length": 0}
usability_domain_length = 0

bco_instance.score = usability_domain_length

# Calculate the base score
base_score = usability_domain_length

# Apply the field length modifier
field_length_modifier = 1.2
base_score *= field_length_modifier

# Check for the existence of the error domain
error_domain_exists = "error_domain" in contents
if error_domain_exists:
base_score += 5

# Apply the parametric object multiplier
parametric_object_count = len(contents.get('parametric_objects', []))
parametric_object_multiplier = 1.1
base_score *= (parametric_object_multiplier ** parametric_object_count)

# Add score for each reviewer object (up to 5)
reviewer_object_count = min(5, len(contents.get('reviewer_objects', [])))
base_score += reviewer_object_count

# Finalize the score
bco_instance.score = base_score

return bco_instance
Loading