Ticket #32805: forecast.py

File forecast.py, 1.2 KB (added by Matthew Cornell, 3 years ago)
Line 
1from django.db import models
2
3from forecast_app.models.forecast_model import ForecastModel
4from forecast_app.models.project import TimeZero
5
6
7class Forecast(models.Model):
8 class Meta:
9 constraints = [
10 models.UniqueConstraint(fields=['forecast_model', 'time_zero', 'issued_at'], name='unique_version'),
11 ]
12
13
14 forecast_model = models.ForeignKey(ForecastModel, related_name='forecasts', on_delete=models.CASCADE)
15
16 source = models.TextField(help_text="file name of the source of this forecast's prediction data")
17
18 time_zero = models.ForeignKey(TimeZero, on_delete=models.CASCADE,
19 help_text="TimeZero that this forecast is in relation to.")
20
21 created_at = models.DateTimeField(auto_now_add=True)
22
23 issued_at = models.DateTimeField(db_index=True, null=False)
24
25 notes = models.TextField(null=True, blank=True,
26 help_text="Text describing anything slightly different about a given forecast, e.g., a "
27 "changed set of assumptions or a comment about when the forecast was created. "
28 "Notes should be brief, typically less than 50 words.")
Back to Top