Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERM-1089 - added NeoContext,NeoDefintion,NeoAlias, and updated NeoTerm #43

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ celerybeat.pid
# Environments
.env
.venv
ldss-3.7
env/
venv/
ENV/
Expand Down
21 changes: 21 additions & 0 deletions app/core/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

from core.models import (ChildTermSet, SchemaLedger, Term, TermSet,
TransformationLedger)
from django_neomodel import admin as neomodel_admin
from core.models import AliasNode, ContextNode, DefinitionNode


# Register your models here.
Expand Down Expand Up @@ -110,3 +112,22 @@ def get_form(self, request, obj=None, **kwargs):
form.base_fields['mapping'].queryset = Term.objects.exclude(
iri__startswith=obj.root_term_set())
return form

class AliasNodeAdmin(admin.ModelAdmin):
list_display = ('alias', 'term')
readonly_fields = ('alias', 'term')


neomodel_admin.register(AliasNode, AliasNodeAdmin)

class ContextNodeAdmin(admin.ModelAdmin):
list_display = ('context', 'context_description')
readonly_fields = ('context', 'context_description')

neomodel_admin.register(ContextNode, ContextNodeAdmin)

class DefinitionNodeAdmin(admin.ModelAdmin):
list_display = ('definition')
readonly_fields = ('definition')

neomodel_admin.register(DefinitionNode, DefinitionNodeAdmin)
29 changes: 29 additions & 0 deletions app/core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
from model_utils.models import TimeStampedModel

from core.management.utils.xss_helper import bleach_data_to_json
from neomodel import StringProperty, RelationshipTo, RelationshipFrom
from django_neomodel import DjangoNode

logger = logging.getLogger('dict_config_logger')

Expand Down Expand Up @@ -431,3 +433,30 @@ def clean(self):
self.schema_mapping = json_bleach
json_file.close()
self.schema_mapping_file = None

class NeoTerm(DjangoNode):
uid = StringProperty(unique_index=True)
term = StringProperty(required=True)
definition = RelationshipTo('DefinitionNode', 'DEFINITION_OF')

class NeoAlias(DjangoNode):

alias = StringProperty(unique_index=True)
term = RelationshipFrom('TermNode', 'ALIAS_OF')
context = RelationshipTo('ContextNode', 'ALIAS_TO')


class NeoContext(DjangoNode):

context = StringProperty(unique = True)
context_description = StringProperty(required=True)
alias = RelationshipFrom('AliasNode', 'ALIAS_TO_CONTEXT')
definition_node = RelationshipTo('DefinitionNode', 'CONTEXT_TO_DEFINITION' )

class NeoDefinition(DjangoNode):

definition = StringProperty(required=True)




6 changes: 6 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,9 @@ django-colorfield>=0.11.0
python-slugify>=8.0.1

text-unidecode>=1.3

neomodel>=5.1.0

pandas>=0.23.4

django-neomodel>=0.1.1
Loading