Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
zcemycl committed Aug 2, 2024
1 parent 8d3c3dd commit f8420ae
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/containers/docker/neo4j/backend/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/containers/docker/neo4j/backend/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ bcrypt = "^4.1.2"
pydantic-settings = "^2.2.1"
requests = "^2.31.0"
neo4j = "^5.23.0"
numpy = "^2.0.1"


[tool.poetry.group.dev.dependencies]
Expand Down
10 changes: 7 additions & 3 deletions src/containers/docker/neo4j/backend/src/backend/__main__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import os
import string

import numpy as np
from loguru import logger
from neo4j import GraphDatabase

Expand Down Expand Up @@ -28,7 +30,7 @@
resp = list(session.run(cmd, None))
print(resp)

resp = list(session.run(query, parameters={'rows': ["d"]}))
resp = list(session.run(query, parameters={'rows': list(string.ascii_lowercase)}))

query = '''
UNWIND $row.table_keywords AS keyword
Expand All @@ -39,11 +41,13 @@
MERGE (p)-[:CONTAINS]->(k)
RETURN k.name AS name
'''
rng = np.random.default_rng(2)
with driver.session(database="neo4j") as session:
for record in [
{
"table_keywords": ["a", "c", "b"],
"product": "d",
"table_keywords": rng.choice(list(string.ascii_lowercase), 3),
"product": each,
}
for each in list(string.ascii_lowercase)
]:
resp = list(session.run(query, parameters={'row': record}))
9 changes: 8 additions & 1 deletion src/containers/docker/neo4j/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ services:
- "7687:7687"
networks:
- net
healthcheck:
test: wget http://localhost:7474 || exit 1
interval: 1s
timeout: 10s
retries: 20
start_period: 3s
add-data:
build:
context: .
Expand All @@ -26,7 +32,8 @@ services:
- HOSTNAME=neo4j
entrypoint: python -m backend
depends_on:
- neo4j
neo4j:
condition: service_healthy
networks:
- net
deploy:
Expand Down
3 changes: 2 additions & 1 deletion src/containers/docker/neo4j/frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion src/containers/docker/neo4j/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"neovis.js": "^2.1.0",
"next": "14.2.5",
"react": "^18",
"react-dom": "^18"
"react-dom": "^18",
"vis-network": "^9.1.9"
},
"devDependencies": {
"@types/node": "^20",
Expand Down

0 comments on commit f8420ae

Please sign in to comment.