- The medicine database is now much bigger and has a real update path.
Added: Live source updater for RxNorm, DailyMed, and openFDA. Admin dashboard panel to refresh medicine sources. CLI updater for periodic jobs: [scripts/update_medicine_catalog.php](/Users/tyemeclifford/Documents/GH/workout/scripts/update_medicine_catalog.php) Update history table: medication_source_updates. Curl fallback for external fetches when PHP stream DNS fails. README instructions for periodic updates. I also ran the imports: Current medication catalog count: 6,002. Latest source imports:RxNorm: 3,875 inserted, 1,125 updated. openFDA: 912 inserted, 88 updated. DailyMed: 95 inserted. Periodic update command: /Users/tyemeclifford/frankenphp php-cli scripts/update_medicine_catalog.php 5000 all
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
require __DIR__ . '/../app/bootstrap.php';
|
||||
|
||||
if (PHP_SAPI !== 'cli') {
|
||||
fwrite(STDERR, "This script is intended for CLI use.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$limit = isset($argv[1]) ? (int) $argv[1] : 1000;
|
||||
$source = $argv[2] ?? 'all';
|
||||
|
||||
$result = refresh_medication_sources([
|
||||
'limit' => $limit,
|
||||
'source' => $source,
|
||||
]);
|
||||
|
||||
echo "Medication catalog refresh complete\n";
|
||||
echo "Catalog count: {$result['catalog_count']}\n";
|
||||
echo "Inserted: {$result['inserted']}\n";
|
||||
echo "Updated: {$result['updated']}\n";
|
||||
|
||||
foreach ($result['sources'] as $sourceResult) {
|
||||
echo "- {$sourceResult['source']}: {$sourceResult['status']} ";
|
||||
echo "({$sourceResult['inserted']} inserted, {$sourceResult['updated']} updated) ";
|
||||
echo "{$sourceResult['message']}\n";
|
||||
}
|
||||
Reference in New Issue
Block a user