-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathMakefile
More file actions
163 lines (127 loc) · 6.5 KB
/
Makefile
File metadata and controls
163 lines (127 loc) · 6.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# Makefile
# Check if .env exists
ifeq (,$(wildcard .env))
$(error .env file is missing at .env. Please create one based on .env.example)
endif
# Load environment variables from .env
include .env
.PHONY: tests mypy clean help ruff-check ruff-check-fix ruff-format ruff-format-fix all-check all-fix
QUESTION ?=
#################################################################################
## Data Collector Commands
#################################################################################
pubmed-data-collector-run: ## Run the data collector
@echo "Running data collector..."
uv run src/biomedical_graphrag/data_sources/pubmed/pubmed_data_collector.py
@echo "Data collector run complete."
gene-data-collector-run: ## Run the data collector
@echo "Running data collector..."
uv run src/biomedical_graphrag/data_sources/gene/gene_data_collector.py
@echo "Data collector run complete."
#################################################################################
## Neo4j Graph Commands
#################################################################################
create-graph: ## Create the Neo4j graph from the dataset
@echo "Creating Neo4j graph from dataset..."
uv run src/biomedical_graphrag/infrastructure/neo4j_db/create_graph.py
@echo "Neo4j graph creation complete."
delete-graph: ## Delete all nodes and relationships in the Neo4j graph
@echo "Deleting all nodes and relationships in the Neo4j graph..."
uv run src/biomedical_graphrag/infrastructure/neo4j_db/delete_graph.py
@echo "Neo4j graph deletion complete."
example-graph-query: ## Run example queries on the Neo4j graph using GraphRAG
@echo "Running example queries on the Neo4j graph..."
uv run src/biomedical_graphrag/application/cli/fusion_query.py --examples
@echo "Example queries complete."
custom-graph-query: ## Run a custom natural language query using Neo4j GraphRAG (use QUESTION="your question")
@echo "Running custom query on the Neo4j graph with GraphRAG..."
uv run src/biomedical_graphrag/application/cli/fusion_query.py $(if $(QUESTION),--ask "$(QUESTION)")
@echo "Custom query complete."
#################################################################################
## Qdrant Commands
#################################################################################
create-qdrant-collection: ## Create the Qdrant collection for embeddings
@echo "Creating Qdrant collection for embeddings..."
uv run src/biomedical_graphrag/infrastructure/qdrant_db/create_collection.py
@echo "Qdrant collection creation complete."
delete-qdrant-collection: ## Delete the Qdrant collection for embeddings
@echo "Deleting Qdrant collection for embeddings..."
uv run src/biomedical_graphrag/infrastructure/qdrant_db/delete_collection.py
@echo "Qdrant collection deletion complete."
ingest-qdrant-data: ## Ingest embeddings into the Qdrant collection
@echo "Ingesting embeddings into the Qdrant collection..."
uv run src/biomedical_graphrag/infrastructure/qdrant_db/qdrant_ingestion.py
@echo "Embeddings ingestion complete."
custom-qdrant-query: ## Run a custom query on the Qdrant collection (modify the --ask parameter as needed)
@echo "Running custom query on the Qdrant collection..."
uv run src/biomedical_graphrag/application/cli/query_vectorstore.py $(if $(QUESTION),--ask "$(QUESTION)")
@echo "Custom query complete."
#################################################################################
## Testing
#################################################################################
tests: ## Run all tests
@echo "Running all tests..."
uv run pytest
@echo "All tests completed."
################################################################################
## Prek Commands
################################################################################
prek-run: ## Run prek hooks
@echo "Running prek hooks..."
prek run --all-files
@echo "Prek checks complete."
################################################################################
## Linting
################################################################################
# Linting (just checks)
ruff-check: ## Check code lint violations (--diff to show possible changes)
@echo "Checking Ruff formatting..."
uv run ruff check .
@echo "Ruff lint checks complete."
ruff-check-fix: ## Auto-format code using Ruff
@echo "Formatting code with Ruff..."
uv run ruff check . --fix --exit-non-zero-on-fix
@echo "Formatting complete."
################################################################################
## Formatting
################################################################################
# Formatting (just checks)
ruff-format: ## Check code format violations (--diff to show possible changes)
@echo "Checking Ruff formatting..."
uv run ruff format . --check
@echo "Ruff format checks complete."
ruff-format-fix: ## Auto-format code using Ruff
@echo "Formatting code with Ruff..."
uv run ruff format .
@echo "Formatting complete."
#################################################################################
## Static Type Checking
#################################################################################
mypy: ## Run MyPy static type checker
@echo "Running MyPy static type checker..."
uv run mypy
@echo "MyPy static type checker complete."
################################################################################
## Cleanup
################################################################################
clean: ## Clean up cached generated files
@echo "Cleaning up generated files..."
find . -type d -name "__pycache__" -exec rm -rf {} +
find . -type d -name ".pytest_cache" -exec rm -rf {} +
find . -type d -name ".ruff_cache" -exec rm -rf {} +
find . -type d -name ".mypy_cache" -exec rm -rf {} +
find . -type f -name "*.pyc" -delete
@echo "Cleanup complete."
################################################################################
## Composite Commands
################################################################################
all-check: ruff-format ruff-check clean ## Run all: linting, formatting and type checking
all-fix: ruff-format-fix ruff-check-fix mypy clean ## Run all fix: auto-formatting and linting fixes
################################################################################
## Help
################################################################################
help: ## Display this help message
@echo "Default target: $(.DEFAULT_GOAL)"
@echo "Available targets:"
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
.DEFAULT_GOAL := help