RIPLEY
This commit is contained in:
parent
00fab55ca3
commit
9a8ca32792
Binary file not shown.
Binary file not shown.
Binary file not shown.
28
core/migrations/0002_relationship.py
Normal file
28
core/migrations/0002_relationship.py
Normal file
@ -0,0 +1,28 @@
|
||||
# Generated by Django 5.2.7 on 2026-03-22 22:06
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('core', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Relationship',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('relationship_type', models.CharField(choices=[('OWNED_BY', 'Owned By'), ('ASSOCIATED_WITH', 'Associated With'), ('COMMUNICATED_WITH', 'Communicated With')], max_length=20)),
|
||||
('weight', models.FloatField(default=1.0)),
|
||||
('created_at', models.DateTimeField(auto_now_add=True)),
|
||||
('source_entity', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='outbound_relationships', to='core.entity')),
|
||||
('target_entity', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='inbound_relationships', to='core.entity')),
|
||||
],
|
||||
options={
|
||||
'unique_together': {('source_entity', 'target_entity', 'relationship_type')},
|
||||
},
|
||||
),
|
||||
]
|
||||
BIN
core/migrations/__pycache__/0002_relationship.cpython-311.pyc
Normal file
BIN
core/migrations/__pycache__/0002_relationship.cpython-311.pyc
Normal file
Binary file not shown.
@ -27,4 +27,22 @@ class Entity(models.Model):
|
||||
unique_together = ('entity_type', 'value', 'source')
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.entity_type}: {self.value}"
|
||||
return f"{self.entity_type}: {self.value}"
|
||||
|
||||
class Relationship(models.Model):
|
||||
RELATIONSHIP_TYPES = (
|
||||
('OWNED_BY', 'Owned By'),
|
||||
('ASSOCIATED_WITH', 'Associated With'),
|
||||
('COMMUNICATED_WITH', 'Communicated With'),
|
||||
)
|
||||
source_entity = models.ForeignKey(Entity, on_delete=models.CASCADE, related_name='outbound_relationships')
|
||||
target_entity = models.ForeignKey(Entity, on_delete=models.CASCADE, related_name='inbound_relationships')
|
||||
relationship_type = models.CharField(max_length=20, choices=RELATIONSHIP_TYPES)
|
||||
weight = models.FloatField(default=1.0)
|
||||
created_at = models.DateTimeField(auto_now_add=True)
|
||||
|
||||
class Meta:
|
||||
unique_together = ('source_entity', 'target_entity', 'relationship_type')
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.source_entity} -[{self.relationship_type}]-> {self.target_entity}"
|
||||
|
||||
BIN
core/services/__pycache__/ingestion.cpython-311.pyc
Normal file
BIN
core/services/__pycache__/ingestion.cpython-311.pyc
Normal file
Binary file not shown.
BIN
core/services/__pycache__/resolution.cpython-311.pyc
Normal file
BIN
core/services/__pycache__/resolution.cpython-311.pyc
Normal file
Binary file not shown.
@ -1,7 +1,11 @@
|
||||
from django.urls import path
|
||||
|
||||
from .views import home
|
||||
from .views import home, ingest_data, resolve_entities
|
||||
|
||||
app_name = 'core'
|
||||
|
||||
urlpatterns = [
|
||||
path("", home, name="home"),
|
||||
]
|
||||
path("api/ingest/", ingest_data, name="ingest_data"),
|
||||
path("api/resolve/", resolve_entities, name="resolve_entities"),
|
||||
]
|
||||
@ -1,10 +1,13 @@
|
||||
import os
|
||||
import platform
|
||||
|
||||
from django import get_version as django_version
|
||||
import json
|
||||
from django.http import JsonResponse
|
||||
from django.views.decorators.csrf import csrf_exempt
|
||||
from core.services.ingestion import IngestionService
|
||||
from core.services.resolution import EntityResolutionService
|
||||
from django.shortcuts import render
|
||||
from django.utils import timezone
|
||||
|
||||
import os
|
||||
import platform
|
||||
from django import get_version as django_version
|
||||
|
||||
def home(request):
|
||||
"""Render the landing screen with loader and environment details."""
|
||||
@ -23,3 +26,21 @@ def home(request):
|
||||
"project_image_url": os.getenv("PROJECT_IMAGE_URL", ""),
|
||||
}
|
||||
return render(request, "core/index.html", context)
|
||||
|
||||
@csrf_exempt
|
||||
def ingest_data(request):
|
||||
if request.method == 'POST':
|
||||
data = json.loads(request.body)
|
||||
# Using IngestionService as a placeholder for actual processing
|
||||
result = IngestionService.ingest(data)
|
||||
return JsonResponse({'status': 'success', 'data': result})
|
||||
return JsonResponse({'error': 'Invalid request'}, status=400)
|
||||
|
||||
@csrf_exempt
|
||||
def resolve_entities(request):
|
||||
if request.method == 'POST':
|
||||
data = json.loads(request.body)
|
||||
# Using EntityResolutionService as a placeholder for actual processing
|
||||
result = EntityResolutionService.resolve(data)
|
||||
return JsonResponse({'status': 'success', 'result': result})
|
||||
return JsonResponse({'error': 'Invalid request'}, status=400)
|
||||
Loading…
x
Reference in New Issue
Block a user