Files
edx-platform/lms/djangoapps/experiments/models.py
Brian Mesick e478975105 chore: Add missing PII annotations, update safelist
PII Annotations are very out of date, this commit adds most that were
missing in edx-platform, and some additional annotations to the
safelist. It is not comprehensive, several other upstream Open edX
packages also need to be updated. It also does not include removing
annotations that have been moved upstream, or been removed entirely.
Those are separate follow-on tasks.
2024-11-05 12:58:36 -05:00

57 lines
1.6 KiB
Python

"""
Experimentation models
"""
from django.conf import settings
from django.db import models
from model_utils.models import TimeStampedModel
from simple_history.models import HistoricalRecords
class ExperimentData(TimeStampedModel):
"""
ExperimentData stores user-specific key-values associated with experiments
identified by experiment_id.
.. no_pii:
"""
user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)
experiment_id = models.PositiveSmallIntegerField(
null=False, blank=False, db_index=True, verbose_name='Experiment ID'
)
key = models.CharField(null=False, blank=False, max_length=255)
value = models.TextField()
class Meta:
index_together = (
('user', 'experiment_id'),
)
verbose_name = 'Experiment Data'
verbose_name_plural = 'Experiment Data'
unique_together = (
('user', 'experiment_id', 'key'),
)
class ExperimentKeyValue(TimeStampedModel):
"""
ExperimentData stores any generic key-value associated with experiments
identified by experiment_id.
.. no_pii:
"""
experiment_id = models.PositiveSmallIntegerField(
null=False, blank=False, db_index=True, verbose_name='Experiment ID'
)
key = models.CharField(null=False, blank=False, max_length=255)
value = models.TextField()
history = HistoricalRecords()
class Meta:
verbose_name = 'Experiment Key-Value Pair'
verbose_name_plural = 'Experiment Key-Value Pairs'
unique_together = (
('experiment_id', 'key'),
)