Skip to content

Commit

Permalink
Merge pull request #138 from diging/develop
Browse files Browse the repository at this point in the history
Story/vgnwb 257 (#137)
  • Loading branch information
tjquinn1 authored Apr 11, 2019
2 parents 6ea1483 + 38b35c9 commit daa40b7
Show file tree
Hide file tree
Showing 35 changed files with 15,917 additions and 967 deletions.
2 changes: 0 additions & 2 deletions .env

This file was deleted.

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,6 @@ target/
*.rdb

node_modules
.DS_STORE
.env
.vscode
1 change: 0 additions & 1 deletion annotations/fixtures/embryo_fixture.json

This file was deleted.

Empty file removed annotations/graphs.py
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2019-03-13 20:19
from __future__ import unicode_literals

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('annotations', '0032_auto_20170523_1753'),
]

operations = [
migrations.AddField(
model_name='relationtemplate',
name='use_in_mass_assignment',
field=models.BooleanField(default=False),
),
]
4 changes: 4 additions & 0 deletions annotations/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -998,6 +998,10 @@ class RelationTemplate(models.Model):
"""Pattern for representing the relation in normal language."""

_terminal_nodes = models.TextField(blank=True, null=True)
use_in_mass_assignment = models.BooleanField(default=False)

def __str__(self):
return self.name

def _get_terminal_nodes(self):
return self._terminal_nodes
Expand Down
2 changes: 0 additions & 2 deletions annotations/relations.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,8 +326,6 @@ def generate_expression(template, relations):
expression_keys = [k[1].replace('_', '') for k in Formatter().parse(template.expression)
if k[1] is not None]
expression_data = {}
print expression_keys
print relations
for key in expression_keys:
try:
relation = relations[int(key[0])]
Expand Down
42 changes: 27 additions & 15 deletions annotations/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,19 +53,21 @@ class Meta:
class TextSerializer(serializers.ModelSerializer):
class Meta:
model = Text
fields = ('id', 'uri', 'title', 'created', 'added',
'addedBy', 'source', 'annotators', 'annotation_count')
fields = ('id', 'uri', 'title', 'created', 'added', 'addedBy',
'source', 'annotators', 'annotation_count')

def create(self, validated_data):
repository = Repository.objects.get(pk=validated_data['source'])
# TODO: Make retrieval/tokenization/other processing asynchronous.
tokenizedContent = tokenize(retrieve(repository, validated_data['uri']))

text = Text(uri=validated_data['uri'],
title=validated_data['title'],
source=repository,
addedBy=self.context['request'].user,
tokenizedContent=tokenizedContent)
tokenizedContent = tokenize(
retrieve(repository, validated_data['uri']))

text = Text(
uri=validated_data['uri'],
title=validated_data['title'],
source=repository,
addedBy=self.context['request'].user,
tokenizedContent=tokenizedContent)
text.save()
return HttpResponse(text.id)

Expand All @@ -92,7 +94,6 @@ class Meta:
'startPos', 'stringRep', 'tokenIds', 'interpretation_label',
'interpretation_type_label', 'position', 'project')


class AppellationPOSTSerializer(serializers.ModelSerializer):
position = DocumentPositionSerializer(required=False)
tokenIds = serializers.CharField(required=False)
Expand All @@ -105,14 +106,12 @@ class Meta:
'startPos', 'stringRep', 'tokenIds', 'interpretation_label',
'interpretation_type_label', 'position', 'project')


class TypeSerializer(serializers.ModelSerializer):
class Meta:
model = Type
fields = ('id', 'url', 'uri', 'label', 'authority', 'typed',
'description')


class RelationSetSerializer(serializers.ModelSerializer):
appellations = AppellationSerializer(many=True)
date_appellations = DateAppellationSerializer(many=True)
Expand All @@ -121,8 +120,9 @@ class RelationSetSerializer(serializers.ModelSerializer):

class Meta:
model = RelationSet
fields = ('id', 'label', 'created', 'template', 'createdBy', 'occursIn',
'appellations', 'concepts', 'project', 'representation', 'date_appellations' ) #
fields = ('id', 'label', 'created', 'template', 'createdBy',
'occursIn', 'appellations', 'concepts', 'project',
'representation', 'date_appellations') #


class TemporalBoundsSerializer(serializers.ModelSerializer):
Expand All @@ -131,8 +131,20 @@ class Meta:
fields = '__all__'



class TextCollectionSerializer(serializers.ModelSerializer):
class Meta:
model = TextCollection
fields = '__all__'


class TemplatePartSerializer(serializers.ModelSerializer):
class Meta:
model = RelationTemplate
fields = ('id', 'name', 'description')


class TemplateSerializer(serializers.ModelSerializer):
class Meta:
model = RelationTemplate
fields = ('id', 'name', 'description', 'template_parts')
depth = 1
Loading

0 comments on commit daa40b7

Please sign in to comment.