Skip to content

Commit 8e13a5c

Browse files
committed
revisions to prior commit
1 parent 9d56778 commit 8e13a5c

File tree

6 files changed

+188
-248
lines changed

6 files changed

+188
-248
lines changed

custom/code_types.inc.php

+31-23
Original file line numberDiff line numberDiff line change
@@ -37,26 +37,18 @@
3737
*
3838
* </pre>
3939
*
40-
* Copyright (C) 2006-2010 Rod Roark <[email protected]>
4140
*
42-
* LICENSE: This program is free software; you can redistribute it and/or
43-
* modify it under the terms of the GNU General Public License
44-
* as published by the Free Software Foundation; either version 2
45-
* of the License, or (at your option) any later version.
46-
* This program is distributed in the hope that it will be useful,
47-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
48-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
49-
* GNU General Public License for more details.
50-
* You should have received a copy of the GNU General Public License
51-
* along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>;.
52-
*
53-
* @package OpenEMR
54-
* @author Rod Roark <[email protected]>
55-
* @author Brady Miller <[email protected]>
56-
* @author Kevin Yeh <[email protected]>
57-
* @link http://www.open-emr.org
41+
* @package OpenEMR
42+
* @link https://www.open-emr.org
43+
* @author Rod Roark <[email protected]>
44+
* @author Brady Miller <[email protected]>
45+
* @author Kevin Yeh <[email protected]>
46+
* @copyright Copyright (c) 2006-2010 Rod Roark <[email protected]>
47+
* @copyright Copyright (c) 2019 Brady Miller <[email protected]>
48+
* @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
5849
*/
5950

51+
6052
require_once(dirname(__FILE__)."/../library/csv_like_join.php");
6153

6254
$code_types = array();
@@ -141,12 +133,6 @@ function define_external_table(&$results, $index, $table_name, $col_code, $col_d
141133

142134
// For generic concepts, use the fully specified description (DescriptionType=3) so we can tell the difference between them.
143135
define_external_table($code_external_tables, 7, 'sct_descriptions', 'ConceptId', 'Term', 'Term', array("DescriptionStatus=0","DescriptionType=3"), "");
144-
define_external_table($code_external_tables,10,'sct2_description','conceptId','term','term',array("active=1","term LIKE '%(disorder)'"),"");
145-
//define_external_table($code_external_tables,10,'sct2_description','conceptId','term','term',array("active=1"),"");
146-
define_external_table($code_external_tables,11,'sct2_description','conceptId','term','term',array("active=1"),"");
147-
//define_external_table($code_external_tables,12,'sct2_description','conceptId','term','term',array("active=1"),"");
148-
define_external_table($code_external_tables,12,'sct2_description','conceptId','term','term',array("active=1","term LIKE '%(procedure)'"),"");
149-
150136

151137
// To determine codes, we need to evaluate data in both the sct_descriptions table, and the sct_concepts table.
152138
// the base join with sct_concepts is the same for all types of SNOMED definitions, so we define the common part here
@@ -162,6 +148,15 @@ function define_external_table(&$results, $index, $table_name, $col_code, $col_d
162148
// Add the filter to choose only procedures. This filter happens as part of the join with the sct_concepts table
163149
array_push($code_external_tables[9][EXT_JOINS][0][JOIN_FIELDS], "FullySpecifiedName like '%(procedure)'");
164150

151+
// SNOMED RF2 definitions
152+
define_external_table($code_external_tables, 11, 'sct2_description', 'conceptId', 'term', 'term', array("active=1"), "");
153+
if (isSnomedSpanish()) {
154+
define_external_table($code_external_tables, 10, 'sct2_description', 'conceptId', 'term', 'term', array("active=1", "term LIKE '%(trastorno)'"), "");
155+
define_external_table($code_external_tables, 12, 'sct2_description', 'conceptId', 'term', 'term', array("active=1", "term LIKE '%(procedimiento)'"), "");
156+
} else {
157+
define_external_table($code_external_tables, 10, 'sct2_description', 'conceptId', 'term', 'term', array("active=1", "term LIKE '%(disorder)'"), "");
158+
define_external_table($code_external_tables, 12, 'sct2_description', 'conceptId', 'term', 'term', array("active=1", "term LIKE '%(procedure)'"), "");
159+
}
165160

166161
//**** End SNOMED Definitions
167162

@@ -189,6 +184,19 @@ function define_external_table(&$results, $index, $table_name, $col_code, $col_d
189184
'12' => xl('SNOMED (RF2) Procedure')
190185
);
191186

187+
/**
188+
* Checks to see if using spanish snomed
189+
*/
190+
function isSnomedSpanish()
191+
{
192+
// See if most recent SNOMED entry is International:Spanish
193+
$sql = sqlQuery("SELECT `revision_version` FROM `standardized_tables_track` WHERE `name` = 'SNOMED' ORDER BY `id` DESC");
194+
if ((!empty($sql)) && ($sql['revision_version'] == "International:Spanish")) {
195+
return true;
196+
}
197+
return false;
198+
}
199+
192200
/**
193201
* Checks is fee are applicable to any of the code types.
194202
*

interface/code_systems/dataloads_ajax.php

+12-24
Original file line numberDiff line numberDiff line change
@@ -3,36 +3,24 @@
33
* This file implements the main jquery interface for loading external
44
* database files into openEMR
55
*
6-
* Copyright (C) 2012 Patient Healthcare Analytics, Inc.
7-
* Copyright (C) 2011 Phyaura, LLC <[email protected]>
8-
*
9-
* LICENSE: This program is free software; you can redistribute it and/or
10-
* modify it under the terms of the GNU General Public License
11-
* as published by the Free Software Foundation; either version 2
12-
* of the License, or (at your option) any later version.
13-
* This program is distributed in the hope that it will be useful,
14-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16-
* GNU General Public License for more details.
17-
* You should have received a copy of the GNU General Public License
18-
* along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>;.
19-
*
20-
* @package OpenEMR
21-
* @author (Mac) Kevin McAloon <[email protected]>
22-
* @author Rohit Kumar <[email protected]>
23-
* @author Brady Miller <[email protected]>
24-
* @link http://www.open-emr.org
6+
* @package OpenEMR
7+
* @link https://www.open-emr.org
8+
* @author (Mac) Kevin McAloon <[email protected]>
9+
* @author Rohit Kumar <[email protected]>
10+
* @author Brady Miller <[email protected]>
11+
* @author Roberto Vasquez <[email protected]>
12+
* @copyright Copyright (c) 2011 Phyaura, LLC <[email protected]>
13+
* @copyright Copyright (c) 2012 Patient Healthcare Analytics, Inc.
14+
* @copyright Copyright (c) 2019 Brady Miller <[email protected]>
15+
* @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
2516
*/
2617

2718

28-
29-
3019
require_once("../../interface/globals.php");
3120
require_once("$srcdir/acl.inc");
3221

33-
// Ensure script doesn't time out and has enough memory
22+
// Ensure script doesn't time out
3423
set_time_limit(0);
35-
ini_set('memory_limit', '150M');
3624

3725
// Control access
3826
if (!acl_check('admin', 'super')) {
@@ -125,7 +113,7 @@ function(e){
125113
var stg_load_id = '#' + $(ui.newContent).attr('id') + "_stg_loading";
126114
$(stg_load_id).show();
127115
var thisInterval;
128-
var parm = 'db=' + $(ui.newContent).attr('id') + '&newInstall=' + (($(this).val() === 'INSTALL') ? 1 : 0) + '&file_checksum=' + $(this).attr('file_checksum') + '&file_revision_date=' + $(this).attr('file_revision_date') + '&version=' + $(this).attr('version');
116+
var parm = 'db=' + $(ui.newContent).attr('id') + '&newInstall=' + (($(this).val() === 'INSTALL') ? 1 : 0) + '&file_checksum=' + $(this).attr('file_checksum') + '&file_revision_date=' + $(this).attr('file_revision_date') + '&version=' + $(this).attr('version') + '&rf=' + $(this).attr('rf');
129117
var stg_dets_id = '#' + $(ui.newContent).attr('id') + "_stage_details";
130118
$activeAccordionSection = $("#accordion").accordion('option', 'active');
131119

interface/code_systems/list_staged.php

+48-38
Original file line numberDiff line numberDiff line change
@@ -13,31 +13,20 @@
1313
* When the staged files are the same as the instance installed then
1414
* an appropriate message is rendered
1515
*
16-
* Copyright (C) 2012 Patient Healthcare Analytics, Inc.
17-
* Copyright (C) 2011 Phyaura, LLC <[email protected]>
1816
*
19-
* LICENSE: This program is free software; you can redistribute it and/or
20-
* modify it under the terms of the GNU General Public License
21-
* as published by the Free Software Foundation; either version 2
22-
* of the License, or (at your option) any later version.
23-
* This program is distributed in the hope that it will be useful,
24-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
25-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26-
* GNU General Public License for more details.
27-
* You should have received a copy of the GNU General Public License
28-
* along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>;.
29-
*
30-
* @package OpenEMR
31-
* @author (Mac) Kevin McAloon <[email protected]>
32-
* @author Rohit Kumar <[email protected]>
33-
* @author Brady Miller <[email protected]>
34-
* @author Roberto Vasquez <[email protected]>
35-
* @link http://www.open-emr.org
17+
* @package OpenEMR
18+
* @link https://www.open-emr.org
19+
* @author (Mac) Kevin McAloon <[email protected]>
20+
* @author Rohit Kumar <[email protected]>
21+
* @author Brady Miller <[email protected]>
22+
* @author Roberto Vasquez <[email protected]>
23+
* @copyright Copyright (c) 2011 Phyaura, LLC <[email protected]>
24+
* @copyright Copyright (c) 2012 Patient Healthcare Analytics, Inc.
25+
* @copyright Copyright (c) 2019 Brady Miller <[email protected]>
26+
* @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
3627
*/
3728

3829

39-
40-
4130
require_once("../../interface/globals.php");
4231
require_once("$srcdir/acl.inc");
4332

@@ -187,27 +176,44 @@
187176
$temp_date = array('date'=>$date_release, 'version'=>$version, 'path'=>$mainPATH."/".$matches[0]);
188177
array_push($revisions, $temp_date);
189178
$supported_file = 1;
190-
} else if (preg_match("/SnomedCT_RF2Release_INT_([0-9]{8}).zip/",$file,$matches)) {
191-
179+
} else if (preg_match("/SnomedCT_InternationalRF2_PRODUCTION_([0-9]{8})[0-9a-zA-Z]{8}.zip/", $file, $matches)) {
192180
// Hard code the version SNOMED feed to be International:English
193-
// (if add different SNOMED types/versions/languages, then can use this)
194181
//
195-
$version = "RF2International:English";
196-
$date_release = substr($matches[1],0,4)."-".substr($matches[1],4,-2)."-".substr($matches[1],6);
182+
$version = "International:English";
183+
$rf2 = true;
184+
$date_release = substr($matches[1], 0, 4)."-".substr($matches[1], 4, -2)."-".substr($matches[1], 6);
185+
$temp_date = array('date'=>$date_release, 'version'=>$version, 'path'=>$mainPATH."/".$matches[0]);
186+
array_push($revisions, $temp_date);
187+
$supported_file = 1;
188+
} else if (preg_match("/SnomedCT_USEditionRF2_PRODUCTION_([0-9]{8})[0-9a-zA-Z]{8}.zip/", $file, $matches)) {
189+
// Hard code the version SNOMED feed to be Complete US Extension
190+
//
191+
$version = "Complete US Extension";
192+
$rf2 = true;
193+
$date_release = substr($matches[1], 0, 4)."-".substr($matches[1], 4, -2)."-".substr($matches[1], 6);
197194
$temp_date = array('date'=>$date_release, 'version'=>$version, 'path'=>$mainPATH."/".$matches[0]);
198-
array_push($revisions,$temp_date);
195+
array_push($revisions, $temp_date);
196+
$supported_file = 1;
197+
} else if (preg_match("/SnomedCT_SpanishRelease-es_PRODUCTION_([0-9]{8})[0-9a-zA-Z]{8}.zip/", $file, $matches)) {
198+
// Hard code the version SNOMED feed to be International:Spanish
199+
//
200+
$version = "International:Spanish";
201+
$rf2 = true;
202+
$date_release = substr($matches[1], 0, 4)."-".substr($matches[1], 4, -2)."-".substr($matches[1], 6);
203+
$temp_date = array('date'=>$date_release, 'version'=>$version, 'path'=>$mainPATH."/".$matches[0]);
204+
array_push($revisions, $temp_date);
199205
$supported_file = 1;
200206
} else {
201207
// nothing
202208
}
203209
} else if (is_numeric(strpos($db, "ICD"))) {
204210
$qry_str = "SELECT `load_checksum`,`load_source`,`load_release_date` FROM `supported_external_dataloads` WHERE `load_type` = ? and `load_filename` = ? and `load_checksum` = ? ORDER BY `load_release_date` DESC";
205211

206-
// this query determines whether you can load the data into openEMR. you must have the correct
207-
// filename and checksum for each file that are part of the same release.
208-
//
209-
// IMPORTANT: Releases that contain mutliple zip file (e.g. ICD10) are grouped together based
210-
// on the load_release_date attribute value specified in the supported_external_dataloads table
212+
// this query determines whether you can load the data into openEMR. you must have the correct
213+
// filename and checksum for each file that are part of the same release.
214+
//
215+
// IMPORTANT: Releases that contain mutliple zip file (e.g. ICD10) are grouped together based
216+
// on the load_release_date attribute value specified in the supported_external_dataloads table
211217
//
212218
// Just in case same filename is released on different release dates, best to actually include the md5sum in the query itself.
213219
// (and if a hit, then it is a pass)
@@ -261,7 +267,7 @@
261267
if ($supported_file === 1) {
262268
$success_flag=1;
263269

264-
// Only allow 1 staged revision for the SNOMED and RXNORM imports
270+
// Only allow 1 staged revision for the SNOMED and RXNORM imports
265271
if (($db=="SNOMED" || $db=="RXNORM") && (count($revisions) > 1)) {
266272
?>
267273
<div class="error_msg"><?php echo xlt("The number of staged files is incorrect. Only place the file that you wish to install/upgrade to."); ?></div>
@@ -270,8 +276,8 @@
270276
$success_flag=0;
271277
}
272278

273-
// Ensure all release dates and revisions are the same for multiple file imports
274-
// and collect the date and revision. Also collect a checksum and path.
279+
// Ensure all release dates and revisions are the same for multiple file imports
280+
// and collect the date and revision. Also collect a checksum and path.
275281
$file_revision_date = '';
276282
$file_revision = '';
277283
$file_checksum = '';
@@ -311,7 +317,7 @@
311317
$file_revision_path = $value['path'];
312318
}
313319

314-
// Determine and enforce only a certain number of files to be staged
320+
// Determine and enforce only a certain number of files to be staged
315321
if ($success_flag === 1) {
316322
$number_files = 1;
317323
$sql_query_ret = sqlStatement("SELECT * FROM `supported_external_dataloads` WHERE `load_type` = ? AND `load_source` = ? AND `load_release_date` = ?", array($db,$file_revision,$file_revision_date));
@@ -330,7 +336,7 @@
330336
}
331337
}
332338

333-
// If new version is being offered, then provide install/upgrade options
339+
// If new version is being offered, then provide install/upgrade options
334340
if ($success_flag === 1) {
335341
$action = "";
336342
if ($installed_flag === 1) {
@@ -419,8 +425,12 @@
419425
}
420426

421427
if (strlen($action) > 0) {
428+
$rf = "rf1";
429+
if (!empty($rf2)) {
430+
$rf = "rf2";
431+
}
422432
?>
423-
<input id="<?php echo attr($db); ?>_install_button" version="<?php echo attr($file_revision); ?>" file_revision_date="<?php echo attr($file_revision_date); ?>" file_checksum="<?php echo attr($file_checksum); ?>" type="button" value="<?php echo attr($action); ?>"/>
433+
<input id="<?php echo attr($db); ?>_install_button" version="<?php echo attr($file_revision); ?>" rf="<?php echo $rf; ?>" file_revision_date="<?php echo attr($file_revision_date); ?>" file_checksum="<?php echo attr($file_checksum); ?>" type="button" value="<?php echo attr($action); ?>"/>
424434
</div>
425435
<?php
426436
}

0 commit comments

Comments
 (0)