Label and comment models file

This commit is contained in:
Mark Veidemanis 2023-10-17 22:22:45 +01:00
parent cbca55ff49
commit af5f44b89a
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
1 changed files with 90 additions and 1 deletions

View File

@ -79,61 +79,141 @@ class NotificationSettings(models.Model):
class Source(models.Model): class Source(models.Model):
"""
A source of information. Any information.
"""
name = models.CharField(max_length=255, unique=True) name = models.CharField(max_length=255, unique=True)
type = models.CharField(max_length=255, choices=SOURCE_TYPE_CHOICES) type = models.CharField(max_length=255, choices=SOURCE_TYPE_CHOICES)
# Base endpoint for automated crawler processes
endpoint = models.CharField(max_length=1024, blank=True, null=True) endpoint = models.CharField(max_length=1024, blank=True, null=True)
# Score, affects ordering
score = models.IntegerField(blank=True) score = models.IntegerField(blank=True)
class Entry(models.Model): class Entry(models.Model):
"""
A snippet of information located on a Source.
Used to gather conflicting information and store it coherently.
"""
source = models.ForeignKey(Source) source = models.ForeignKey(Source)
slug = models.CharField(max_length=1024)
# Slug of the article on the Source
slug = models.CharField(max_length=1024, null=True, blank=True)
# Extra information can be added
description = models.CharField(max_length=1024, null=True, blank=True)
class Dosage(models.Model): class Dosage(models.Model):
"""
Registers the correlation between dose and intensity.
Linked to Entry to analyse conflicting records.
"""
entry = models.ForeignKey("core.Entry") entry = models.ForeignKey("core.Entry")
# Unit of mass as drugs are diverse
# Dosages varying between micrograms and grams
unit = models.CharField(max_length=255, choices=DOSAGE_UNIT_CHOICES) unit = models.CharField(max_length=255, choices=DOSAGE_UNIT_CHOICES)
# I can no longer say I am sober, but it is slight
threshold = models.IntegerField() threshold = models.IntegerField()
# Light
light = models.IntegerField() light = models.IntegerField()
# Average dose for a user
common = models.IntegerField() common = models.IntegerField()
# Strong intensity, many sober activities may become impossible
strong = models.IntegerField() strong = models.IntegerField()
# Highest intensity
heavy = models.IntegerField() heavy = models.IntegerField()
class Timing(models.Model): class Timing(models.Model):
"""
Registers the time between administration to various experience levels.
Linked to Entry to analyse conflicting records.
"""
entry = models.ForeignKey("core.Entry") entry = models.ForeignKey("core.Entry")
# Unit of time as drugs are diverse
# Half-lives varying between seconds and months
unit = models.CharField( unit = models.CharField(
max_length=255, choices=DOSAGE_TIMING_CHOICES, default="HOURS" max_length=255, choices=DOSAGE_TIMING_CHOICES, default="HOURS"
) )
# It has just now begin, I can no longer say I am sober
onset = models.IntegerField() onset = models.IntegerField()
# The intensity is accelerating
comeup = models.IntegerField() comeup = models.IntegerField()
# The maximum intensity has been reached
# How long this state occurs
peak = models.IntegerField() peak = models.IntegerField()
# How long it takes to get back to baseline
offset = models.IntegerField(null=True, blank=True)
total = models.IntegerField() total = models.IntegerField()
class SEI(models.Model): class SEI(models.Model):
""" """
Subjective Effect Index from Psychonaut Wiki. Subjective Effect Index from Psychonaut Wiki.
Registers a subjective effect in a category, allowing a description to be
specified.
""" """
# PHYSICAL, COGNITIVE, etc
type = models.CharField( type = models.CharField(
max_length=255, choices=SEI_TYPE_CHOICES, default="PHYSICAL" max_length=255, choices=SEI_TYPE_CHOICES, default="PHYSICAL"
) )
# WIP: consider euphoric, depressant, relaxant
# Specify how
description = models.CharField(max_length=4096, blank=True, null=True) description = models.CharField(max_length=4096, blank=True, null=True)
class Effect(models.Model): class Effect(models.Model):
"""
Registers subjective effects for a drug.
Linked to multiple subjective effect indexes all from the same entry.
Linked to Entry to analyse conflicting records.
"""
entry = models.ForeignKey("core.Entry") entry = models.ForeignKey("core.Entry")
# List of subjective effects, since they would likely be from the same entry
subjective_effects = models.ManyToManyField(SEI) subjective_effects = models.ManyToManyField(SEI)
class Action(models.Model): class Action(models.Model):
""" """
Site action record for a drug. Site action record for a drug.
Registers a certain kind of action from a list of receptor sites with a given
affinity.
Linked to Entry to analyse conflicting records.
""" """
entry = models.ForeignKey("core.Entry")
# Site - like 5HT2A for LSD
site = models.CharField(max_length=255, choices=SITE_CHOICES) site = models.CharField(max_length=255, choices=SITE_CHOICES)
# Usually agonist or antagonist
mechanism = models.CharField(max_length=255, choices=MECHANISM_CHOICES) mechanism = models.CharField(max_length=255, choices=MECHANISM_CHOICES)
# Free integer for binding affinity
affinity = models.IntegerField(blank=True) affinity = models.IntegerField(blank=True)
@ -151,10 +231,19 @@ class Drug(models.Model):
# LSD # LSD
common_name = models.CharField(max_length=1024, unique=True) common_name = models.CharField(max_length=1024, unique=True)
# Factsheets, posts
links = models.ManyToManyField(Entry) links = models.ManyToManyField(Entry)
# Dosages, how much to take to get a certain effect
dosages = models.ManyToManyField(Dosage) dosages = models.ManyToManyField(Dosage)
# Timings, how long to wait to reach maximum intensity (and others)
timings = models.ManyToManyField(Timing) timings = models.ManyToManyField(Timing)
# Effects, what does it do on a subjective level?
effects = models.ManyToManyField(Effect) effects = models.ManyToManyField(Effect)
# Actions, what does it do on an objective level?
actions = models.ManyToManyField(Action) actions = models.ManyToManyField(Action)