You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

334 lines
13 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
5 years ago
2 years ago
5 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
5 years ago
2 years ago
5 years ago
2 years ago
5 years ago
2 years ago
5 years ago
2 years ago
5 years ago
2 years ago
5 years ago
2 years ago
5 years ago
2 years ago
5 years ago
2 years ago
5 years ago
2 years ago
5 years ago
2 years ago
5 years ago
2 years ago
5 years ago
2 years ago
5 years ago
2 years ago
2 years ago
2 years ago
5 years ago
2 years ago
5 years ago
2 years ago
5 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. # Generated by Django 2.1.7 on 2019-10-25 16:26
  2. import django.db.models.deletion
  3. from django.conf import settings
  4. from django.db import migrations, models
  5. class Migration(migrations.Migration):
  6. initial = True
  7. dependencies = [
  8. migrations.swappable_dependency(settings.AUTH_USER_MODEL),
  9. ("contenttypes", "0002_remove_content_type_name"),
  10. ]
  11. operations = [
  12. migrations.CreateModel(
  13. name="Document",
  14. fields=[
  15. ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
  16. ("text", models.TextField()),
  17. ("meta", models.TextField(default="{}")),
  18. ("created_at", models.DateTimeField(auto_now_add=True)),
  19. ("updated_at", models.DateTimeField(auto_now=True)),
  20. (
  21. "annotations_approved_by",
  22. models.ForeignKey(
  23. null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL
  24. ),
  25. ),
  26. ],
  27. ),
  28. migrations.CreateModel(
  29. name="DocumentAnnotation",
  30. fields=[
  31. ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
  32. ("prob", models.FloatField(default=0.0)),
  33. ("manual", models.BooleanField(default=False)),
  34. ("created_at", models.DateTimeField(auto_now_add=True)),
  35. ("updated_at", models.DateTimeField(auto_now=True)),
  36. (
  37. "document",
  38. models.ForeignKey(
  39. on_delete=django.db.models.deletion.CASCADE, related_name="doc_annotations", to="api.Document"
  40. ),
  41. ),
  42. ],
  43. ),
  44. migrations.CreateModel(
  45. name="Label",
  46. fields=[
  47. ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
  48. ("text", models.CharField(max_length=100)),
  49. (
  50. "prefix_key",
  51. models.CharField(
  52. blank=True,
  53. choices=[("ctrl", "ctrl"), ("shift", "shift"), ("ctrl shift", "ctrl shift")],
  54. max_length=10,
  55. null=True,
  56. ),
  57. ),
  58. (
  59. "suffix_key",
  60. models.CharField(
  61. blank=True,
  62. choices=[
  63. ("a", "a"),
  64. ("b", "b"),
  65. ("c", "c"),
  66. ("d", "d"),
  67. ("e", "e"),
  68. ("f", "f"),
  69. ("g", "g"),
  70. ("h", "h"),
  71. ("i", "i"),
  72. ("j", "j"),
  73. ("k", "k"),
  74. ("l", "l"),
  75. ("m", "m"),
  76. ("n", "n"),
  77. ("o", "o"),
  78. ("p", "p"),
  79. ("q", "q"),
  80. ("r", "r"),
  81. ("s", "s"),
  82. ("t", "t"),
  83. ("u", "u"),
  84. ("v", "v"),
  85. ("w", "w"),
  86. ("x", "x"),
  87. ("y", "y"),
  88. ("z", "z"),
  89. ],
  90. max_length=1,
  91. null=True,
  92. ),
  93. ),
  94. ("background_color", models.CharField(default="#209cee", max_length=7)),
  95. ("text_color", models.CharField(default="#ffffff", max_length=7)),
  96. ("created_at", models.DateTimeField(auto_now_add=True)),
  97. ("updated_at", models.DateTimeField(auto_now=True)),
  98. ],
  99. ),
  100. migrations.CreateModel(
  101. name="Project",
  102. fields=[
  103. ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
  104. ("name", models.CharField(max_length=100)),
  105. ("description", models.TextField(default="")),
  106. ("guideline", models.TextField(default="")),
  107. ("created_at", models.DateTimeField(auto_now_add=True)),
  108. ("updated_at", models.DateTimeField(auto_now=True)),
  109. (
  110. "project_type",
  111. models.CharField(
  112. choices=[
  113. ("DocumentClassification", "document classification"),
  114. ("SequenceLabeling", "sequence labeling"),
  115. ("Seq2seq", "sequence to sequence"),
  116. ],
  117. max_length=30,
  118. ),
  119. ),
  120. ("randomize_document_order", models.BooleanField(default=False)),
  121. ("collaborative_annotation", models.BooleanField(default=False)),
  122. ],
  123. options={
  124. "abstract": False,
  125. "base_manager_name": "objects",
  126. },
  127. ),
  128. migrations.CreateModel(
  129. name="Role",
  130. fields=[
  131. ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
  132. ("name", models.CharField(max_length=100, unique=True)),
  133. ("description", models.TextField(default="")),
  134. ("created_at", models.DateTimeField(auto_now_add=True)),
  135. ("updated_at", models.DateTimeField(auto_now=True)),
  136. ],
  137. ),
  138. migrations.CreateModel(
  139. name="RoleMapping",
  140. fields=[
  141. ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
  142. ("created_at", models.DateTimeField(auto_now_add=True)),
  143. ("updated_at", models.DateTimeField(auto_now=True)),
  144. ],
  145. ),
  146. migrations.CreateModel(
  147. name="Seq2seqAnnotation",
  148. fields=[
  149. ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
  150. ("prob", models.FloatField(default=0.0)),
  151. ("manual", models.BooleanField(default=False)),
  152. ("created_at", models.DateTimeField(auto_now_add=True)),
  153. ("updated_at", models.DateTimeField(auto_now=True)),
  154. ("text", models.CharField(max_length=500)),
  155. (
  156. "document",
  157. models.ForeignKey(
  158. on_delete=django.db.models.deletion.CASCADE,
  159. related_name="seq2seq_annotations",
  160. to="api.Document",
  161. ),
  162. ),
  163. ("user", models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
  164. ],
  165. ),
  166. migrations.CreateModel(
  167. name="SequenceAnnotation",
  168. fields=[
  169. ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
  170. ("prob", models.FloatField(default=0.0)),
  171. ("manual", models.BooleanField(default=False)),
  172. ("created_at", models.DateTimeField(auto_now_add=True)),
  173. ("updated_at", models.DateTimeField(auto_now=True)),
  174. ("start_offset", models.IntegerField()),
  175. ("end_offset", models.IntegerField()),
  176. (
  177. "document",
  178. models.ForeignKey(
  179. on_delete=django.db.models.deletion.CASCADE, related_name="seq_annotations", to="api.Document"
  180. ),
  181. ),
  182. ("label", models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to="api.Label")),
  183. ("user", models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
  184. ],
  185. ),
  186. migrations.CreateModel(
  187. name="Seq2seqProject",
  188. fields=[
  189. (
  190. "project_ptr",
  191. models.OneToOneField(
  192. auto_created=True,
  193. on_delete=django.db.models.deletion.CASCADE,
  194. parent_link=True,
  195. primary_key=True,
  196. serialize=False,
  197. to="api.Project",
  198. ),
  199. ),
  200. ],
  201. options={
  202. "abstract": False,
  203. "base_manager_name": "objects",
  204. },
  205. bases=("api.project",),
  206. ),
  207. migrations.CreateModel(
  208. name="SequenceLabelingProject",
  209. fields=[
  210. (
  211. "project_ptr",
  212. models.OneToOneField(
  213. auto_created=True,
  214. on_delete=django.db.models.deletion.CASCADE,
  215. parent_link=True,
  216. primary_key=True,
  217. serialize=False,
  218. to="api.Project",
  219. ),
  220. ),
  221. ],
  222. options={
  223. "abstract": False,
  224. "base_manager_name": "objects",
  225. },
  226. bases=("api.project",),
  227. ),
  228. migrations.CreateModel(
  229. name="TextClassificationProject",
  230. fields=[
  231. (
  232. "project_ptr",
  233. models.OneToOneField(
  234. auto_created=True,
  235. on_delete=django.db.models.deletion.CASCADE,
  236. parent_link=True,
  237. primary_key=True,
  238. serialize=False,
  239. to="api.Project",
  240. ),
  241. ),
  242. ],
  243. options={
  244. "abstract": False,
  245. "base_manager_name": "objects",
  246. },
  247. bases=("api.project",),
  248. ),
  249. migrations.AddField(
  250. model_name="rolemapping",
  251. name="project",
  252. field=models.ForeignKey(
  253. on_delete=django.db.models.deletion.CASCADE, related_name="role_mappings", to="api.Project"
  254. ),
  255. ),
  256. migrations.AddField(
  257. model_name="rolemapping",
  258. name="role",
  259. field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to="api.Role"),
  260. ),
  261. migrations.AddField(
  262. model_name="rolemapping",
  263. name="user",
  264. field=models.ForeignKey(
  265. on_delete=django.db.models.deletion.CASCADE, related_name="role_mappings", to=settings.AUTH_USER_MODEL
  266. ),
  267. ),
  268. migrations.AddField(
  269. model_name="project",
  270. name="polymorphic_ctype",
  271. field=models.ForeignKey(
  272. editable=False,
  273. null=True,
  274. on_delete=django.db.models.deletion.CASCADE,
  275. related_name="polymorphic_api.project_set+",
  276. to="contenttypes.ContentType",
  277. ),
  278. ),
  279. migrations.AddField(
  280. model_name="project",
  281. name="users",
  282. field=models.ManyToManyField(related_name="projects", to=settings.AUTH_USER_MODEL),
  283. ),
  284. migrations.AddField(
  285. model_name="label",
  286. name="project",
  287. field=models.ForeignKey(
  288. on_delete=django.db.models.deletion.CASCADE, related_name="labels", to="api.Project"
  289. ),
  290. ),
  291. migrations.AddField(
  292. model_name="documentannotation",
  293. name="label",
  294. field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to="api.Label"),
  295. ),
  296. migrations.AddField(
  297. model_name="documentannotation",
  298. name="user",
  299. field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
  300. ),
  301. migrations.AddField(
  302. model_name="document",
  303. name="project",
  304. field=models.ForeignKey(
  305. on_delete=django.db.models.deletion.CASCADE, related_name="documents", to="api.Project"
  306. ),
  307. ),
  308. migrations.AlterUniqueTogether(
  309. name="sequenceannotation",
  310. unique_together={("document", "user", "label", "start_offset", "end_offset")},
  311. ),
  312. migrations.AlterUniqueTogether(
  313. name="seq2seqannotation",
  314. unique_together={("document", "user", "text")},
  315. ),
  316. migrations.AlterUniqueTogether(
  317. name="rolemapping",
  318. unique_together={("user", "project", "role")},
  319. ),
  320. migrations.AlterUniqueTogether(
  321. name="label",
  322. unique_together={("project", "text")},
  323. ),
  324. migrations.AlterUniqueTogether(
  325. name="documentannotation",
  326. unique_together={("document", "user", "label")},
  327. ),
  328. ]