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

Initial randomisation app commit #176

Merged
merged 3 commits into from
Apr 22, 2024
Merged

Conversation

erikh360
Copy link
Collaborator

No description provided.

from django.utils.text import slugify


class Strata(models.Model):
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed these models a bit now. Strategy isn't a parent of Strata anymore. You can now setup stratas and use them in multiple strategies.

Copy link
Contributor

@KaitCrawford KaitCrawford left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 small checks but 👍 regardless

from randomisation.models import StrataMatrix


def validate_stratification_data(strategy, data):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got confused by this so I'm just checking: here we are validating that "data" (which would come from the API request) looks like a valid option for this strategy. Is that right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I'm planning on adding docstrings that would make this clear

stratas[f"{random_age}_{random_province}"][random_arm] += 1
totals[random_arm] += 1

totals["Arm 1"] += 4
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to add 4 to this arm?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

haha this is me testing that it actually fails if not balanced. probably explains why the tests are failing

@erikh360 erikh360 merged commit 7c39594 into develop Apr 22, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants