Skip to content

Commit c7727dc

Browse files
authored
feat(customer-360): add Customer 360 use case (#36)
1 parent 0c940a5 commit c7727dc

11 files changed

Lines changed: 1072 additions & 0 deletions

File tree

.github/workflows/customer-360.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Customer 360 CI
2+
3+
on:
4+
push:
5+
paths:
6+
- customer-360/**
7+
- .github/workflows/customer-360.yml
8+
pull_request:
9+
paths:
10+
- customer-360/**
11+
- .github/workflows/customer-360.yml
12+
13+
jobs:
14+
test:
15+
runs-on: ubuntu-latest
16+
timeout-minutes: 15
17+
permissions:
18+
contents: read
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
runner: [curl, java]
23+
24+
env:
25+
ARCADEDB_URL: http://localhost:2480
26+
ARCADEDB_USER: root
27+
ARCADEDB_PASS: arcadedb
28+
29+
steps:
30+
- name: Checkout
31+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
32+
with:
33+
fetch-depth: 1
34+
35+
- name: Set up Java
36+
if: matrix.runner == 'java'
37+
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0
38+
with:
39+
java-version: '21'
40+
distribution: 'temurin'
41+
42+
- name: Cache Maven repository
43+
if: matrix.runner == 'java'
44+
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
45+
with:
46+
path: ~/.m2
47+
key: ${{ runner.os }}-m2-${{ hashFiles('customer-360/java/pom.xml') }}
48+
restore-keys: ${{ runner.os }}-m2-
49+
50+
- name: Start ArcadeDB
51+
working-directory: customer-360
52+
run: docker compose up -d
53+
54+
- name: Setup database
55+
working-directory: customer-360
56+
run: ./setup.sh
57+
58+
- name: Run curl queries
59+
if: matrix.runner == 'curl'
60+
working-directory: customer-360
61+
run: ./queries/queries.sh
62+
63+
- name: Build and run Java
64+
if: matrix.runner == 'java'
65+
working-directory: customer-360/java
66+
run: |
67+
mvn package --no-transfer-progress
68+
java -jar target/customer-360.jar
69+
70+
- name: Teardown
71+
if: always()
72+
working-directory: customer-360
73+
run: docker compose down

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ and runnable demos via both `curl` and a Java program.
1717
| [social-network-analytics](./social-network-analytics/) | Social network analytics with materialized view dashboards | Materialized views, Graph traversal, Time-series, Polyglot (SQL + OpenCypher) |
1818
| [supply-chain](./supply-chain/) | Supply chain management with multi-tier visibility | Graph traversal, Vector similarity, Time-series, PostgreSQL protocol, JavaScript |
1919
| [iam](./iam/) | Identity & Access Management | Graph traversal, Time-series, Vector similarity, PostgreSQL protocol, Python |
20+
| [customer-360](./customer-360/) | Unified customer view with identity resolution and churn prediction | Graph traversal, Documents, Vectors, Full-text search, OpenCypher |
2021

2122
## Structure
2223

customer-360/README.md

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
# Customer 360
2+
3+
Demonstrates ArcadeDB's multi-model capabilities by building a unified customer
4+
view that combines all five pillars in a single database:
5+
6+
- **Graph traversal** -- identity resolution, churn risk scoring, cross-sell recommendations
7+
- **Documents** -- fuzzy deduplication via cross-matching
8+
- **Vectors** -- customer preference and product embeddings (LSM_VECTOR)
9+
- **Full-text search** -- support ticket content indexing
10+
- **Time-series** -- journey path analysis via event chains
11+
12+
Uses **OpenCypher** as the primary query language, with SQL MATCH for
13+
graph patterns that require explicit hop control.
14+
15+
## Prerequisites
16+
17+
- Docker and Docker Compose
18+
- `curl` and `jq`
19+
- Java 21+ and Maven 3.x (for the Java demo)
20+
21+
## Quickstart
22+
23+
### 1. Start ArcadeDB
24+
25+
```bash
26+
docker compose up -d
27+
```
28+
29+
### 2. Create database and load data
30+
31+
```bash
32+
./setup.sh
33+
```
34+
35+
This creates the `Customer360` database, applies the schema, and inserts sample data.
36+
37+
### 3a. Run queries via curl
38+
39+
```bash
40+
./queries/queries.sh
41+
```
42+
43+
### 3b. Run queries via Java
44+
45+
```bash
46+
cd java
47+
mvn package -q
48+
java -jar target/customer-360.jar
49+
```
50+
51+
## Schema
52+
53+
| Type | Kind | Key properties |
54+
|------|------|----------------|
55+
| `Customer` | Vertex | `id`, `name`, `email`, `phone`, `status`, `prefVector`, `recentBehavior`, `baselineBehavior`, `lifetimeValue` |
56+
| `Household` | Vertex | `id`, `name` |
57+
| `Product` | Vertex | `id`, `name`, `category`, `price`, `embedding` |
58+
| `Device` | Vertex | `id`, `deviceType`, `os` |
59+
| `Address` | Vertex | `id`, `street`, `city`, `state`, `zip` |
60+
| `Ticket` | Vertex | `id`, `subject`, `status`, `content` |
61+
| `Campaign` | Vertex | `id`, `name`, `channel` |
62+
| `Session` | Vertex | `id`, `startedAt` |
63+
| `Event` | Vertex | `id`, `eventType`, `channel`, `page` |
64+
| `Identifier` | Vertex | `id`, `identifierType`, `identifierValue` |
65+
| `PURCHASED` | Edge | Customer -> Product (`purchasedAt`) |
66+
| `LIVES_AT` | Edge | Customer -> Address |
67+
| `USED` | Edge | Customer -> Device |
68+
| `MEMBER_OF` | Edge | Customer -> Household |
69+
| `OPENED` | Edge | Customer -> Ticket |
70+
| `CLICKED` | Edge | Customer -> Campaign |
71+
| `REFERRED` | Edge | Customer -> Customer |
72+
| `CONNECTED_TO` | Edge | Customer -> Customer |
73+
| `OBSERVED_IN` | Edge | Identifier -> Session |
74+
| `INTERACTED` | Edge | Customer -> Event |
75+
| `FOLLOWED_BY` | Edge | Event -> Event |
76+
77+
The `Device`, `Address`, and `Campaign` types with their edges (`LIVES_AT`, `USED`, `CLICKED`) are populated in the sample data and available for extension but not exercised by the current queries.
78+
79+
## Query Patterns
80+
81+
| # | Pattern | Language | Description |
82+
|---|---------|----------|-------------|
83+
| 1 | Identity Resolution | SQL MATCH | 3-hop transitive link discovery via shared sessions |
84+
| 2 | Fuzzy Deduplication | Cypher | Cross-match customers by shared phone number |
85+
| 3 | Customer 360 View | Cypher | Unified profile: household, purchases, open tickets, LTV |
86+
| 4 | Churn Risk Scoring | SQL MATCH | Churned-neighbor ratio in social network |
87+
| 5 | Cross-Sell Recommendations | Cypher | Household + collaborative filtering |
88+
| 6 | Journey Path Analysis | Cypher | Conversion paths: ad_click -> page_view -> purchase |
89+
90+
## Sample Data
91+
92+
- 6 customers (4 active, 2 churned) with 8-dimensional preference vectors
93+
- 2 households, 6 products, 3 devices, 3 addresses
94+
- 6 identifiers and 3 sessions for identity resolution
95+
- 9 events forming 3 conversion paths
96+
- 3 support tickets (1 open, 2 closed) with full-text indexed content
97+
- Social graph edges (REFERRED, CONNECTED_TO) linking active to churned customers
98+
99+
## ArcadeDB Version Notes
100+
101+
This use case targets ArcadeDB **26.3.1**. Vector indexes use
102+
`LSM_VECTOR METADATA { dimensions: 8, similarity: 'COSINE' }`.
103+
Full-text search uses `FULL_TEXT` index on Ticket content.
104+
105+
## Reference
106+
107+
[ArcadeDB Customer 360 use case](https://arcadedb.com/customer-360.html)

customer-360/docker-compose.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
services:
2+
arcadedb:
3+
image: arcadedata/arcadedb:26.3.1
4+
ports:
5+
- "2480:2480"
6+
environment:
7+
JAVA_OPTS: "-Darcadedb.server.rootPassword=arcadedb"
8+
healthcheck:
9+
test: ["CMD", "wget", "--spider", "-q", "http://localhost:2480/api/v1/ready"]
10+
interval: 5s
11+
timeout: 3s
12+
retries: 20
13+
start_period: 10s

customer-360/java/pom.xml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<groupId>com.arcadedb.examples</groupId>
8+
<artifactId>customer-360</artifactId>
9+
<version>1.0-SNAPSHOT</version>
10+
<packaging>jar</packaging>
11+
12+
<properties>
13+
<maven.compiler.source>21</maven.compiler.source>
14+
<maven.compiler.target>21</maven.compiler.target>
15+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
16+
<arcadedb.version>26.3.1</arcadedb.version>
17+
</properties>
18+
19+
<dependencies>
20+
<dependency>
21+
<groupId>com.arcadedb</groupId>
22+
<artifactId>arcadedb-network</artifactId>
23+
<version>${arcadedb.version}</version>
24+
</dependency>
25+
</dependencies>
26+
27+
<build>
28+
<plugins>
29+
<plugin>
30+
<groupId>org.apache.maven.plugins</groupId>
31+
<artifactId>maven-assembly-plugin</artifactId>
32+
<version>3.8.0</version>
33+
<configuration>
34+
<archive>
35+
<manifest>
36+
<mainClass>com.arcadedb.examples.Customer360</mainClass>
37+
</manifest>
38+
</archive>
39+
<descriptorRefs>
40+
<descriptorRef>jar-with-dependencies</descriptorRef>
41+
</descriptorRefs>
42+
<finalName>customer-360</finalName>
43+
<appendAssemblyId>false</appendAssemblyId>
44+
</configuration>
45+
<executions>
46+
<execution>
47+
<id>make-assembly</id>
48+
<phase>package</phase>
49+
<goals>
50+
<goal>single</goal>
51+
</goals>
52+
</execution>
53+
</executions>
54+
</plugin>
55+
</plugins>
56+
</build>
57+
</project>

0 commit comments

Comments
 (0)