1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- """Scientific method lives here!"""
- from django.db import models
- # Scientific method components:
- #
- # Question
- # Hypothesis
- # Prediction
- # Experiment(Testing)
- # Analysis
- class BaseModel(models.Model):
- created_at = models.DateTimeField(auto_now_add=True)
- updated_at = models.DateTimeField(auto_now=True)
- class Meta:
- abstract = True
- # bad boy
- # request --> some view --> some function --> BANG !! ...
- # good boy
- # request --> some view --> some function --> some other --> response
- class Flow(models.Model):
- """Abstract representation of steps to be reduced for seeking the root cause"""
- pass
- class System(models.Model):
- """Short name for the environment: "Download manager", "Video player"..."""
- name = models.CharField(max_length=255)
- class Observation(BaseModel):
- """Step of the SM"""
- description = models.CharField(max_length=255)
- class Hypothesis(BaseModel):
- """Proposed explanation for a phenomenon; To be checked"""
- proposition = models.CharField(max_length=255)
- is_valid = models.NullBooleanField(blank=True, null=True)
-
- class Story(BaseModel):
- """Represent the concrete case of debug session.
- initial_statement: the origin of the bug -- short line describes what's wrong;
- description: what the system looks like?
- system: what is the system?
- conclusion: detailed explanation why does issue appear;
- final_statement: summarized result of investigation
- Tip:
- Describe the breakage first in Passive Verb Forms, then clarify it in Active form
- """
- initial_statement = models.CharField(max_length=255)
- final_statement = models.CharField(max_length=255, blank=True, null=True)
- # TODO: maybe should be named `scope'?
- description = models.TextField()
- hypotheses = models.ForeignKey(
- Hypothesis, on_delete=models.CASCADE, related_name='phenomenon', null=True
- )
- observation = models.ForeignKey(
- Observation, on_delete=models.CASCADE, null=True
- )
- conclusion = models.TextField(blank=True, null=True)
- system = models.ForeignKey(System, on_delete=models.CASCADE)
|