realitydb 0.3.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +46 -51
- package/dist/index.js +484 -14
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,64 +2,70 @@
|
|
|
2
2
|
|
|
3
3
|
> Production-like data before production exists.
|
|
4
4
|
|
|
5
|
-
RealityDB
|
|
6
|
-
realistic, schema-aware data. One command, realistic environments.
|
|
7
|
-
|
|
8
|
-
## Install
|
|
9
|
-
|
|
10
|
-
```bash
|
|
11
|
-
npm install -g realitydb
|
|
12
|
-
```
|
|
5
|
+
RealityDB populates your PostgreSQL database with realistic, schema-aware data. Point it at your schema, pick a domain template, and get thousands of rows that look like they came from a real application. Deterministic seeds mean the same command always produces the same data.
|
|
13
6
|
|
|
14
7
|
## Quick Start
|
|
15
8
|
|
|
16
9
|
```bash
|
|
17
|
-
|
|
18
|
-
realitydb seed --seed 42 # Populate with realistic data
|
|
19
|
-
realitydb reset --confirm # Clear and start fresh
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
Or use npx without installing:
|
|
10
|
+
npm install -g realitydb
|
|
23
11
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
12
|
+
realitydb scan # Inspect your schema
|
|
13
|
+
realitydb seed --template saas --seed 42 # Populate with realistic data
|
|
14
|
+
realitydb reset --confirm # Clear and start fresh
|
|
27
15
|
```
|
|
28
16
|
|
|
29
|
-
##
|
|
30
|
-
|
|
31
|
-
- **Schema Intelligence** — Automatically understands your database structure
|
|
32
|
-
- **Domain Templates** — SaaS, e-commerce, education with realistic distributions
|
|
33
|
-
- **Timeline Generation** — Datasets spanning months with growth curves
|
|
34
|
-
- **Scenario Injection** — Payment failures, churn spikes, fraud patterns
|
|
35
|
-
- **Reality Packs** — Portable, shareable environment packages
|
|
36
|
-
- **Deterministic** — Same seed = same data, every time
|
|
17
|
+
## Domain Templates
|
|
37
18
|
|
|
38
|
-
|
|
19
|
+
| Template | Description | Tables |
|
|
20
|
+
|----------|-------------|--------|
|
|
21
|
+
| `saas` | Subscription business | users, plans, subscriptions, payments |
|
|
22
|
+
| `ecommerce` | Online store | customers, products, orders, order_items |
|
|
23
|
+
| `education` | School system | teachers, classes, students, enrollments, grades, attendance |
|
|
24
|
+
| `fintech` | Financial services | accounts, transactions, fraud_alerts, settlements, chargebacks |
|
|
25
|
+
| `healthcare` | Medical system | patients, providers, encounters, diagnoses, billing |
|
|
39
26
|
|
|
40
27
|
```bash
|
|
41
|
-
realitydb seed --template
|
|
42
|
-
realitydb seed --template ecommerce --records 1000 --seed 42
|
|
43
|
-
realitydb seed --template education --records 1000 --seed 42
|
|
28
|
+
realitydb seed --template fintech --records 200 --seed 42
|
|
44
29
|
```
|
|
45
30
|
|
|
46
|
-
|
|
31
|
+
Each template includes weighted distributions matching real-world data.
|
|
32
|
+
|
|
33
|
+
## Key Features
|
|
47
34
|
|
|
48
35
|
```bash
|
|
36
|
+
# Timeline generation -- data spanning months
|
|
49
37
|
realitydb seed --template saas --timeline 12-months --seed 42
|
|
38
|
+
|
|
39
|
+
# Scenario injection -- controlled anomalies
|
|
50
40
|
realitydb seed --template saas --scenario payment-failures --scenario-intensity high
|
|
51
|
-
```
|
|
52
41
|
|
|
53
|
-
|
|
42
|
+
# Environment reproduction -- capture and share
|
|
43
|
+
realitydb capture --name bug-4821
|
|
44
|
+
realitydb load bug-4821.realitydb-pack.json --confirm
|
|
54
45
|
|
|
55
|
-
|
|
56
|
-
realitydb
|
|
57
|
-
realitydb pack import ./my-saas-env.databox-pack.json --confirm
|
|
46
|
+
# CI mode -- JSON output, proper exit codes
|
|
47
|
+
npx realitydb seed --ci --template saas --records 500 --seed 42
|
|
58
48
|
```
|
|
59
49
|
|
|
50
|
+
## Commands
|
|
51
|
+
|
|
52
|
+
| Command | Description |
|
|
53
|
+
|---------|-------------|
|
|
54
|
+
| `realitydb scan` | Inspect database schema |
|
|
55
|
+
| `realitydb seed` | Generate and insert realistic data |
|
|
56
|
+
| `realitydb reset` | Clear seeded data |
|
|
57
|
+
| `realitydb export` | Export data to JSON/CSV/SQL files |
|
|
58
|
+
| `realitydb capture` | Snapshot live database into a Reality Pack |
|
|
59
|
+
| `realitydb load` | Load a Reality Pack into the database |
|
|
60
|
+
| `realitydb share` | Display Reality Pack info for sharing |
|
|
61
|
+
| `realitydb pack export` | Generate and export as Reality Pack |
|
|
62
|
+
| `realitydb pack import` | Import a Reality Pack |
|
|
63
|
+
| `realitydb templates` | List available domain templates |
|
|
64
|
+
| `realitydb scenarios` | List available scenarios |
|
|
65
|
+
|
|
60
66
|
## Configuration
|
|
61
67
|
|
|
62
|
-
Create `realitydb.config.json
|
|
68
|
+
Create `realitydb.config.json`:
|
|
63
69
|
|
|
64
70
|
```json
|
|
65
71
|
{
|
|
@@ -68,7 +74,7 @@ Create `realitydb.config.json` (also reads `seedforge.config.json` and `databox.
|
|
|
68
74
|
"connectionString": "postgres://user:pass@localhost:5432/mydb"
|
|
69
75
|
},
|
|
70
76
|
"seed": {
|
|
71
|
-
"defaultRecords":
|
|
77
|
+
"defaultRecords": 1000,
|
|
72
78
|
"batchSize": 1000,
|
|
73
79
|
"randomSeed": 42
|
|
74
80
|
},
|
|
@@ -76,23 +82,12 @@ Create `realitydb.config.json` (also reads `seedforge.config.json` and `databox.
|
|
|
76
82
|
}
|
|
77
83
|
```
|
|
78
84
|
|
|
79
|
-
##
|
|
85
|
+
## Requirements
|
|
80
86
|
|
|
81
87
|
- Node.js 20+
|
|
82
|
-
- PostgreSQL
|
|
88
|
+
- PostgreSQL
|
|
83
89
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
| Command | Description |
|
|
87
|
-
|---------|-------------|
|
|
88
|
-
| `realitydb scan` | Scan and display database schema |
|
|
89
|
-
| `realitydb seed` | Generate and insert realistic data |
|
|
90
|
-
| `realitydb reset` | Clear seeded data |
|
|
91
|
-
| `realitydb export` | Export dataset to JSON/CSV/SQL files |
|
|
92
|
-
| `realitydb templates` | List available domain templates |
|
|
93
|
-
| `realitydb scenarios` | List available scenarios |
|
|
94
|
-
| `realitydb pack export` | Export environment as Reality Pack |
|
|
95
|
-
| `realitydb pack import` | Import Reality Pack into database |
|
|
90
|
+
Full documentation: [github.com/emkwambe/databox](https://github.com/emkwambe/databox)
|
|
96
91
|
|
|
97
92
|
## License
|
|
98
93
|
|
package/dist/index.js
CHANGED
|
@@ -5154,7 +5154,7 @@ function matchesAnyPattern(tableName, patterns) {
|
|
|
5154
5154
|
var import_promises5 = require("fs/promises");
|
|
5155
5155
|
var import_node_path5 = require("path");
|
|
5156
5156
|
function exportRealityPack(dataset, plan, schema, options) {
|
|
5157
|
-
const name = options?.name ?? plan.config.templateName ?? "
|
|
5157
|
+
const name = options?.name ?? plan.config.templateName ?? "realitydb-pack";
|
|
5158
5158
|
const packSchema = {
|
|
5159
5159
|
tables: schema.tables.map((t) => ({
|
|
5160
5160
|
name: t.name,
|
|
@@ -5182,7 +5182,7 @@ function exportRealityPack(dataset, plan, schema, options) {
|
|
|
5182
5182
|
};
|
|
5183
5183
|
}
|
|
5184
5184
|
return {
|
|
5185
|
-
format: "
|
|
5185
|
+
format: "realitydb-pack",
|
|
5186
5186
|
version: "1.0",
|
|
5187
5187
|
metadata: {
|
|
5188
5188
|
name,
|
|
@@ -5199,7 +5199,7 @@ function exportRealityPack(dataset, plan, schema, options) {
|
|
|
5199
5199
|
};
|
|
5200
5200
|
}
|
|
5201
5201
|
async function saveRealityPack(pack, outputPath) {
|
|
5202
|
-
const filePath = outputPath.endsWith(".databox-pack.json") ? outputPath : `${outputPath}/${pack.metadata.name}.
|
|
5202
|
+
const filePath = outputPath.endsWith(".realitydb-pack.json") || outputPath.endsWith(".databox-pack.json") ? outputPath : `${outputPath}/${pack.metadata.name}.realitydb-pack.json`;
|
|
5203
5203
|
await (0, import_promises5.mkdir)((0, import_node_path5.dirname)(filePath), { recursive: true });
|
|
5204
5204
|
await (0, import_promises5.writeFile)(filePath, JSON.stringify(pack, null, 2), "utf-8");
|
|
5205
5205
|
return filePath;
|
|
@@ -5219,8 +5219,8 @@ async function loadRealityPack(filePath) {
|
|
|
5219
5219
|
throw new Error(`Invalid Reality Pack file: not valid JSON`);
|
|
5220
5220
|
}
|
|
5221
5221
|
const pack = parsed;
|
|
5222
|
-
if (pack.format !== "databox-reality-pack") {
|
|
5223
|
-
throw new Error(`Invalid Reality Pack: expected format "
|
|
5222
|
+
if (pack.format !== "realitydb-pack" && pack.format !== "databox-reality-pack") {
|
|
5223
|
+
throw new Error(`Invalid Reality Pack: expected format "realitydb-pack", got "${String(pack.format)}"`);
|
|
5224
5224
|
}
|
|
5225
5225
|
if (!pack.version) {
|
|
5226
5226
|
throw new Error("Invalid Reality Pack: missing version field");
|
|
@@ -5708,6 +5708,474 @@ var educationTemplate = {
|
|
|
5708
5708
|
])
|
|
5709
5709
|
};
|
|
5710
5710
|
|
|
5711
|
+
// ../../packages/templates/dist/domains/fintech.js
|
|
5712
|
+
var fintechTemplate = {
|
|
5713
|
+
name: "fintech",
|
|
5714
|
+
version: "1.0",
|
|
5715
|
+
description: "Financial services with accounts, transactions, fraud alerts, and settlements",
|
|
5716
|
+
targetTables: ["accounts", "transactions", "fraud_alerts", "settlements", "chargebacks"],
|
|
5717
|
+
tableConfigs: /* @__PURE__ */ new Map([
|
|
5718
|
+
["accounts", {
|
|
5719
|
+
tableName: "accounts",
|
|
5720
|
+
matchPattern: ["accounts", "*account*"],
|
|
5721
|
+
columnOverrides: [
|
|
5722
|
+
{
|
|
5723
|
+
columnName: "account_type",
|
|
5724
|
+
strategy: {
|
|
5725
|
+
kind: "enum",
|
|
5726
|
+
options: {
|
|
5727
|
+
values: ["checking", "savings", "investment", "credit", "business"],
|
|
5728
|
+
weights: [0.35, 0.25, 0.15, 0.15, 0.1]
|
|
5729
|
+
}
|
|
5730
|
+
}
|
|
5731
|
+
},
|
|
5732
|
+
{
|
|
5733
|
+
columnName: "balance_cents",
|
|
5734
|
+
strategy: { kind: "money", options: { min: 0, max: 5e6 } }
|
|
5735
|
+
},
|
|
5736
|
+
{
|
|
5737
|
+
columnName: "currency",
|
|
5738
|
+
strategy: {
|
|
5739
|
+
kind: "enum",
|
|
5740
|
+
options: {
|
|
5741
|
+
values: ["USD", "EUR", "GBP", "CAD", "JPY"],
|
|
5742
|
+
weights: [0.55, 0.2, 0.1, 0.08, 0.07]
|
|
5743
|
+
}
|
|
5744
|
+
}
|
|
5745
|
+
},
|
|
5746
|
+
{
|
|
5747
|
+
columnName: "status",
|
|
5748
|
+
strategy: {
|
|
5749
|
+
kind: "enum",
|
|
5750
|
+
options: {
|
|
5751
|
+
values: ["active", "frozen", "closed", "pending_review"],
|
|
5752
|
+
weights: [0.82, 0.05, 0.08, 0.05]
|
|
5753
|
+
}
|
|
5754
|
+
}
|
|
5755
|
+
},
|
|
5756
|
+
{
|
|
5757
|
+
columnName: "owner_name",
|
|
5758
|
+
strategy: { kind: "full_name" }
|
|
5759
|
+
},
|
|
5760
|
+
{
|
|
5761
|
+
columnName: "email",
|
|
5762
|
+
strategy: { kind: "email" }
|
|
5763
|
+
},
|
|
5764
|
+
{
|
|
5765
|
+
columnName: "account_number",
|
|
5766
|
+
strategy: { kind: "text", options: { mode: "short" } }
|
|
5767
|
+
},
|
|
5768
|
+
{
|
|
5769
|
+
columnName: "opened_at",
|
|
5770
|
+
strategy: { kind: "timestamp", options: { mode: "past" } }
|
|
5771
|
+
}
|
|
5772
|
+
]
|
|
5773
|
+
}],
|
|
5774
|
+
["transactions", {
|
|
5775
|
+
tableName: "transactions",
|
|
5776
|
+
matchPattern: ["transactions", "*transaction*", "*transfer*"],
|
|
5777
|
+
columnOverrides: [
|
|
5778
|
+
{
|
|
5779
|
+
columnName: "transaction_type",
|
|
5780
|
+
strategy: {
|
|
5781
|
+
kind: "enum",
|
|
5782
|
+
options: {
|
|
5783
|
+
values: ["deposit", "withdrawal", "transfer", "payment", "refund", "fee"],
|
|
5784
|
+
weights: [0.25, 0.2, 0.2, 0.2, 0.1, 0.05]
|
|
5785
|
+
}
|
|
5786
|
+
}
|
|
5787
|
+
},
|
|
5788
|
+
{
|
|
5789
|
+
columnName: "amount_cents",
|
|
5790
|
+
strategy: { kind: "money", options: { min: 100, max: 5e5 } }
|
|
5791
|
+
},
|
|
5792
|
+
{
|
|
5793
|
+
columnName: "currency",
|
|
5794
|
+
strategy: {
|
|
5795
|
+
kind: "enum",
|
|
5796
|
+
options: {
|
|
5797
|
+
values: ["USD", "EUR", "GBP", "CAD", "JPY"],
|
|
5798
|
+
weights: [0.55, 0.2, 0.1, 0.08, 0.07]
|
|
5799
|
+
}
|
|
5800
|
+
}
|
|
5801
|
+
},
|
|
5802
|
+
{
|
|
5803
|
+
columnName: "status",
|
|
5804
|
+
strategy: {
|
|
5805
|
+
kind: "enum",
|
|
5806
|
+
options: {
|
|
5807
|
+
values: ["completed", "pending", "failed", "reversed", "held"],
|
|
5808
|
+
weights: [0.78, 0.08, 0.05, 0.04, 0.05]
|
|
5809
|
+
}
|
|
5810
|
+
}
|
|
5811
|
+
},
|
|
5812
|
+
{
|
|
5813
|
+
columnName: "description",
|
|
5814
|
+
strategy: { kind: "text", options: { mode: "short" } }
|
|
5815
|
+
},
|
|
5816
|
+
{
|
|
5817
|
+
columnName: "created_at",
|
|
5818
|
+
strategy: { kind: "timestamp", options: { mode: "past" } }
|
|
5819
|
+
}
|
|
5820
|
+
]
|
|
5821
|
+
}],
|
|
5822
|
+
["fraud_alerts", {
|
|
5823
|
+
tableName: "fraud_alerts",
|
|
5824
|
+
matchPattern: ["fraud_alerts", "*fraud*", "*alert*"],
|
|
5825
|
+
columnOverrides: [
|
|
5826
|
+
{
|
|
5827
|
+
columnName: "alert_type",
|
|
5828
|
+
strategy: {
|
|
5829
|
+
kind: "enum",
|
|
5830
|
+
options: {
|
|
5831
|
+
values: ["unusual_amount", "velocity_check", "geo_mismatch", "duplicate_transaction", "account_takeover"],
|
|
5832
|
+
weights: [0.3, 0.25, 0.2, 0.15, 0.1]
|
|
5833
|
+
}
|
|
5834
|
+
}
|
|
5835
|
+
},
|
|
5836
|
+
{
|
|
5837
|
+
columnName: "severity",
|
|
5838
|
+
strategy: {
|
|
5839
|
+
kind: "enum",
|
|
5840
|
+
options: {
|
|
5841
|
+
values: ["low", "medium", "high", "critical"],
|
|
5842
|
+
weights: [0.2, 0.4, 0.3, 0.1]
|
|
5843
|
+
}
|
|
5844
|
+
}
|
|
5845
|
+
},
|
|
5846
|
+
{
|
|
5847
|
+
columnName: "status",
|
|
5848
|
+
strategy: {
|
|
5849
|
+
kind: "enum",
|
|
5850
|
+
options: {
|
|
5851
|
+
values: ["open", "investigating", "resolved_fraud", "resolved_legitimate", "escalated"],
|
|
5852
|
+
weights: [0.25, 0.2, 0.3, 0.15, 0.1]
|
|
5853
|
+
}
|
|
5854
|
+
}
|
|
5855
|
+
},
|
|
5856
|
+
{
|
|
5857
|
+
columnName: "description",
|
|
5858
|
+
strategy: { kind: "text", options: { mode: "short" } }
|
|
5859
|
+
},
|
|
5860
|
+
{
|
|
5861
|
+
columnName: "created_at",
|
|
5862
|
+
strategy: { kind: "timestamp", options: { mode: "past" } }
|
|
5863
|
+
}
|
|
5864
|
+
]
|
|
5865
|
+
}],
|
|
5866
|
+
["settlements", {
|
|
5867
|
+
tableName: "settlements",
|
|
5868
|
+
matchPattern: ["settlements", "*settlement*"],
|
|
5869
|
+
columnOverrides: [
|
|
5870
|
+
{
|
|
5871
|
+
columnName: "settlement_type",
|
|
5872
|
+
strategy: {
|
|
5873
|
+
kind: "enum",
|
|
5874
|
+
options: {
|
|
5875
|
+
values: ["standard", "expedited", "batch", "real_time"],
|
|
5876
|
+
weights: [0.5, 0.2, 0.2, 0.1]
|
|
5877
|
+
}
|
|
5878
|
+
}
|
|
5879
|
+
},
|
|
5880
|
+
{
|
|
5881
|
+
columnName: "amount_cents",
|
|
5882
|
+
strategy: { kind: "money", options: { min: 100, max: 5e5 } }
|
|
5883
|
+
},
|
|
5884
|
+
{
|
|
5885
|
+
columnName: "status",
|
|
5886
|
+
strategy: {
|
|
5887
|
+
kind: "enum",
|
|
5888
|
+
options: {
|
|
5889
|
+
values: ["pending", "processing", "completed", "failed"],
|
|
5890
|
+
weights: [0.15, 0.1, 0.7, 0.05]
|
|
5891
|
+
}
|
|
5892
|
+
}
|
|
5893
|
+
},
|
|
5894
|
+
{
|
|
5895
|
+
columnName: "created_at",
|
|
5896
|
+
strategy: { kind: "timestamp", options: { mode: "past" } }
|
|
5897
|
+
}
|
|
5898
|
+
]
|
|
5899
|
+
}],
|
|
5900
|
+
["chargebacks", {
|
|
5901
|
+
tableName: "chargebacks",
|
|
5902
|
+
matchPattern: ["chargebacks", "*chargeback*", "*dispute*"],
|
|
5903
|
+
columnOverrides: [
|
|
5904
|
+
{
|
|
5905
|
+
columnName: "reason",
|
|
5906
|
+
strategy: {
|
|
5907
|
+
kind: "enum",
|
|
5908
|
+
options: {
|
|
5909
|
+
values: ["unauthorized", "product_not_received", "product_defective", "duplicate_charge", "subscription_canceled", "other"],
|
|
5910
|
+
weights: [0.25, 0.2, 0.15, 0.15, 0.15, 0.1]
|
|
5911
|
+
}
|
|
5912
|
+
}
|
|
5913
|
+
},
|
|
5914
|
+
{
|
|
5915
|
+
columnName: "amount_cents",
|
|
5916
|
+
strategy: { kind: "money", options: { min: 500, max: 2e5 } }
|
|
5917
|
+
},
|
|
5918
|
+
{
|
|
5919
|
+
columnName: "status",
|
|
5920
|
+
strategy: {
|
|
5921
|
+
kind: "enum",
|
|
5922
|
+
options: {
|
|
5923
|
+
values: ["open", "under_review", "won", "lost", "expired"],
|
|
5924
|
+
weights: [0.2, 0.25, 0.3, 0.15, 0.1]
|
|
5925
|
+
}
|
|
5926
|
+
}
|
|
5927
|
+
},
|
|
5928
|
+
{
|
|
5929
|
+
columnName: "filed_at",
|
|
5930
|
+
strategy: { kind: "timestamp", options: { mode: "past" } }
|
|
5931
|
+
}
|
|
5932
|
+
]
|
|
5933
|
+
}]
|
|
5934
|
+
])
|
|
5935
|
+
};
|
|
5936
|
+
|
|
5937
|
+
// ../../packages/templates/dist/domains/healthcare.js
|
|
5938
|
+
var healthcareTemplate = {
|
|
5939
|
+
name: "healthcare",
|
|
5940
|
+
version: "1.0",
|
|
5941
|
+
description: "Healthcare system with patients, providers, encounters, diagnoses, and billing",
|
|
5942
|
+
targetTables: ["patients", "providers", "encounters", "diagnoses", "billing"],
|
|
5943
|
+
tableConfigs: /* @__PURE__ */ new Map([
|
|
5944
|
+
["patients", {
|
|
5945
|
+
tableName: "patients",
|
|
5946
|
+
matchPattern: ["patients", "*patient*"],
|
|
5947
|
+
columnOverrides: [
|
|
5948
|
+
{
|
|
5949
|
+
columnName: "first_name",
|
|
5950
|
+
strategy: { kind: "first_name" }
|
|
5951
|
+
},
|
|
5952
|
+
{
|
|
5953
|
+
columnName: "last_name",
|
|
5954
|
+
strategy: { kind: "last_name" }
|
|
5955
|
+
},
|
|
5956
|
+
{
|
|
5957
|
+
columnName: "email",
|
|
5958
|
+
strategy: { kind: "email" }
|
|
5959
|
+
},
|
|
5960
|
+
{
|
|
5961
|
+
columnName: "phone",
|
|
5962
|
+
strategy: { kind: "phone" }
|
|
5963
|
+
},
|
|
5964
|
+
{
|
|
5965
|
+
columnName: "gender",
|
|
5966
|
+
strategy: {
|
|
5967
|
+
kind: "enum",
|
|
5968
|
+
options: {
|
|
5969
|
+
values: ["Male", "Female", "Non-binary", "Other", "Prefer not to say"],
|
|
5970
|
+
weights: [0.48, 0.48, 0.02, 0.01, 0.01]
|
|
5971
|
+
}
|
|
5972
|
+
}
|
|
5973
|
+
},
|
|
5974
|
+
{
|
|
5975
|
+
columnName: "insurance_provider",
|
|
5976
|
+
strategy: {
|
|
5977
|
+
kind: "enum",
|
|
5978
|
+
options: {
|
|
5979
|
+
values: ["Blue Cross", "Aetna", "UnitedHealth", "Cigna", "Humana", "Medicare", "Medicaid", "Self-Pay"],
|
|
5980
|
+
weights: [0.18, 0.15, 0.15, 0.12, 0.1, 0.12, 0.1, 0.08]
|
|
5981
|
+
}
|
|
5982
|
+
}
|
|
5983
|
+
},
|
|
5984
|
+
{
|
|
5985
|
+
columnName: "mrn",
|
|
5986
|
+
strategy: { kind: "text", options: { mode: "short" } }
|
|
5987
|
+
},
|
|
5988
|
+
{
|
|
5989
|
+
columnName: "date_of_birth",
|
|
5990
|
+
strategy: { kind: "timestamp", options: { mode: "past" } }
|
|
5991
|
+
},
|
|
5992
|
+
{
|
|
5993
|
+
columnName: "registered_at",
|
|
5994
|
+
strategy: { kind: "timestamp", options: { mode: "past" } }
|
|
5995
|
+
}
|
|
5996
|
+
]
|
|
5997
|
+
}],
|
|
5998
|
+
["providers", {
|
|
5999
|
+
tableName: "providers",
|
|
6000
|
+
matchPattern: ["providers", "doctors", "physicians", "*provider*"],
|
|
6001
|
+
columnOverrides: [
|
|
6002
|
+
{
|
|
6003
|
+
columnName: "first_name",
|
|
6004
|
+
strategy: { kind: "first_name" }
|
|
6005
|
+
},
|
|
6006
|
+
{
|
|
6007
|
+
columnName: "last_name",
|
|
6008
|
+
strategy: { kind: "last_name" }
|
|
6009
|
+
},
|
|
6010
|
+
{
|
|
6011
|
+
columnName: "email",
|
|
6012
|
+
strategy: { kind: "email" }
|
|
6013
|
+
},
|
|
6014
|
+
{
|
|
6015
|
+
columnName: "specialty",
|
|
6016
|
+
strategy: {
|
|
6017
|
+
kind: "enum",
|
|
6018
|
+
options: {
|
|
6019
|
+
values: ["Family Medicine", "Internal Medicine", "Pediatrics", "Cardiology", "Orthopedics", "Dermatology", "Neurology", "Psychiatry", "Emergency Medicine", "Radiology"],
|
|
6020
|
+
weights: [0.18, 0.15, 0.12, 0.1, 0.1, 0.08, 0.08, 0.07, 0.07, 0.05]
|
|
6021
|
+
}
|
|
6022
|
+
}
|
|
6023
|
+
},
|
|
6024
|
+
{
|
|
6025
|
+
columnName: "department",
|
|
6026
|
+
strategy: {
|
|
6027
|
+
kind: "enum",
|
|
6028
|
+
options: {
|
|
6029
|
+
values: ["Primary Care", "Surgery", "Emergency", "Specialty", "Diagnostics"],
|
|
6030
|
+
weights: [0.3, 0.2, 0.15, 0.25, 0.1]
|
|
6031
|
+
}
|
|
6032
|
+
}
|
|
6033
|
+
},
|
|
6034
|
+
{
|
|
6035
|
+
columnName: "npi",
|
|
6036
|
+
strategy: { kind: "text", options: { mode: "short" } }
|
|
6037
|
+
},
|
|
6038
|
+
{
|
|
6039
|
+
columnName: "active",
|
|
6040
|
+
strategy: { kind: "boolean", options: { trueWeight: 0.92 } }
|
|
6041
|
+
}
|
|
6042
|
+
]
|
|
6043
|
+
}],
|
|
6044
|
+
["encounters", {
|
|
6045
|
+
tableName: "encounters",
|
|
6046
|
+
matchPattern: ["encounters", "visits", "appointments", "*encounter*", "*visit*"],
|
|
6047
|
+
columnOverrides: [
|
|
6048
|
+
{
|
|
6049
|
+
columnName: "encounter_type",
|
|
6050
|
+
strategy: {
|
|
6051
|
+
kind: "enum",
|
|
6052
|
+
options: {
|
|
6053
|
+
values: ["office_visit", "emergency", "telehealth", "procedure", "follow_up", "annual_checkup"],
|
|
6054
|
+
weights: [0.35, 0.08, 0.15, 0.12, 0.18, 0.12]
|
|
6055
|
+
}
|
|
6056
|
+
}
|
|
6057
|
+
},
|
|
6058
|
+
{
|
|
6059
|
+
columnName: "status",
|
|
6060
|
+
strategy: {
|
|
6061
|
+
kind: "enum",
|
|
6062
|
+
options: {
|
|
6063
|
+
values: ["completed", "scheduled", "in_progress", "canceled", "no_show"],
|
|
6064
|
+
weights: [0.55, 0.15, 0.1, 0.1, 0.1]
|
|
6065
|
+
}
|
|
6066
|
+
}
|
|
6067
|
+
},
|
|
6068
|
+
{
|
|
6069
|
+
columnName: "chief_complaint",
|
|
6070
|
+
strategy: {
|
|
6071
|
+
kind: "enum",
|
|
6072
|
+
options: {
|
|
6073
|
+
values: ["Headache", "Back pain", "Cough", "Chest pain", "Fatigue", "Fever", "Joint pain", "Shortness of breath", "Abdominal pain", "Skin rash", "Dizziness", "Annual checkup"],
|
|
6074
|
+
weights: [0.1, 0.12, 0.1, 0.06, 0.08, 0.08, 0.09, 0.06, 0.08, 0.07, 0.06, 0.1]
|
|
6075
|
+
}
|
|
6076
|
+
}
|
|
6077
|
+
},
|
|
6078
|
+
{
|
|
6079
|
+
columnName: "scheduled_at",
|
|
6080
|
+
strategy: { kind: "timestamp", options: { mode: "past" } }
|
|
6081
|
+
}
|
|
6082
|
+
]
|
|
6083
|
+
}],
|
|
6084
|
+
["diagnoses", {
|
|
6085
|
+
tableName: "diagnoses",
|
|
6086
|
+
matchPattern: ["diagnoses", "*diagnosis*", "*diagnos*"],
|
|
6087
|
+
columnOverrides: [
|
|
6088
|
+
{
|
|
6089
|
+
columnName: "icd_code",
|
|
6090
|
+
strategy: {
|
|
6091
|
+
kind: "enum",
|
|
6092
|
+
options: {
|
|
6093
|
+
values: ["J06.9", "M54.5", "I10", "E11.9", "J20.9", "R51.9", "M25.50", "Z00.00", "K21.0", "L30.9", "F41.1", "E78.5"],
|
|
6094
|
+
weights: [0.1, 0.1, 0.12, 0.1, 0.08, 0.08, 0.08, 0.08, 0.07, 0.06, 0.07, 0.06]
|
|
6095
|
+
}
|
|
6096
|
+
}
|
|
6097
|
+
},
|
|
6098
|
+
{
|
|
6099
|
+
columnName: "description",
|
|
6100
|
+
strategy: {
|
|
6101
|
+
kind: "enum",
|
|
6102
|
+
options: {
|
|
6103
|
+
values: ["Acute upper respiratory infection", "Low back pain", "Essential hypertension", "Type 2 diabetes", "Acute bronchitis", "Headache", "Joint pain", "General adult medical exam", "Gastroesophageal reflux", "Dermatitis", "Generalized anxiety disorder", "Hyperlipidemia"],
|
|
6104
|
+
weights: [0.1, 0.1, 0.12, 0.1, 0.08, 0.08, 0.08, 0.08, 0.07, 0.06, 0.07, 0.06]
|
|
6105
|
+
}
|
|
6106
|
+
}
|
|
6107
|
+
},
|
|
6108
|
+
{
|
|
6109
|
+
columnName: "diagnosis_type",
|
|
6110
|
+
strategy: {
|
|
6111
|
+
kind: "enum",
|
|
6112
|
+
options: {
|
|
6113
|
+
values: ["primary", "secondary", "admitting", "working"],
|
|
6114
|
+
weights: [0.6, 0.25, 0.08, 0.07]
|
|
6115
|
+
}
|
|
6116
|
+
}
|
|
6117
|
+
},
|
|
6118
|
+
{
|
|
6119
|
+
columnName: "diagnosed_at",
|
|
6120
|
+
strategy: { kind: "timestamp", options: { mode: "past" } }
|
|
6121
|
+
}
|
|
6122
|
+
]
|
|
6123
|
+
}],
|
|
6124
|
+
["billing", {
|
|
6125
|
+
tableName: "billing",
|
|
6126
|
+
matchPattern: ["billing", "claims", "charges", "*bill*", "*claim*"],
|
|
6127
|
+
columnOverrides: [
|
|
6128
|
+
{
|
|
6129
|
+
columnName: "cpt_code",
|
|
6130
|
+
strategy: {
|
|
6131
|
+
kind: "enum",
|
|
6132
|
+
options: {
|
|
6133
|
+
values: ["99213", "99214", "99215", "99203", "99204", "99281", "99282", "99283", "99395", "99396"],
|
|
6134
|
+
weights: [0.25, 0.2, 0.1, 0.1, 0.08, 0.05, 0.05, 0.05, 0.06, 0.06]
|
|
6135
|
+
}
|
|
6136
|
+
}
|
|
6137
|
+
},
|
|
6138
|
+
{
|
|
6139
|
+
columnName: "description",
|
|
6140
|
+
strategy: {
|
|
6141
|
+
kind: "enum",
|
|
6142
|
+
options: {
|
|
6143
|
+
values: ["Office visit - established, low", "Office visit - established, moderate", "Office visit - established, high", "Office visit - new, low", "Office visit - new, moderate", "ED visit - low", "ED visit - moderate", "ED visit - high", "Preventive visit 18-39", "Preventive visit 40-64"],
|
|
6144
|
+
weights: [0.25, 0.2, 0.1, 0.1, 0.08, 0.05, 0.05, 0.05, 0.06, 0.06]
|
|
6145
|
+
}
|
|
6146
|
+
}
|
|
6147
|
+
},
|
|
6148
|
+
{
|
|
6149
|
+
columnName: "amount_cents",
|
|
6150
|
+
strategy: { kind: "money", options: { min: 5e3, max: 15e4 } }
|
|
6151
|
+
},
|
|
6152
|
+
{
|
|
6153
|
+
columnName: "insurance_covered_cents",
|
|
6154
|
+
strategy: { kind: "money", options: { min: 0, max: 12e4 } }
|
|
6155
|
+
},
|
|
6156
|
+
{
|
|
6157
|
+
columnName: "patient_responsibility_cents",
|
|
6158
|
+
strategy: { kind: "money", options: { min: 0, max: 5e4 } }
|
|
6159
|
+
},
|
|
6160
|
+
{
|
|
6161
|
+
columnName: "status",
|
|
6162
|
+
strategy: {
|
|
6163
|
+
kind: "enum",
|
|
6164
|
+
options: {
|
|
6165
|
+
values: ["paid", "pending", "denied", "appealed", "partially_paid"],
|
|
6166
|
+
weights: [0.5, 0.2, 0.1, 0.05, 0.15]
|
|
6167
|
+
}
|
|
6168
|
+
}
|
|
6169
|
+
},
|
|
6170
|
+
{
|
|
6171
|
+
columnName: "billed_at",
|
|
6172
|
+
strategy: { kind: "timestamp", options: { mode: "past" } }
|
|
6173
|
+
}
|
|
6174
|
+
]
|
|
6175
|
+
}]
|
|
6176
|
+
])
|
|
6177
|
+
};
|
|
6178
|
+
|
|
5711
6179
|
// ../../packages/templates/dist/registry.js
|
|
5712
6180
|
var TemplateRegistry = class {
|
|
5713
6181
|
templates = /* @__PURE__ */ new Map();
|
|
@@ -5763,6 +6231,8 @@ function getDefaultRegistry() {
|
|
|
5763
6231
|
registry.register(saasTemplate);
|
|
5764
6232
|
registry.register(ecommerceTemplate);
|
|
5765
6233
|
registry.register(educationTemplate);
|
|
6234
|
+
registry.register(fintechTemplate);
|
|
6235
|
+
registry.register(healthcareTemplate);
|
|
5766
6236
|
return registry;
|
|
5767
6237
|
}
|
|
5768
6238
|
|
|
@@ -6827,7 +7297,7 @@ async function captureDatabase(config, options) {
|
|
|
6827
7297
|
};
|
|
6828
7298
|
const masked = maskConnection(config.database.connectionString);
|
|
6829
7299
|
const pack = {
|
|
6830
|
-
format: "
|
|
7300
|
+
format: "realitydb-pack",
|
|
6831
7301
|
version: "1.0",
|
|
6832
7302
|
metadata: {
|
|
6833
7303
|
name: options.name,
|
|
@@ -6920,7 +7390,7 @@ function maskConnectionString(connectionString) {
|
|
|
6920
7390
|
}
|
|
6921
7391
|
|
|
6922
7392
|
// src/commands/scan.ts
|
|
6923
|
-
var VERSION2 = "0.
|
|
7393
|
+
var VERSION2 = "0.4.1";
|
|
6924
7394
|
async function scanCommand(options) {
|
|
6925
7395
|
const start = performance.now();
|
|
6926
7396
|
try {
|
|
@@ -7011,7 +7481,7 @@ async function scanCommand(options) {
|
|
|
7011
7481
|
}
|
|
7012
7482
|
|
|
7013
7483
|
// src/commands/seed.ts
|
|
7014
|
-
var VERSION3 = "0.
|
|
7484
|
+
var VERSION3 = "0.4.1";
|
|
7015
7485
|
async function seedCommand(options) {
|
|
7016
7486
|
const start = performance.now();
|
|
7017
7487
|
try {
|
|
@@ -7189,7 +7659,7 @@ async function seedCommand(options) {
|
|
|
7189
7659
|
}
|
|
7190
7660
|
|
|
7191
7661
|
// src/commands/reset.ts
|
|
7192
|
-
var VERSION4 = "0.
|
|
7662
|
+
var VERSION4 = "0.4.1";
|
|
7193
7663
|
async function resetCommand(options) {
|
|
7194
7664
|
const start = performance.now();
|
|
7195
7665
|
if (!options.ci && !options.confirm) {
|
|
@@ -7259,7 +7729,7 @@ async function resetCommand(options) {
|
|
|
7259
7729
|
}
|
|
7260
7730
|
|
|
7261
7731
|
// src/commands/export.ts
|
|
7262
|
-
var VERSION5 = "0.
|
|
7732
|
+
var VERSION5 = "0.4.1";
|
|
7263
7733
|
async function exportCommand(options) {
|
|
7264
7734
|
const start = performance.now();
|
|
7265
7735
|
try {
|
|
@@ -7611,7 +8081,7 @@ async function packImportCommand(filePath, options) {
|
|
|
7611
8081
|
|
|
7612
8082
|
// src/commands/capture.ts
|
|
7613
8083
|
var import_promises8 = require("fs/promises");
|
|
7614
|
-
var VERSION6 = "0.
|
|
8084
|
+
var VERSION6 = "0.4.1";
|
|
7615
8085
|
async function captureCommand(options) {
|
|
7616
8086
|
const start = performance.now();
|
|
7617
8087
|
try {
|
|
@@ -7711,7 +8181,7 @@ async function captureCommand(options) {
|
|
|
7711
8181
|
}
|
|
7712
8182
|
|
|
7713
8183
|
// src/commands/share.ts
|
|
7714
|
-
var VERSION7 = "0.
|
|
8184
|
+
var VERSION7 = "0.4.1";
|
|
7715
8185
|
async function shareCommand(filePath, options) {
|
|
7716
8186
|
const start = performance.now();
|
|
7717
8187
|
try {
|
|
@@ -7786,7 +8256,7 @@ async function shareCommand(filePath, options) {
|
|
|
7786
8256
|
}
|
|
7787
8257
|
|
|
7788
8258
|
// src/commands/load.ts
|
|
7789
|
-
var VERSION8 = "0.
|
|
8259
|
+
var VERSION8 = "0.4.1";
|
|
7790
8260
|
async function loadCommand(filePath, options) {
|
|
7791
8261
|
const start = performance.now();
|
|
7792
8262
|
try {
|
|
@@ -7929,7 +8399,7 @@ async function loadCommand(filePath, options) {
|
|
|
7929
8399
|
}
|
|
7930
8400
|
|
|
7931
8401
|
// src/cli.ts
|
|
7932
|
-
var VERSION9 = "0.
|
|
8402
|
+
var VERSION9 = "0.4.1";
|
|
7933
8403
|
function run(argv) {
|
|
7934
8404
|
const program2 = new Command();
|
|
7935
8405
|
program2.name("realitydb").description("RealityDB \u2014 Developer Reality Platform").version(VERSION9).option("--config <path>", "Path to config file").option("--ci", "CI mode: JSON output, no prompts, proper exit codes", false).option("--verbose", "Enable verbose output", false);
|