Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
110 commits
Select commit Hold shift + click to select a range
e5671f6
chore: update submodules
andhreljaKern Dec 28, 2025
f19763a
chore: update alembic
andhreljaKern Dec 28, 2025
909d7e0
chore: update submodules
andhreljaKern Dec 29, 2025
1e40b26
chore: update submodules
andhreljaKern Dec 29, 2025
9aebaab
chore: update submodules
andhreljaKern Dec 29, 2025
e023d72
perf: add knowledge graph routes
andhreljaKern Dec 29, 2025
6d73d14
org in in endpoints
lumburovskalina Dec 29, 2025
b773158
chore: update submodules
andhreljaKern Dec 29, 2025
3096d6b
Return id on creating graph
lumburovskalina Dec 29, 2025
eb99eec
perf: update knowledge graphs
andhreljaKern Dec 30, 2025
6621312
chore: update submodules
andhreljaKern Dec 30, 2025
a670a22
Merge branch 'knowledge-graphs' of https://github.com/code-kern-ai/re…
andhreljaKern Dec 30, 2025
bd9ce64
Update endpoint error fix
lumburovskalina Dec 30, 2025
a07fb3b
fix: knowledge graph updates
andhreljaKern Dec 30, 2025
d79c3e7
Error fix in endpoint
lumburovskalina Jan 5, 2026
8c7db0d
chore: update submodules
andhreljaKern Jan 5, 2026
8ccfe02
perf: updated get_data endpoint for knowledge graphs
andhreljaKern Jan 5, 2026
bd075ac
chore: conflict resolution
andhreljaKern Jan 5, 2026
bef9cc6
chore: update submodules
andhreljaKern Jan 5, 2026
5f7b0ca
perf: dynamic group-agg-by
andhreljaKern Jan 5, 2026
2663f5f
perf: push agg_fns to FE
andhreljaKern Jan 5, 2026
8151a41
perf: upgrade get_data endpoint
andhreljaKern Jan 5, 2026
38c914d
fix: stable kg schema
andhreljaKern Jan 5, 2026
5f0f915
fix: stable kg schema
andhreljaKern Jan 5, 2026
10513d4
chore: update submodules
andhreljaKern Jan 5, 2026
ceddccb
perf: execute-question kg id
andhreljaKern Jan 7, 2026
b958c02
Request execute-question fix
lumburovskalina Jan 7, 2026
d3eff5c
chore: update submodules
andhreljaKern Jan 9, 2026
2b7fc96
chore: update submodules
andhreljaKern Jan 9, 2026
c623b80
perf: data blocks
andhreljaKern Jan 9, 2026
1e3c0b7
chore: update submodules
andhreljaKern Jan 12, 2026
cc10556
perf: sql config validation
andhreljaKern Jan 12, 2026
e6122bb
chore: update submodules
andhreljaKern Jan 12, 2026
803dfab
perf: data blocks improvements
andhreljaKern Jan 12, 2026
f9b063d
chore: update submodules
andhreljaKern Jan 13, 2026
e42f1b9
perf: execute data blocks
andhreljaKern Jan 13, 2026
69d8f52
chore: update submodules
andhreljaKern Jan 14, 2026
48ebe2f
perf: upgrade DataBlock table
andhreljaKern Jan 14, 2026
25b4ac5
perf: include sql_schema to data block table
andhreljaKern Jan 14, 2026
7f8cf2c
chore: update submodules
andhreljaKern Jan 14, 2026
4c97ece
chore: update submodules
andhreljaKern Jan 14, 2026
8061ebc
perf: data block sql schema
andhreljaKern Jan 14, 2026
c97a089
perf: allow data block create for all refinery projects
andhreljaKern Jan 14, 2026
2982480
fix: PUT data block optional name and desc
andhreljaKern Jan 14, 2026
e62777e
chore: update submodules
andhreljaKern Jan 15, 2026
95a773f
perf(alembic): update models
andhreljaKern Jan 15, 2026
c628d1f
perf: data block attributes
andhreljaKern Jan 15, 2026
c14d741
fix: data block attributes
andhreljaKern Jan 15, 2026
34e16c3
fix: auto created attrs
andhreljaKern Jan 15, 2026
8116be6
chore: update submodules
andhreljaKern Jan 15, 2026
7e08f3a
chore: update submodules
andhreljaKern Jan 16, 2026
aad19ff
fix: data block attribute states
andhreljaKern Jan 16, 2026
ce9ac10
chore: update submodules
andhreljaKern Jan 19, 2026
2531147
perf(alembic): upgrade models
andhreljaKern Jan 19, 2026
9a64f99
perf(ac-exec-env): data blocks run on 10 support
andhreljaKern Jan 19, 2026
d57077f
Default additionalConfig for LLM Response
lumburovskalina Jan 20, 2026
ad48df4
chore: update submodules
andhreljaKern Jan 21, 2026
dd59005
perf: data block updates
andhreljaKern Jan 21, 2026
b9b3854
perf(alembic): data block updates
andhreljaKern Jan 21, 2026
a2e32d8
Merge branch 'dev' into knowledge-graphs
andhreljaKern Jan 21, 2026
e324603
chore: conflict resolution
andhreljaKern Jan 21, 2026
9deb830
perf: data blocks run all
andhreljaKern Jan 22, 2026
8ec8e24
perf(data-blocks): LLM response support
andhreljaKern Jan 22, 2026
dc11661
perf(data-blocks): run llm on 10 support
andhreljaKern Jan 22, 2026
a05e359
perf(data-block): s3 cleanup on deletion
andhreljaKern Jan 22, 2026
e6150ca
perf(data-blocks): various enhancements
andhreljaKern Jan 23, 2026
1459c1b
perf: get_record enhancements
andhreljaKern Jan 23, 2026
2024615
perf: support for None and null
andhreljaKern Jan 23, 2026
11c200c
chore: update submodules
andhreljaKern Jan 23, 2026
098fb19
perf: resolve test case issues
andhreljaKern Jan 23, 2026
b0d554d
Sample records fix
lumburovskalina Jan 26, 2026
6dbafd0
chore: update submodules
andhreljaKern Jan 26, 2026
1db3051
perf: related data block attrs
andhreljaKern Jan 26, 2026
5127257
perf: add related_data_blocks to attribute
andhreljaKern Jan 26, 2026
c375630
perf: internal data blocks execute for cognition pipeline
andhreljaKern Jan 26, 2026
8c5f60b
fix: internal data blocks execution snake case
andhreljaKern Jan 26, 2026
8e01c26
fix(data-block): execute query limit
andhreljaKern Jan 26, 2026
22c68b1
fix: run_llm_playground record ids
andhreljaKern Jan 26, 2026
9c9e845
fix: run_llm_playground record ids
andhreljaKern Jan 26, 2026
654dc83
fix(data-block): attribute create/update ws
andhreljaKern Jan 26, 2026
279d20d
fix: project id resolve from data block attribute updates
andhreljaKern Jan 26, 2026
9837dec
fix: sync schema circular import
andhreljaKern Jan 27, 2026
d7bed0e
fix: various data block fixes and anhancements
andhreljaKern Jan 27, 2026
221b4a8
perf: PR review comments
andhreljaKern Jan 28, 2026
dc1b29b
chore: update submodules
andhreljaKern Jan 28, 2026
95210d8
perf: add /test-where-clause to refinery
andhreljaKern Jan 28, 2026
b799cda
chore: update submodules
andhreljaKern Jan 28, 2026
3c06bb0
fix: PR comments
andhreljaKern Jan 28, 2026
4b46990
fix: PR comments
andhreljaKern Jan 28, 2026
9d6129b
fix: commit sqlData on change
andhreljaKern Jan 29, 2026
4ee7c0d
fix: failure on missing data block
andhreljaKern Jan 29, 2026
e8a55da
chore: update submodules
andhreljaKern Jan 29, 2026
6172310
fix(alembic): align to dev
andhreljaKern Jan 29, 2026
ee6e65f
perf: rename delete fn
andhreljaKern Jan 29, 2026
4198237
Added project_id to data blocks
lumburovskalina Jan 29, 2026
a5b110d
Merge branch 'knowledge-graphs' of github.com:code-kern-ai/refinery-g…
lumburovskalina Jan 29, 2026
edb6139
PR comments
lumburovskalina Jan 29, 2026
4906589
chore: update submodules
andhreljaKern Jan 29, 2026
90049a1
fix: PR comments
andhreljaKern Jan 29, 2026
4cb623c
PR comments
lumburovskalina Jan 29, 2026
908436d
Merge branch 'knowledge-graphs' of github.com:code-kern-ai/refinery-g…
lumburovskalina Jan 29, 2026
e0761ec
fix: PR review comments
andhreljaKern Jan 30, 2026
da5484c
chore: update submodules
andhreljaKern Jan 30, 2026
d9b1240
perf: pr comments
andhreljaKern Jan 30, 2026
0436993
chore: update submodules
andhreljaKern Jan 30, 2026
d16dba1
perf: pr comments data block
andhreljaKern Jan 30, 2026
f6c2612
fix: pr comments
andhreljaKern Jan 30, 2026
603a1ce
chore: conflict resolution
andhreljaKern Feb 6, 2026
7003465
fix(alembic): align to dev changes
andhreljaKern Feb 6, 2026
0a06540
chore: update submodules
andhreljaKern Feb 9, 2026
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
99 changes: 99 additions & 0 deletions alembic/versions/9a8abc15a493_adds_data_blocks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
"""adds data blocks

Revision ID: 9a8abc15a493
Revises: 4ffb627479d3
Create Date: 2026-01-20 23:08:30.530156

"""

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql

# revision identifiers, used by Alembic.
revision = "9a8abc15a493"
down_revision = "4ffb627479d3"
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table(
"data_block",
sa.Column("id", postgresql.UUID(as_uuid=True), nullable=False),
sa.Column("organization_id", postgresql.UUID(as_uuid=True), nullable=True),
sa.Column("project_id", postgresql.UUID(as_uuid=True), nullable=True),
sa.Column("created_by", postgresql.UUID(as_uuid=True), nullable=True),
sa.Column("created_at", sa.DateTime(), nullable=True),
sa.Column("name", sa.String(), nullable=True),
sa.Column("description", sa.String(), nullable=True),
sa.Column("type", sa.String(), nullable=True),
sa.Column("sql_config", sa.JSON(), nullable=True),
sa.Column("sql_data", sa.ARRAY(sa.JSON()), nullable=True),
sa.ForeignKeyConstraint(["created_by"], ["user.id"], ondelete="SET NULL"),
sa.ForeignKeyConstraint(
["organization_id"], ["organization.id"], ondelete="CASCADE"
),
sa.ForeignKeyConstraint(["project_id"], ["project.id"], ondelete="CASCADE"),
sa.PrimaryKeyConstraint("id"),
)
op.create_index(
op.f("ix_data_block_created_by"), "data_block", ["created_by"], unique=False
)
op.create_index(
op.f("ix_data_block_organization_id"),
"data_block",
["organization_id"],
unique=False,
)
op.create_index(
op.f("ix_data_block_project_id"), "data_block", ["project_id"], unique=False
)
op.create_table(
"data_block_attributes",
sa.Column("id", postgresql.UUID(as_uuid=True), nullable=False),
sa.Column("data_block_id", postgresql.UUID(as_uuid=True), nullable=True),
sa.Column("name", sa.String(), nullable=True),
sa.Column("data_type", sa.String(), nullable=True),
sa.Column("is_primary_key", sa.Boolean(), nullable=True),
sa.Column("relative_position", sa.Integer(), nullable=True),
sa.Column("user_created", sa.Boolean(), nullable=True),
sa.Column("source_code", sa.String(), nullable=True),
sa.Column("state", sa.String(), nullable=True),
sa.Column("logs", sa.ARRAY(sa.String()), nullable=True),
sa.Column("started_at", sa.DateTime(), nullable=True),
sa.Column("finished_at", sa.DateTime(), nullable=True),
sa.Column("progress", sa.Float(), nullable=True),
sa.Column(
"additional_config",
sa.JSON(),
nullable=True,
comment="used when data_type == LLM_RESPONSE",
),
sa.ForeignKeyConstraint(
["data_block_id"], ["data_block.id"], ondelete="CASCADE"
),
sa.PrimaryKeyConstraint("id"),
)
op.create_index(
op.f("ix_data_block_attributes_data_block_id"),
"data_block_attributes",
["data_block_id"],
unique=False,
)
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_index(
op.f("ix_data_block_attributes_data_block_id"),
table_name="data_block_attributes",
)
op.drop_table("data_block_attributes")
op.drop_index(op.f("ix_data_block_project_id"), table_name="data_block")
op.drop_index(op.f("ix_data_block_organization_id"), table_name="data_block")
op.drop_index(op.f("ix_data_block_created_by"), table_name="data_block")
op.drop_table("data_block")
# ### end Alembic commands ###
41 changes: 20 additions & 21 deletions api/transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import traceback
import time
import os

from typing import Optional
from starlette.endpoints import HTTPEndpoint
from starlette.responses import PlainTextResponse
Expand All @@ -10,30 +11,25 @@
from controller.transfer.cognition import (
import_preparator as cognition_preparator,
)
from controller.transfer.cognition.minio_upload import handle_cognition_file_upload
from controller.transfer import manager as transfer_manager
from controller.upload_task import manager as upload_task_manager
from controller.attribute import manager as attribute_manager
from controller.task_master import manager as task_master_manager
from util.notification import create_notification
from util import notification, service_requests
from exceptions.exceptions import BadPasswordError

from submodules.model import enums, daemon
from submodules.model.models import UploadTask
from submodules.model.business_objects import (
attribute,
general,
tokenization,
project,
data_block,
)
from submodules.model.cognition_objects import integration
from util import service_requests

from controller.transfer import manager as transfer_manager
from controller.upload_task import manager as upload_task_manager
from controller.attribute import manager as attribute_manager

from submodules.model import enums
from util.notification import create_notification
from submodules.model.enums import NotificationType
from submodules.model.models import UploadTask
from util import notification
from submodules.model import daemon
from controller.transfer.cognition.minio_upload import handle_cognition_file_upload

from controller.task_master import manager as task_master_manager
from submodules.model.enums import TaskType, RecordTokenizationScope


logging.basicConfig(level=logging.DEBUG)
Expand Down Expand Up @@ -65,6 +61,8 @@ async def post(self, request) -> PlainTextResponse:
return PlainTextResponse("OK")
if upload_task_id == "download":
return PlainTextResponse("OK")
if upload_task_id == "data-blocks":
return PlainTextResponse("OK")
if org_id == "archive":
return PlainTextResponse("OK")

Expand Down Expand Up @@ -127,10 +125,10 @@ def init_file_import(task: UploadTask, project_id: str, is_global_update: bool)
task_master_manager.queue_task(
str(org_id),
str(task.user_id),
TaskType.TOKENIZATION,
enums.TaskType.TOKENIZATION,
{
"project_id": str(project_id),
"scope": RecordTokenizationScope.PROJECT.value,
"scope": enums.RecordTokenizationScope.PROJECT.value,
"include_rats": True,
"only_uploaded_attributes": only_usable_attributes,
},
Expand All @@ -141,14 +139,14 @@ def file_import_error_handling(
task: UploadTask,
project_id: str,
is_global_update: bool,
notification_type: Optional[NotificationType] = None,
notification_type: Optional[enums.NotificationType] = None,
print_traceback: bool = True,
) -> None:
general.rollback()
task.state = enums.UploadStates.ERROR.value
general.commit()
if not notification_type:
notification_type = NotificationType.IMPORT_FAILED
notification_type = enums.NotificationType.IMPORT_FAILED
create_notification(
notification_type,
task.user_id,
Expand Down Expand Up @@ -245,7 +243,8 @@ def __calculate_missing_attributes(project_id: str, user_id: str) -> None:
project.get_org_id(project_id),
user_id,
current_att_id,
True,
include_rats=True,
check_data_blocks_dependency=True,
)
else:
if tokenization.is_doc_bin_creation_running_for_attribute(
Expand Down
15 changes: 13 additions & 2 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
from fast_api.routes.record_internal import router as record_internal_router
from fast_api.routes.playground import router as playground_router
from fast_api.routes.inbox_mail import router as inbox_mail_router
from fast_api.routes.data_block import router as data_block_router
from fast_api.routes.data_block_internal import router as data_block_internal_router
from middleware.database_session import handle_db_session
from middleware.starlette_tmp_middleware import DatabaseSessionHandler
from starlette.applications import Starlette
Expand Down Expand Up @@ -64,6 +66,8 @@
PREFIX_TASK_EXECUTION,
PREFIX_PLAYGROUND,
PREFIX_INBOX_MAIL,
PREFIX_DATA_BLOCK,
PREFIX_DATA_BLOCK_INTERNAL,
)
from util import security, clean_up
from middleware import log_storage
Expand Down Expand Up @@ -127,20 +131,27 @@
inbox_mail_router, prefix=PREFIX_INBOX_MAIL, tags=["inbox_mail"]
)

fastapi_app.include_router(
data_block_router, prefix=PREFIX_DATA_BLOCK, tags=["data-block"]
)

app_name_internal = app_name + "-i"
fastapi_app_internal = FastAPI(title=app_name_internal)

fastapi_app_internal.include_router(
task_execution_router, prefix=PREFIX_TASK_EXECUTION, tags=["task-execution"]
)

fastapi_app_internal.include_router(
record_internal_router, prefix=PREFIX_RECORD_INTERNAL, tags=["record-internal"]
)
fastapi_app_internal.include_router(
project_internal_router, prefix=PREFIX_PROJECT_INTERNAL, tags=["project-internal"]
)

fastapi_app_internal.include_router(
data_block_internal_router,
prefix=PREFIX_DATA_BLOCK_INTERNAL,
tags=["data-block-internal"],
)

routes = [
Route("/full_config", FullConfigRest),
Expand Down
2 changes: 1 addition & 1 deletion controller/attribute/llm_response_tmpl.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ def get_llm_config_a2vybg():


async def get_llm_response(record: dict, cached_records: dict):
curr_running_id = str(record["running_id"])
curr_running_id = str(record.get("running_id", record.get("record_id")))

if curr_running_id in cached_records:
return cached_records[curr_running_id]
Expand Down
33 changes: 32 additions & 1 deletion controller/attribute/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,24 @@
project,
tokenization,
general,
data_block,
)
from submodules.model.models import Attribute
from submodules.model.enums import (
AttributeState,
DataTypes,
RecordTokenizationScope,
AttributeVisibility,
TaskType,
)
from util import notification

from submodules.model import daemon
from submodules.model.util import sql_alchemy_to_dict
from submodules.s3 import controller as s3

from controller.task_master import manager as task_master_manager
from submodules.model.enums import TaskType
from controller.data_block import manager as data_block_manager
from . import util
from sqlalchemy import sql
from hashlib import md5
Expand Down Expand Up @@ -51,6 +54,17 @@ def get_attribute(project_id: str, attribute_id: str) -> Attribute:
return attribute.get(project_id, attribute_id)


def get_attribute_expanded(project_id: str, attribute_id: str) -> Attribute:
attribute_item = sql_alchemy_to_dict(attribute.get(project_id, attribute_id))
attribute_item["related_data_blocks"] = sql_alchemy_to_dict(
data_block.get_refinery_attribute_dependants(
project_id=project_id,
refinery_attribute_name=attribute_item["name"],
)
)
return attribute_item


def get_all_attributes_by_names(
project_id: str, attribute_names: List[str]
) -> List[Attribute]:
Expand Down Expand Up @@ -240,6 +254,7 @@ def calculate_user_attribute_missing_records(
user_id: str,
attribute_id: str,
include_rats: bool = True,
check_data_blocks_dependency: bool = False,
) -> None:
if attribute.get_all(
project_id=project_id, state_filter=[AttributeState.RUNNING.value]
Expand Down Expand Up @@ -291,6 +306,7 @@ def calculate_user_attribute_missing_records(
user_id,
attribute_id,
include_rats,
check_data_blocks_dependency,
)


Expand All @@ -300,6 +316,7 @@ def __calculate_user_attribute_missing_records(
user_id: str,
attribute_id: str,
include_rats: bool,
check_data_blocks_dependency: bool = False,
) -> None:
general.get_ctx_token()

Expand Down Expand Up @@ -424,6 +441,20 @@ def __calculate_user_attribute_missing_records(
notification.send_organization_update(
project_id, f"calculate_attribute:finished:{attribute_id}"
)

if check_data_blocks_dependency:
dependant_data_blocks = util.get_dependant_data_blocks(
project_id, attribute_item.name
)
if dependant_data_blocks:
for data_block in dependant_data_blocks:
data_block_manager.update_query_results(
org_id,
user_id,
data_block_id=str(data_block.id),
sync_schema=False,
)

general.remove_and_refresh_session()


Expand Down
Loading