- Postgres as central DB
- Bedrock as serverless embedding service
- Data ingestion -
- using Google Maps geocode api convert Location to Bounding Box
- using Bedrock generate embedding of the text
- store data in Postgres (yet to be optimized regarding data structure)
- Query best match -
- Query for specific entity id for best-match (geospatial & textual) from Postgres
- Bedrock
- Postgres 15.3
- PostGIS 3
- PGVector 0.41
- TypeScript 5
- NodeJS 18
- Docker + Docker compose
- Require remote Postgres with PostGIS and PGVector (WIP local docker file)
- Require Docker + Docker Compose installed
- Require Google Maps API
- Require AWS Account with Bedrock permissions
- copy
./app/.env-sample
to./app/.env
and fill all information - Load init DB Schema located in
./db/sampleDB-dump
- Run
docker-compose up
- ./batchLoad folder contains Node >=v18 script, which load CSV and ingest to the server
- The server needs to be up and running (mimic full flow)
- Current CSV structure:
ID,TYPE,URGENCY,NAME,PHONE,ADDRESS,TEXT
:ID
- Currently not in useTYPE
- To which route to send the row, ingestCanHelp / ingestNeedHelp- Possible values:
1
/2
- Possible values:
URGENCY
- Currently not in useNAME
- Name of the person- Possible values:
free text
- Possible values:
PHONE
- Phone number of the person Possible values:0524715555
/052-4715555
/+972524715555
/etc.
ADDRESS
- Address of the entity- Possible values:
free text
(Non-valid google maps entity will fail the ingestion)
- Possible values:
TEXT
- Text entity for semantic search- Possible values:
free text
(embedding will be generated for it)
- Possible values:
curl --location 'localhost:3000/ingestNeedHelp' \
--header 'Content-Type: application/json' \
--data-raw '{
"user": {
"phone": "0525555555",
"email": "example@gmail.com",
"name": "ישראל ישראלי"
},
"props": {
"text": "נוסע בדרום ",
"address": "אשדוד"
}
}'
curl --location 'localhost:3000/ingestCanHelp' \
--header 'Content-Type: application/json' \
--data-raw '{
"user": {
"phone": "0525555555",
"email": "example@gmail.com",
"name": "ישראל ישראלי"
},
"props": {
"text": "נוסע בדרום ",
"address": "אשדוד"
}
}'
curl --location 'localhost:3000/queryHelpToNeeded?id=45'
- Built as components with NodeJS's Fastify server, with Docker
- Can be easly deployed as Docker with managed containers services, like ECS or EKS
- Can be also (recommended) to be ported to Lambda
- Make sure
.env
file is fully populated- Once deployed in AWS,
.env
file can skipACCESS_KEY
, and use Service Role
- Once deployed in AWS,
- Switch to ORM for better DB management
- DB:
- Local DB Container
- DB Schema
- Optimize DB structure
- Upsert Persons
- Reuse geocode
- Reuse embeddings
- CDK Environment