Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
2151cc2
chore(deps)(deps): bump django-debug-toolbar from 4.2.0 to 6.0.0
dependabot[bot] Oct 13, 2025
b129515
chore(deps)(deps): bump isort from 5.13.2 to 7.0.0
dependabot[bot] Oct 13, 2025
a791823
Merge branch 'main' into dependabot/pip/django-debug-toolbar-6.0.0
Deepthi-Chand Apr 23, 2026
43e0206
Merge pull request #24 from CivicDataLab/dependabot/pip/django-debug-…
Deepthi-Chand Apr 23, 2026
75cb092
Merge pull request #25 from CivicDataLab/dependabot/pip/isort-7.0.0
Deepthi-Chand Apr 23, 2026
fb91cb2
Merge pull request #70 from CivicDataLab/dev
Deepthi-Chand Apr 23, 2026
73a7e33
Merge pull request #74 from CivicDataLab/org-auditors
saqibmanan Apr 30, 2026
c939a55
Merge pull request #77 from CivicDataLab/dev
saqibmanan May 25, 2026
69b83a6
chore: update entrypoint permission
Deepthi-Chand Jun 9, 2026
f214fad
Merge pull request #80 from CivicDataLab/dev
psaesha Jun 17, 2026
f3c6034
Bump SDK version to 0.5.02
github-actions[bot] Jun 17, 2026
01bf459
Revert "Dev"
psaesha Jun 17, 2026
23ceb89
Merge pull request #82 from CivicDataLab/revert-80-dev
psaesha Jun 17, 2026
13f4097
no of entries for non-csv datasets
psaesha Jun 25, 2026
76de2ce
Merge pull request #84 from CivicDataLab/main_no_of_entries_fix
psaesha Jun 25, 2026
e321f17
Update dynamic_chart_view.py
saqibmanan Jun 25, 2026
a216d61
Update type_resource_chart.py
saqibmanan Jun 25, 2026
c865267
Update Dockerfile
saqibmanan Jun 25, 2026
7c7ecc0
chore(deps)(deps): bump djangorestframework from 3.14.0 to 3.17.2
dependabot[bot] Sep 10, 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
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -168,5 +168,3 @@ files/public/*
#dvc files
dvc
dvc/*

.DS_Store
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ RUN apt-get update && \
libxss1 \
libxtst6 \
lsb-release \
chromium \
chromium-driver \
xdg-utils && \
rm -rf /var/lib/apt/lists/*

Expand All @@ -49,6 +51,7 @@ COPY . /code/

RUN pip install psycopg2-binary uvicorn
RUN pip install -r requirements.txt
RUN curl -s https://cdn.jsdelivr.net/npm/echarts@5/dist/echarts.min.js -o /code/echarts.min.js

# Create healthcheck script
RUN echo '#!/bin/bash\nset -e\npython -c "import sys; import django; django.setup(); sys.exit(0)"' > /code/healthcheck.sh \
Expand Down
18 changes: 6 additions & 12 deletions api/management/commands/update_dataindex.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from django.db import transaction

from api.models.Resource import Resource, ResourceDataTable
from api.utils.data_indexing import index_resource_data
from api.utils.data_indexing import INDEXED_FORMATS, index_resource_data

logger = structlog.get_logger("dataspace.commands.update_dataindex")

Expand Down Expand Up @@ -51,9 +51,7 @@ def handle(self, *args: Any, **options: Dict[str, Any]) -> None:
resource_id = uuid.UUID(resource_id_str)
except ValueError:
self.stdout.write(
self.style.ERROR(
f"Invalid UUID format for resource-id: {resource_id_str}"
)
self.style.ERROR(f"Invalid UUID format for resource-id: {resource_id_str}")
)
return

Expand All @@ -62,9 +60,7 @@ def handle(self, *args: Any, **options: Dict[str, Any]) -> None:
dataset_id = uuid.UUID(dataset_id_str)
except ValueError:
self.stdout.write(
self.style.ERROR(
f"Invalid UUID format for dataset-id: {dataset_id_str}"
)
self.style.ERROR(f"Invalid UUID format for dataset-id: {dataset_id_str}")
)
return

Expand Down Expand Up @@ -106,10 +102,10 @@ def handle(self, *args: Any, **options: Dict[str, Any]) -> None:

# Skip resources that aren't CSV files
file_details = resource.resourcefiledetails
if not file_details or not file_details.format.lower() == "csv":
if not file_details or file_details.format.lower() not in INDEXED_FORMATS:
self.stdout.write(
self.style.WARNING(
f"[{i}/{total_resources}] Skipping resource {resource.id} - Not a CSV file"
f"[{i}/{total_resources}] Skipping resource {resource.id} - Format not indexable"
)
)
skipped_count += 1
Expand Down Expand Up @@ -163,9 +159,7 @@ def handle(self, *args: Any, **options: Dict[str, Any]) -> None:
# Print summary
elapsed_time = time.time() - start_time
self.stdout.write(
self.style.SUCCESS(
f"\nDataindex update completed in {elapsed_time:.2f} seconds"
)
self.style.SUCCESS(f"\nDataindex update completed in {elapsed_time:.2f} seconds")
)
self.stdout.write(f"Total resources processed: {total_resources}")
self.stdout.write(f"Successful updates: {success_count}")
Expand Down
8 changes: 2 additions & 6 deletions api/models/Resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,12 +188,8 @@ def version_resource_with_dvc(sender, instance: ResourceFileDetails, created, **
# Create a temporary directory for the previous version
with tempfile.TemporaryDirectory() as temp_dir:
# Get the previous version file path
file_name = instance.file.name
if not file_name:
raise ValueError("File name is missing")
prev_file_name = (
f"prev_version_{instance.resource.id}.{file_name.split('.')[-1]}"
)
file_ext = instance.file.name.split(".")[-1] if instance.file.name else ""
prev_file_name = f"prev_version_{instance.resource.id}.{file_ext}"
prev_file_path = os.path.join(temp_dir, prev_file_name)

# Use DVC to get the previous version
Expand Down
28 changes: 19 additions & 9 deletions api/schema/access_model_schema.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# mypy: disable-error-code="valid-type"

import uuid
from enum import Enum
from typing import Any, Dict, List, Optional, Union
Expand Down Expand Up @@ -51,7 +49,9 @@ class EditAccessModelInput:
@strawberry.type(name="Query")
class Query:
@strawberry_django.field
def access_model_resources(self, info: Info, dataset_id: uuid.UUID) -> List[TypeAccessModel]:
def access_model_resources(
self, info: Info, dataset_id: uuid.UUID
) -> List[TypeAccessModel]:
models = AccessModel.objects.filter(dataset_id=dataset_id)
return [TypeAccessModel.from_django(model) for model in models]

Expand Down Expand Up @@ -88,12 +88,16 @@ def _add_update_access_model_resources(
try:
dataset_resource = Resource.objects.get(id=resource_input.resource)
except Resource.DoesNotExist as e:
raise ValueError(f"Resource with ID {resource_input.resource} does not exist.")
raise ValueError(
f"Resource with ID {resource_input.resource} does not exist."
)

access_model_resource = AccessModelResource.objects.create(
access_model=access_model, resource=dataset_resource
)
_add_resource_fields(access_model_resource, dataset_resource, resource_input.fields)
_add_resource_fields(
access_model_resource, dataset_resource, resource_input.fields
)


def _update_access_model_fields(
Expand All @@ -118,13 +122,15 @@ def create_access_model(
try:
dataset = Dataset.objects.get(id=access_model_input.dataset)
except Dataset.DoesNotExist:
raise ValueError(f"Dataset with ID {access_model_input.dataset} does not exist.")
raise ValueError(
f"Dataset with ID {access_model_input.dataset} does not exist."
)

access_model = AccessModel.objects.create(
dataset=dataset,
name=access_model_input.name,
description=access_model_input.description,
type=access_model_input.type.value, # type: ignore[attr-defined]
type=access_model_input.type.value,
)

_update_access_model_fields(access_model, access_model_input)
Expand All @@ -139,11 +145,15 @@ def edit_access_model(
try:
dataset = Dataset.objects.get(id=access_model_input.dataset)
except Dataset.DoesNotExist as e:
raise ValueError(f"Dataset with ID {access_model_input.dataset} does not exist.")
raise ValueError(
f"Dataset with ID {access_model_input.dataset} does not exist."
)
access_model = AccessModel.objects.create(dataset=dataset)
else:
try:
access_model = AccessModel.objects.get(id=access_model_input.access_model_id)
access_model = AccessModel.objects.get(
id=access_model_input.access_model_id
)
except AccessModel.DoesNotExist as e:
raise ValueError(
f"Access Model with ID {access_model_input.access_model_id} does not exist."
Expand Down
14 changes: 7 additions & 7 deletions api/schema/aimodel_schema.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
"""GraphQL schema for AI Model."""

# mypy: disable-error-code="union-attr,misc,valid-type"
# mypy: disable-error-code="union-attr,misc"

import datetime
from typing import Any, Dict, List, Optional
from typing import List, Optional

import strawberry
import strawberry_django
Expand Down Expand Up @@ -419,14 +419,14 @@ def create_ai_model(
description = input.description or ""

# Prepare supported_languages
supported_languages: List[str] = input.supported_languages or []
supported_languages = input.supported_languages or []

# Prepare schemas
input_schema: Any = input.input_schema or {}
output_schema: Any = input.output_schema or {}
input_schema = input.input_schema or {}
output_schema = input.output_schema or {}

# Prepare metadata
metadata: Any = input.metadata or {}
metadata = input.metadata or {}

try:
model = AIModel.objects.create(
Expand Down Expand Up @@ -802,7 +802,7 @@ def create_ai_model_version(
ai_model=model,
version=input.version,
version_notes=input.version_notes or "",
lifecycle_stage=input.lifecycle_stage.value if input.lifecycle_stage else "DEVELOPMENT", # type: ignore[attr-defined]
lifecycle_stage=input.lifecycle_stage.value if input.lifecycle_stage else "DEVELOPMENT", # type: ignore[misc]
supports_streaming=input.supports_streaming,
max_tokens=input.max_tokens,
supported_languages=input.supported_languages or [],
Expand Down
1 change: 0 additions & 1 deletion api/schema/dataset_schema.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# mypy: disable-error-code=union-attr
# mypy: disable-error-code=valid-type
import datetime
import uuid
from typing import Any, List, Optional, Union
Expand Down
22 changes: 15 additions & 7 deletions api/schema/resource_chart_schema.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# mypy: disable-error-code=valid-type

import datetime
import uuid
from typing import Any, Dict, List, Optional
Expand All @@ -21,12 +19,16 @@
@strawberry.type(name="Query")
class Query:
@strawberry_django.field
def charts_details(self, info: Info, dataset_id: uuid.UUID) -> List[TypeResourceChart]:
def charts_details(
self, info: Info, dataset_id: uuid.UUID
) -> List[TypeResourceChart]:
charts = ResourceChartDetails.objects.filter(resource__dataset_id=dataset_id)
return [TypeResourceChart.from_django(chart) for chart in charts]

@strawberry_django.field
def resource_chart(self, info: Info, chart_details_id: uuid.UUID) -> TypeResourceChart:
def resource_chart(
self, info: Info, chart_details_id: uuid.UUID
) -> TypeResourceChart:
chart = ResourceChartDetails.objects.get(id=chart_details_id)
return TypeResourceChart.from_django(chart)

Expand Down Expand Up @@ -186,10 +188,14 @@ def _update_chart_fields(
if value: # Only process if list is not empty
options[field_name] = [
{
"field": ResourceSchema.objects.get(id=column.field_name),
"field": ResourceSchema.objects.get(
id=column.field_name
),
"label": column.label,
"color": column.color,
"value_mapping": _update_value_mapping(column.value_mapping),
"value_mapping": _update_value_mapping(
column.value_mapping
),
}
for column in value
]
Expand Down Expand Up @@ -289,7 +295,9 @@ def create_resource_chart(
)
],
)
def edit_resource_chart(self, info: Info, chart_input: ResourceChartInput) -> TypeResourceChart:
def edit_resource_chart(
self, info: Info, chart_input: ResourceChartInput
) -> TypeResourceChart:
if not chart_input.chart_id:
chart = ResourceChartDetails()
else:
Expand Down
Loading
Loading