-
-
Notifications
You must be signed in to change notification settings - Fork 173
Added OPENEMR_GIT arg in Dockerfile to allow pulling from test forks … #613
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
luissantosHCIT
wants to merge
7
commits into
openemr:master
Choose a base branch
from
luissantosHCIT:make_git_repo_url_an_arg_docker
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
964836c
feature(docker) Added OPENEMR_GIT arg in Dockerfile to allow pulling …
luissantosHCIT 188c2d2
chore(readme) Added OPENEMR_GIT to README
luissantosHCIT 1a4d24e
Merge pull request #1 from luissantosHCIT/make_git_repo_url_an_arg_do…
luissantosHCIT ad77857
feature(auto-import-codes) Added script for automatically importing a…
luissantosHCIT 9fff8d4
Merge pull request #2 from luissantosHCIT/incorporate_simple_auto_cod…
luissantosHCIT 3330813
chore(merge-conflicts) reviewed and addressed merge conflicts from up…
luissantosHCIT dd001d1
Merge pull request #3 from luissantosHCIT/patched
luissantosHCIT File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,120 @@ | ||
| #!/usr/bin/env php | ||
| <?php | ||
| /** | ||
| * ======================================= | ||
| * OpenEMR Automated Code Import | ||
| * ======================================= | ||
| * This script walks through a directory tree up to one level to find archives of Code System databases. | ||
| * | ||
| * The import limit here is dictated by available functionality in OpenEMR. Currently, expect to import RXNORM, | ||
| * SNOMED, ICD9, ICD10 CM, ICD10 PCS, CQM_VALUESET, and any arbitrary dataset that conforms to the VALUESET format. | ||
| * | ||
| * Usage: | ||
| * php auto_import_codes.php [dir_root] | ||
| * | ||
| * Example: | ||
| * php auto_import_codes.php | ||
| * php auto_import_codes.php codes | ||
| * ============================================================================ | ||
| * @package OpenEMR | ||
| * @link https://www.open-emr.org | ||
| * @author Luis M. Santos, MD <lsantos@medicalmasses.com> | ||
| * @copyright Copyright (c) 2026 Luis M. Santos, MD <lsantos@medicalmasses.com> | ||
| * @copyright Copyright (c) 2026 MedicalMasses L.L.C. <https://medicalmasses.com> | ||
| * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3 | ||
| */ | ||
| $sitePath = '/var/www/localhost/htdocs/openemr'; | ||
| $_GET['site'] = 'default'; | ||
| $ignoreAuth = true; | ||
| $sessionAllowWrite = true; | ||
| chdir($sitePath); | ||
|
|
||
| // Load OpenEMR's Composer autoloader | ||
| // This gives us access to all OpenEMR classes, including the Installer class | ||
| require_once 'interface/globals.php'; | ||
| require_once 'library/standard_tables_capture.inc.php'; | ||
|
|
||
| function import_dir(string $type, $importFunction): void { | ||
| foreach (glob("*.zip") as $file) { | ||
| # Copy to temp | ||
| echo " [" . $type . "] Copying file => " . $file . "!\n"; | ||
| if (!temp_copy($file, $type)) { | ||
| error_log("Failed to copy " . $file . " of type " . $type); | ||
| return; | ||
| } | ||
|
|
||
| # Unpack | ||
| echo " [" . $type . "] Uncompressing file => " . $file . "!\n"; | ||
| if (!temp_unarchive($file, $type)) { | ||
| error_log("Failed to unzip " . $file . " of type " . $type); | ||
| } | ||
|
|
||
| # Import data | ||
| echo " [" . $type . "] Importing file => " . $file . "!\n"; | ||
| $importFunction($type); | ||
|
|
||
| # Cleanup | ||
| echo " [" . $type . "] Cleaning up import for file => " . $file . "!\n"; | ||
| temp_dir_cleanup($type); | ||
| } | ||
| } | ||
|
|
||
| function import_snomed(string $path): void { | ||
| // TODO: Consider including auto detection in OpenEMR at a later date. | ||
| try { | ||
| snomedRF2_import(); | ||
| } catch (Exception $e) { | ||
| try { | ||
| snomed_import(true); | ||
| } catch (Exception $e) { | ||
| snomed_import(); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| function import(string $path): void { | ||
| # Change to import directory | ||
| chdir($path); | ||
|
|
||
| # Scan directory | ||
| $dirs = scandir('./'); | ||
| echo "Available directories => ". $dirs . "\n"; | ||
| foreach ($dirs as $dir) { | ||
| if ($dir == "." || $dir == "..") { | ||
| continue; | ||
| } | ||
|
|
||
| if(is_dir($dir)) { | ||
| # Go into directory | ||
| echo "Entering directory => ". $dir . "\n"; | ||
| chdir($dir); | ||
|
|
||
| match ($dir) { | ||
| "icd9" => import_dir("ICD9", function ($type) {icd_import($type);}), | ||
| "icd10" => import_dir("ICD10", function ($type) {icd_import($type);}), | ||
| "rxnorm" => import_dir("RXNORM", function () {rxnorm_import(false);}), | ||
| "snomed" => import_dir("SNOMED", function ($file) {import_snomed($file);}), | ||
| "cqm", "cqm_valueset" => import_dir("CQM_VALUESET", function ($type) {valueset_import($type);}), | ||
| default => import_dir("VALUESET", function ($type) {valueset_import($type);}), | ||
| }; | ||
|
|
||
| # Restore parent path for the next iteration | ||
| echo "Exiting directory => ". $dir . " back to ". $path . "\n"; | ||
| chdir($path); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| // Ensure we're running from CLI | ||
| if (php_sapi_name() !== 'cli') { | ||
| throw RuntimeException('This tool can only be run from the command line'); | ||
| } | ||
|
|
||
| $contribPath = realpath($sitePath . '/contrib'); | ||
| if ($argc > 1) { | ||
| if (strlen($argv[1])) { | ||
| $contribPath = realpath($argv[1]); | ||
| } | ||
| } | ||
|
|
||
| import($contribPath); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,120 @@ | ||
| #!/usr/bin/env php | ||
| <?php | ||
| /** | ||
| * ======================================= | ||
| * OpenEMR Automated Code Import | ||
| * ======================================= | ||
| * This script walks through a directory tree up to one level to find archives of Code System databases. | ||
| * | ||
| * The import limit here is dictated by available functionality in OpenEMR. Currently, expect to import RXNORM, | ||
| * SNOMED, ICD9, ICD10 CM, ICD10 PCS, CQM_VALUESET, and any arbitrary dataset that conforms to the VALUESET format. | ||
| * | ||
| * Usage: | ||
| * php auto_import_codes.php [dir_root] | ||
| * | ||
| * Example: | ||
| * php auto_import_codes.php | ||
| * php auto_import_codes.php codes | ||
| * ============================================================================ | ||
| * @package OpenEMR | ||
| * @link https://www.open-emr.org | ||
| * @author Luis M. Santos, MD <lsantos@medicalmasses.com> | ||
| * @copyright Copyright (c) 2026 Luis M. Santos, MD <lsantos@medicalmasses.com> | ||
| * @copyright Copyright (c) 2026 MedicalMasses L.L.C. <https://medicalmasses.com> | ||
| * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3 | ||
| */ | ||
| $sitePath = '/var/www/localhost/htdocs/openemr'; | ||
| $_GET['site'] = 'default'; | ||
| $ignoreAuth = true; | ||
| $sessionAllowWrite = true; | ||
| chdir($sitePath); | ||
|
|
||
| // Load OpenEMR's Composer autoloader | ||
| // This gives us access to all OpenEMR classes, including the Installer class | ||
| require_once 'interface/globals.php'; | ||
| require_once 'library/standard_tables_capture.inc.php'; | ||
|
|
||
| function import_dir(string $type, $importFunction): void { | ||
| foreach (glob("*.zip") as $file) { | ||
| # Copy to temp | ||
| echo " [" . $type . "] Copying file => " . $file . "!\n"; | ||
| if (!temp_copy($file, $type)) { | ||
| error_log("Failed to copy " . $file . " of type " . $type); | ||
| return; | ||
| } | ||
|
|
||
| # Unpack | ||
| echo " [" . $type . "] Uncompressing file => " . $file . "!\n"; | ||
| if (!temp_unarchive($file, $type)) { | ||
| error_log("Failed to unzip " . $file . " of type " . $type); | ||
| } | ||
|
|
||
| # Import data | ||
| echo " [" . $type . "] Importing file => " . $file . "!\n"; | ||
| $importFunction($type); | ||
|
|
||
| # Cleanup | ||
| echo " [" . $type . "] Cleaning up import for file => " . $file . "!\n"; | ||
| temp_dir_cleanup($type); | ||
| } | ||
| } | ||
|
|
||
| function import_snomed(string $path): void { | ||
| // TODO: Consider including auto detection in OpenEMR at a later date. | ||
| try { | ||
| snomedRF2_import(); | ||
| } catch (Exception $e) { | ||
| try { | ||
| snomed_import(true); | ||
| } catch (Exception $e) { | ||
| snomed_import(); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| function import(string $path): void { | ||
| # Change to import directory | ||
| chdir($path); | ||
|
|
||
| # Scan directory | ||
| $dirs = scandir('./'); | ||
| echo "Available directories => ". $dirs . "\n"; | ||
| foreach ($dirs as $dir) { | ||
| if ($dir == "." || $dir == "..") { | ||
| continue; | ||
| } | ||
|
|
||
| if(is_dir($dir)) { | ||
| # Go into directory | ||
| echo "Entering directory => ". $dir . "\n"; | ||
| chdir($dir); | ||
|
|
||
| match ($dir) { | ||
| "icd9" => import_dir("ICD9", function ($type) {icd_import($type);}), | ||
| "icd10" => import_dir("ICD10", function ($type) {icd_import($type);}), | ||
| "rxnorm" => import_dir("RXNORM", function () {rxnorm_import(false);}), | ||
| "snomed" => import_dir("SNOMED", function ($file) {import_snomed($file);}), | ||
| "cqm", "cqm_valueset" => import_dir("CQM_VALUESET", function ($type) {valueset_import($type);}), | ||
| default => import_dir("VALUESET", function ($type) {valueset_import($type);}), | ||
| }; | ||
|
|
||
| # Restore parent path for the next iteration | ||
| echo "Exiting directory => ". $dir . " back to ". $path . "\n"; | ||
| chdir($path); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| // Ensure we're running from CLI | ||
| if (php_sapi_name() !== 'cli') { | ||
| throw RuntimeException('This tool can only be run from the command line'); | ||
| } | ||
|
|
||
| $contribPath = realpath($sitePath . '/contrib'); | ||
| if ($argc > 1) { | ||
| if (strlen($argv[1])) { | ||
| $contribPath = realpath($argv[1]); | ||
| } | ||
| } | ||
|
|
||
| import($contribPath); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the off chance the repo name ends with something other than 'openemr', the directory created won't be named 'openemr'. So an explicit name would be good.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll wait and update this once the other changes are merged. Thank you for the headsup!
One question (I am new to the project), why are the docker directories explicitly versioned as opposed to having a "latest" that gets backed up as the versioned directory prior to updating it further?
Thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point @luissantosHCIT, that would be a simpler strategy to have the workflows use next and dev and then stamp them with the version upon release
it'll be worth thinking about moving there after we release 8.1.0 in about a month