Skip to content
Merged
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,823 changes: 937 additions & 886 deletions pixi.lock

Large diffs are not rendered by default.

3 changes: 0 additions & 3 deletions src/neuview/builders/page_generator_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ def with_dependency_injection(self, use_container: bool = True):
self._use_container = use_container
return self


def build(self):
"""
Build and return configured PageGenerator instance.
Expand All @@ -129,7 +128,6 @@ def build(self):
else:
return self._build_with_factory()


def build_with_minimal_container(self):
"""
Build PageGenerator with minimal dependency injection container for testing.
Expand Down Expand Up @@ -339,4 +337,3 @@ def default_config(cls, config: Config, output_dir: str):
Configured builder ready to build
"""
return cls().with_config(config).with_output_directory(output_dir)

2 changes: 0 additions & 2 deletions src/neuview/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,6 @@ def load_neuron_type_cache(self, neuron_type: str) -> Optional[NeuronTypeCacheDa
logger.warning(f"Failed to load cache for {neuron_type}: {e}")
return None


def list_cached_neuron_types(self) -> List[str]:
"""Get list of neuron types that have valid cache files (lazy - no file loading).

Expand Down Expand Up @@ -364,7 +363,6 @@ def list_cached_neuron_types(self) -> List[str]:

return sorted(cached_types)


def get_cached_data_lazy(self) -> "LazyCacheDataDict":
"""Get a lazy-loading dictionary for cached neuron type data.

Expand Down
4 changes: 0 additions & 4 deletions src/neuview/dataset_adapters.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,6 @@ def get_synapse_counts(self, neurons_df: pd.DataFrame) -> Tuple[int, int]:
return int(pre_total), int(post_total)



class HemibrainAdapter(DatasetAdapter):
"""Adapter for Hemibrain dataset."""

Expand Down Expand Up @@ -540,7 +539,6 @@ def get_synapse_counts(self, neurons_df: pd.DataFrame) -> Tuple[int, int]:
return int(pre_total), int(post_total)



class OpticLobeAdapter(DatasetAdapter):
"""Adapter for Optic Lobe dataset."""

Expand Down Expand Up @@ -620,7 +618,6 @@ def get_synapse_counts(self, neurons_df: pd.DataFrame) -> Tuple[int, int]:
return int(pre_total), int(post_total)



class FafbAdapter(DatasetAdapter):
"""Adapter for FlyWire FAFB dataset."""

Expand Down Expand Up @@ -758,7 +755,6 @@ def get_synapse_counts(self, neurons_df: pd.DataFrame) -> Tuple[int, int]:
return int(pre_total), int(post_total)



class WaspAdapter(DatasetAdapter):
"""Adapter for the wasp3 dataset.

Expand Down
6 changes: 1 addition & 5 deletions src/neuview/facade/neu_view_facade.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import logging
from pathlib import Path
from typing import Optional, Dict, Any, List
from typing import Optional, Dict, Any

from ..config import Config
from ..builders.page_generator_builder import PageGeneratorBuilder
Expand Down Expand Up @@ -68,7 +68,6 @@ def create(

return cls(config=config, output_dir=output_dir)


def with_queue_service(self, queue_service) -> "NeuViewFacade":
"""
Configure the facade with a queue service.
Expand Down Expand Up @@ -227,8 +226,6 @@ def generate_page(self, neuron_type: str, **kwargs) -> Dict[str, Any]:
"metadata": {},
}



def validate_configuration(self) -> Dict[str, Any]:
"""
Validate the current configuration.
Expand Down Expand Up @@ -276,7 +273,6 @@ def validate_configuration(self) -> Dict[str, Any]:

return {"valid": len(errors) == 0, "errors": errors, "warnings": warnings}


def cleanup(self) -> None:
"""Clean up resources and reset the facade."""
logger.info("Cleaning up neuView facade")
Expand Down
13 changes: 0 additions & 13 deletions src/neuview/managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,6 @@ def get_template_dependencies(self, template_path: str) -> List[str]:

return list(dependencies)


def _find_circular_dependencies(self) -> List[List[str]]:
"""Find circular dependencies in the template graph."""
visited = set()
Expand Down Expand Up @@ -502,8 +501,6 @@ def clear_cache(self) -> None:
# Clear everything (cache strategies don't support pattern clearing)
self._cache_strategy.clear()



def add_custom_filter(self, name: str, filter_func: callable) -> None:
"""
Add a custom filter to template strategies that support it.
Expand Down Expand Up @@ -534,7 +531,6 @@ def add_global_variable(self, name: str, value: Any) -> None:
if hasattr(strategy, "add_global"):
strategy.add_global(name, value)


def get_template_info(self, template_path: str) -> Dict[str, Any]:
"""
Get comprehensive information about a template.
Expand Down Expand Up @@ -925,7 +921,6 @@ def copy_resource(self, source_path: str, dest_path: str) -> bool:

return False


def invalidate_resource(self, resource_path: str) -> None:
"""
Invalidate cache for a specific resource.
Expand Down Expand Up @@ -961,10 +956,6 @@ def clear_cache(self) -> None:
strategy.clear_cache()






class DependencyManager:
"""
Manager for handling dependencies between templates and resources.
Expand All @@ -988,8 +979,6 @@ def __init__(
self._dependency_graph = defaultdict(set)
self._reverse_dependency_graph = defaultdict(set)



def get_dependents(self, item: str, item_type: str = "template") -> Set[str]:
"""
Get all items that depend on the given item.
Expand All @@ -1003,5 +992,3 @@ def get_dependents(self, item: str, item_type: str = "template") -> Set[str]:
"""
dep_key = f"{item_type}:{item}"
return self._reverse_dependency_graph.get(dep_key, set())


2 changes: 0 additions & 2 deletions src/neuview/models/domain_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ def has_soma_location(self) -> bool:
)



@dataclass
class NeuronCollection:
"""Entity representing a collection of neurons of the same type."""
Expand Down Expand Up @@ -215,7 +214,6 @@ def body_ids(self) -> List[BodyId]:
"""List of all body IDs."""
return [neuron.body_id for neuron in self.neurons]


def get_synapse_statistics(self) -> Dict[str, float]:
"""Calculate synapse statistics for the collection."""
if not self.neurons:
Expand Down
2 changes: 0 additions & 2 deletions src/neuview/models/page_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ class AnalysisResults:
layer_analysis: Optional[Dict[str, Any]] = None
column_analysis: Optional[Dict[str, Any]] = None


def to_dict(self) -> Dict[str, Any]:
"""Convert to dictionary for template context."""
# Always provide expected keys to prevent template errors
Expand Down Expand Up @@ -162,7 +161,6 @@ class PageGenerationContext:
additional_context: Dict[str, Any] = field(default_factory=dict)



@dataclass
class PageGenerationResponse:
"""
Expand Down
4 changes: 0 additions & 4 deletions src/neuview/neuprint_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,6 @@ def clear_neuron_data_cache(self, neuron_type: str = None):
else:
self._soma_sides_cache.clear()


def get_database_metadata(self) -> Dict[str, Any]:
"""
Get database metadata including lastDatabaseEdit.
Expand Down Expand Up @@ -545,7 +544,6 @@ def get_database_metadata(self) -> Dict[str, Any]:
"uuid": "Unknown",
}


def get_cache_stats(self) -> Dict[str, Any]:
"""
Get cache performance statistics.
Expand Down Expand Up @@ -1458,7 +1456,6 @@ def get_available_types(self) -> List[str]:
except Exception as e:
raise RuntimeError(f"Failed to fetch available neuron types: {e}")


def get_soma_sides_for_type(self, neuron_type: str) -> List[str]:
"""
Get soma sides for a specific neuron type with caching to avoid repeated queries.
Expand Down Expand Up @@ -1817,4 +1814,3 @@ def _get_roi_hierarchy(self) -> dict:
except Exception as e:
logger.warning(f"Failed to fetch ROI hierarchy: {e}")
return {}

10 changes: 0 additions & 10 deletions src/neuview/page_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,6 @@ def _get_partner_body_ids(self, partner_data, direction, connected_bids):
partner_data, direction, connected_bids
)


def _generate_neuron_search_js(self):
"""Generate neuron-search.js with embedded neuron types data."""
# Delegate to neuron search service
Expand Down Expand Up @@ -331,9 +330,6 @@ def _generate_neuroglancer_url(
neuron_type, neuron_data, soma_side, connector
)




def _generate_neuprint_url(
self, neuron_type: str, neuron_data: Dict[str, Any]
) -> str:
Expand All @@ -352,7 +348,6 @@ def _generate_neuprint_url(
neuron_type, neuron_data
)


def generate_page_unified(self, request: PageGenerationRequest):
"""
Generate an HTML page using the unified orchestrator workflow.
Expand Down Expand Up @@ -469,7 +464,6 @@ def _get_columns_from_neuron_cache(self, neuron_type: str):
"""
return self.cache_service.get_columns_from_neuron_cache(neuron_type)


def _load_persistent_columns_cache(self, cache_key):
"""Load persistent cache for all columns dataset query."""
return self.cache_service.load_persistent_columns_cache(cache_key)
Expand Down Expand Up @@ -522,7 +516,6 @@ def _analyze_column_roi_data(
spacing_factor,
)


def _compute_thresholds(self, df: pd.DataFrame, n_bins: int = 5):
"""
Compute threshold lists for synapse and neuron counts at different aggregation levels.
Expand Down Expand Up @@ -609,7 +602,6 @@ def _generate_region_hexagonal_grids(

return result.region_grids


def clean_dynamic_files_for_neuron(
self, neuron_type: str, soma_side: str = None
) -> bool:
Expand Down Expand Up @@ -644,7 +636,6 @@ def generate_filename(neuron_type: str, soma_side: str) -> str:
"""
return FileService.generate_filename(neuron_type, soma_side)


def _find_youtube_video(self, neuron_type: str) -> Optional[str]:
"""
Find YouTube video ID for a neuron type by matching against descriptions.
Expand All @@ -661,7 +652,6 @@ def _get_primary_rois(self, connector):
"""Get primary ROIs based on dataset type and available data."""
return self.roi_analysis_service.get_primary_rois(connector)


def _get_region_for_type(self, neuron_type: str, connector) -> str:
"""Find the type's assigned "region" - used for setting the NG view."""
return self.roi_analysis_service.get_region_for_type(neuron_type, connector)
3 changes: 0 additions & 3 deletions src/neuview/result.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ def map_err(self, func: Callable[[E], Any]) -> "Result":
return self



@dataclass
class Ok(Result[T, E]):
"""Success variant of Result."""
Expand Down Expand Up @@ -109,5 +108,3 @@ def __repr__(self) -> str:

def __eq__(self, other) -> bool:
return isinstance(other, Err) and self.error == other.error


6 changes: 1 addition & 5 deletions src/neuview/services/brain_region_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import re
import logging
from typing import Dict, Optional
from typing import Dict

from ..utils import get_input_dir

Expand Down Expand Up @@ -105,8 +105,6 @@ def load_brain_regions(self) -> Dict[str, str]:
self._loaded = True
return self.brain_regions



def roi_abbr_filter(self, roi_name: str) -> str:
"""
Convert ROI abbreviation to HTML abbr tag with full name in title.
Expand Down Expand Up @@ -160,8 +158,6 @@ def roi_abbr_filter(self, roi_name: str) -> str:
logger.debug(f"Brain region abbreviation not found: {roi_name}")
return roi_name



def __len__(self) -> int:
"""Return the number of loaded brain regions."""
if not self._loaded:
Expand Down
3 changes: 0 additions & 3 deletions src/neuview/services/cache_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

import pandas as pd

from ..utils import atomic_write

from ..commands import GeneratePageCommand
from ..models import (
Expand Down Expand Up @@ -439,7 +438,6 @@ def _clean_roi_name(self, roi_name: str) -> str:

return cleaned.strip()


def load_persistent_columns_cache(
self, cache_key: str
) -> Optional[Tuple[list, Dict[str, set]]]:
Expand Down Expand Up @@ -489,7 +487,6 @@ def load_persistent_columns_cache(

return None


def get_columns_from_neuron_cache(
self, neuron_type: str
) -> Tuple[Optional[list], Optional[Dict[str, set]]]:
Expand Down
2 changes: 0 additions & 2 deletions src/neuview/services/citation_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,6 @@ def get_citation(self, citation_key: str) -> Optional[Tuple[str, str]]:
self.load_citations()
return self.citations.get(citation_key)



def format_doi_url(self, doi: str) -> str:
"""
Convert a DOI string to a full URL.
Expand Down
4 changes: 1 addition & 3 deletions src/neuview/services/column_analysis_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,7 @@ def analyze_column_roi_data(
# analysis) and the R slot displays the R-hemisphere SVG (from
# the L-soma analysis). No separate combined-mode files are
# produced.
soma_side_lower = (
soma_side.lower() if isinstance(soma_side, str) else ""
)
soma_side_lower = soma_side.lower() if isinstance(soma_side, str) else ""
if soma_side_lower == "combined":
if "somaSide" in neurons_df.columns:
l_neurons = neurons_df[neurons_df["somaSide"] == "L"]
Expand Down
1 change: 0 additions & 1 deletion src/neuview/services/connection_test_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,3 @@ async def test_connection(

except Exception as e:
return Err(f"Connection test failed: {str(e)}")

2 changes: 0 additions & 2 deletions src/neuview/services/data_processing_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,6 @@ def _save_column_layer_cache(
except Exception as e:
logger.warning(f"Failed to save cache to {cache_path}: {e}")


def _minmax_normalize(self, data: List[Dict]) -> List[Dict]:
"""Apply min-max normalization to numerical fields."""
# Implementation would go here based on specific requirements
Expand All @@ -398,4 +397,3 @@ def _zscore_normalize(self, data: List[Dict]) -> List[Dict]:
"""Apply z-score normalization to numerical fields."""
# Implementation would go here based on specific requirements
return data

1 change: 0 additions & 1 deletion src/neuview/services/database_query_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,6 @@ def get_partner_body_ids(
logger.error(f"Error getting partner bodyIds for {neuron_type}: {e}")
return {"downstream": {}, "upstream": {}}


def _process_partner_results(self, result_df: pd.DataFrame) -> Dict:
"""
Process partner query results to get top partner for each type and soma side.
Expand Down
Loading
Loading