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 #44

Closed
wants to merge 3 commits 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
20 changes: 20 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 NeoAlias, NeoContext, NeoDefinition


# Register your models here.
Expand Down Expand Up @@ -110,3 +112,21 @@ 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 NeoAliasAdmin(admin.ModelAdmin):
list_display = ('alias', 'term')


neomodel_admin.register(NeoAlias, NeoAliasAdmin)

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

neomodel_admin.register(NeoContext, NeoContextAdmin)

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

neomodel_admin.register(NeoDefinition, NeoDefinitionAdmin)
40 changes: 40 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, UniqueIdProperty
from django_neomodel import DjangoNode

logger = logging.getLogger('dict_config_logger')

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

class NeoTerm(DjangoNode):
identifier = UniqueIdProperty()
uid = StringProperty(unique_index=True, )
term = StringProperty(required=True)
definition = RelationshipTo('NeoDefinition', 'DEFINITION_OF')
alias = RelationshipTo('NeoAlias', 'ALIAS_OF')
class Meta:
app_label = 'core'

class NeoAlias(DjangoNode):
identifier = UniqueIdProperty()
alias = StringProperty()
term = RelationshipFrom('NeoTerm', 'ALIAS_OF')
context = RelationshipTo('NeoContext', 'ALIAS_TO')
class Meta:
app_label = 'core'


class NeoContext(DjangoNode):
identifier = UniqueIdProperty()
context = StringProperty(unique = True)
context_description = StringProperty(required=True)
alias = RelationshipFrom('NeoAlias', 'ALIAS_TO_CONTEXT')
definition_node = RelationshipTo('NeoDefinition', 'CONTEXT_TO_DEFINITION' )

class Meta:
app_label = 'core'

class NeoDefinition(DjangoNode):
identifier = UniqueIdProperty()
definition = StringProperty(required=True)

class Meta:
app_label = 'core'



4 changes: 4 additions & 0 deletions app/openlxp_xss_project/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
import sys
from pathlib import Path

from neomodel import config
config.DATABASE_URL = os.environ.get('NEO4J_URL', 'bolt://neo4j:password@neo4j:7687')

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent

Expand All @@ -35,6 +38,7 @@
# Application definition

INSTALLED_APPS = [
"django_neomodel",
"admin_interface",
"colorfield",
'django.contrib.admin',
Expand Down
14 changes: 12 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,21 @@ services:
- '3310:3306'
environment:
MYSQL_DATABASE: "${DB_NAME}"
# MYSQL_USER: 'root'
MYSQL_USER: "${DB_USER}"
MYSQL_PASSWORD: "${DB_PASSWORD}"
MYSQL_ROOT_PASSWORD: "${DB_ROOT_PASSWORD}"
# MYSQL_HOST: ''
networks:
- openlxp
neo4j:
image: neo4j:4.2.0
ports:
- '7687:7687'
- '7474:7474'
environment:
NEO4J_AUTH: neo4j/password
networks:
- openlxp
app:
container_name: openlxp-xss
build:
Expand All @@ -39,6 +48,7 @@ services:
volumes:
- ./app:/opt/app/openlxp-xss
depends_on:
- neo4j
- db-xss
networks:
- openlxp
Expand All @@ -47,4 +57,4 @@ volumes:
driver: local
networks:
openlxp:
external: true
driver: bridge
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