Skip to content

Commit 624051d

Browse files
committed
data_provider readme
1 parent c98399f commit 624051d

File tree

3 files changed

+52
-2
lines changed

3 files changed

+52
-2
lines changed

es_data_provider/dist/event_generator.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const boquetNames = Array.from({ length: 20 }, (_, i) => `Boquet ${i + 1}`);
3030
const deviceToCity = {};
3131
const deviceToPincode = {};
3232
// Define base timestamp
33-
const baseTimestamp = luxon_1.DateTime.fromISO("2024-03-10T00:00:55.000");
33+
const baseTimestamp = luxon_1.DateTime.now(); //.fromISO("2024-03-10T00:00:55.000");
3434
const assign = async () => {
3535
// const random = await import("random");
3636
deviceIds.forEach(deviceId => {

es_data_provider/readme.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Populating Data into Elastic DB
2+
3+
This guide will walk you through the steps to build and run TypeScript scripts to populate data into Elasticsearch DB using Docker Desktop.
4+
5+
## Prerequisites
6+
7+
Before you begin, ensure you have Node.js and npm installed on your system. Also, make sure you have Docker Desktop installed and Elasticsearch DB container running as per the setup mentioned in the previous section.
8+
9+
## Setup TypeScript Scripts
10+
11+
Follow these steps to set up TypeScript scripts for populating data into Elasticsearch DB:
12+
13+
1. **Install dependencies:**
14+
15+
```bash
16+
npm install
17+
```
18+
19+
2. **Build TypeScript script:**
20+
21+
```bash
22+
npm run build
23+
```
24+
25+
## Populate Data into Elasticsearch DB
26+
27+
### City List Population
28+
29+
1. **Run the script:**
30+
31+
```bash
32+
node dist/city_list.js
33+
```
34+
35+
This script will add cities with geolocation from the local `data/city_list.xlsx` file to Elasticsearch DB.
36+
37+
### Event Generator
38+
39+
2. **Run the script:**
40+
41+
```bash
42+
node dist/event_generator.js
43+
```
44+
45+
This script will generate dummy past events for different locations and populate them into Elasticsearch DB.
46+
47+
## Notes
48+
49+
- Ensure that Elasticsearch DB container is running before executing the scripts.
50+
- Modify the scripts if needed to match your Elasticsearch DB configuration or data format.

es_data_provider/scripts/event_generator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const deviceToPincode: { [key: string]: string } = {};
3939

4040

4141
// Define base timestamp
42-
const baseTimestamp: DateTime = DateTime.fromISO("2024-03-10T00:00:55.000");
42+
const baseTimestamp: DateTime = DateTime.now()//.fromISO("2024-03-10T00:00:55.000");
4343

4444
const assign = async () => {
4545
// const random = await import("random");

0 commit comments

Comments
 (0)