This repository was archived by the owner on Oct 16, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodels.py
More file actions
76 lines (56 loc) · 2.23 KB
/
models.py
File metadata and controls
76 lines (56 loc) · 2.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
class Category(models.Model):
"""
actually our wiki, containing concepts and tags, linked to by markdown
"""
category = models.CharField(max_length=64, primary_key=True) # Local Authority, Planning Authority, etc
text = models.TextField()
class Organisation(models.Model):
organisation = models.CharField(max_length=64, primary_key=True) # government-organisation:D6
name = models.CharField(max_length=256)
website = models.CharField(max_length=256)
area = models.ForeignKey(Area)
text = models.TextField()
class Licence(models.Model):
licence = models.CharField(max_length=64, primary_key=True)
name = models.CharField(max_length=256)
text = models.TextField()
class Attribution(models.Model):
attribution = models.CharField(max_length=64, primary_key=True)
name = models.CharField(max_length=256)
class Publication(models.Model):
"""
documents published by an organisation
"""
publication = models.CharField(max_length=64, primary_key=True)
name = models.CharField(max_length=256)
organisation = models.ForeignKey(Organisation)
licence = models.ForeignKey(Licence)
attribution = models.ForeignKey(Attribution)
category = models.ForeignKey(Category)
url = models.URLField()
data_url = models.URLField()
# task = models.ForeignKey(Task) # how to fetch an edition ..
class Edition(models.Model):
"""
instance of a publication
"""
publication = models.ForeignKey(Publication)
collected = models.DateTimeField()
class Dataset(models.Model):
"""
a register or pseudo register built from a publication for our domain ..
"""
dataset = models.CharField(max_length=64, primary_key=True)
class Datatype(models.Model):
datatype = models.CharField(max_length=64, primary_key=True)
text = models.TextField()
class Field(models.Model):
field = models.CharField(max_length=64, primary_key=True)
text = models.TextField()
datatype = models.ForeignKey(Datatype)
class Value(models.Model):
field = models.ForeignKey(Field)
value = models.TextField() # contents depending on datatype
class Item(models.Model):
dataset = models.ForeignKey(Dataset)
values = models.ManyToMany(Value)