forked from saketh-bandi/Relay_Heidi_Hackathon
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpopulate_mock_data.php
More file actions
executable file
·71 lines (58 loc) · 2 KB
/
populate_mock_data.php
File metadata and controls
executable file
·71 lines (58 loc) · 2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/usr/bin/env php
<?php
/**
* AI-generated code - Script to populate OpenEMR with mock patient data
* This script uses OpenEMR's fixture manager to install test patients
*/
// Bootstrap OpenEMR
require_once __DIR__ . '/vendor/autoload.php';
use OpenEMR\Tests\Fixtures\FixtureManager;
use OpenEMR\Common\Database\QueryUtils;
// Set up the environment
$_GET['site'] = 'default';
$ignoreAuth = true;
// Bootstrap globals
require_once __DIR__ . '/interface/globals.php';
echo "🏥 OpenEMR Mock Data Population Script\n";
echo "=====================================\n\n";
try {
$fixtureManager = new FixtureManager();
echo "📝 Installing patient fixtures...\n";
$patientCount = $fixtureManager->installPatientFixtures();
echo "✅ Installed $patientCount patient records\n\n";
echo "📋 Installed Patients:\n";
echo "-------------------\n";
// Query the installed patients
$sql = "SELECT pid, pubpid, fname, lname, DOB, sex, city, state, postal_code
FROM patient_data
WHERE pubpid LIKE 'test-fixture%'
ORDER BY pid
LIMIT 20";
$result = sqlStatement($sql);
$count = 0;
while ($row = sqlFetchArray($result)) {
$count++;
echo sprintf(
"%d. %s %s (ID: %s)\n" .
" DOB: %s | Sex: %s\n" .
" Location: %s, %s %s\n\n",
$count,
$row['fname'],
$row['lname'],
$row['pubpid'],
$row['DOB'],
$row['sex'],
$row['city'],
$row['state'],
$row['postal_code']
);
}
echo "\n✨ Success! Mock data has been populated.\n";
echo "📊 Total patients installed: $count\n";
echo "\n💡 You can now log in to OpenEMR and view these patients.\n";
echo "🔐 Login at: http://localhost:8000\n";
} catch (Exception $e) {
echo "❌ Error: " . $e->getMessage() . "\n";
echo "Stack trace:\n" . $e->getTraceAsString() . "\n";
exit(1);
}