Skip to content

Commit

Permalink
ICD10 import update (#5885)
Browse files Browse the repository at this point in the history
* remove old stuff and rename .inc to .php for vscode debugger

* php8 deprecation

* fix icd10 pcs load

* fix pcs and remove icd9

* use a generator

* a working draft

* remove icd9 from data load options

* use sqlquery instead

* fix bad code
  • Loading branch information
stephenwaite committed Nov 6, 2022
1 parent 338768f commit 1b1f687
Show file tree
Hide file tree
Showing 3 changed files with 154 additions and 188 deletions.
2 changes: 1 addition & 1 deletion interface/code_systems/dataloads_ajax.php
Expand Up @@ -131,7 +131,7 @@
//
// placemaker for when support DSMIV
//$db_list = array("DSMIV", "ICD9", "ICD10", "RXNORM", "SNOMED");
$db_list = array("ICD9", "ICD10", "RXNORM", "SNOMED","CQM_VALUESET");
$db_list = array("ICD10", "RXNORM", "SNOMED","CQM_VALUESET");
foreach ($db_list as $db) {
?>
<div class="card">
Expand Down
130 changes: 66 additions & 64 deletions library/smarty_legacy/smarty/Smarty_Compiler_Legacy.class.php
Expand Up @@ -1526,78 +1526,80 @@ function _parse_is_expr($is_arg, $tokens)
*/
function _parse_attrs($tag_args)
{

/* Tokenize tag attributes. */
preg_match_all('~(?:' . $this->_obj_call_regexp . '|' . $this->_qstr_regexp . ' | (?>[^"\'=\s]+)
)+ |
[=]
~x', $tag_args, $match);
$tokens = $match[0];

$attrs = array();
/* Parse state:
0 - expecting attribute name
1 - expecting '='
2 - expecting attribute value (not '=') */
$state = 0;

foreach ($tokens as $token) {
switch ($state) {
case 0:
/* If the token is a valid identifier, we set attribute name
and go to state 1. */
if (preg_match('~^\w+$~', $token)) {
$attr_name = $token;
$state = 1;
} else
$this->_syntax_error("invalid attribute name: '$token'", E_USER_ERROR, __FILE__, __LINE__);
break;

case 1:
/* If the token is '=', then we go to state 2. */
if ($token == '=') {
$state = 2;
} else
$this->_syntax_error("expecting '=' after attribute name '$last_token'", E_USER_ERROR, __FILE__, __LINE__);
break;
if (!empty($tag_args)) {
/* Tokenize tag attributes. */
preg_match_all('~(?:' . $this->_obj_call_regexp . '|' . $this->_qstr_regexp . ' | (?>[^"\'=\s]+)
)+ |
[=]
~x', $tag_args, $match);
$tokens = $match[0];

/* Parse state:
0 - expecting attribute name
1 - expecting '='
2 - expecting attribute value (not '=') */
$state = 0;

foreach ($tokens as $token) {
switch ($state) {
case 0:
/* If the token is a valid identifier, we set attribute name
and go to state 1. */
if (preg_match('~^\w+$~', $token)) {
$attr_name = $token;
$state = 1;
} else
$this->_syntax_error("invalid attribute name: '$token'", E_USER_ERROR, __FILE__, __LINE__);
break;

case 2:
/* If token is not '=', we set the attribute value and go to
state 0. */
if ($token != '=') {
/* We booleanize the token if it's a non-quoted possible
boolean value. */
if (preg_match('~^(on|yes|true)$~', $token)) {
$token = 'true';
} else if (preg_match('~^(off|no|false)$~', $token)) {
$token = 'false';
} else if ($token == 'null') {
$token = 'null';
} else if (preg_match('~^' . $this->_num_const_regexp . '|0[xX][0-9a-fA-F]+$~', $token)) {
/* treat integer literally */
} else if (!preg_match('~^' . $this->_obj_call_regexp . '|' . $this->_var_regexp . '(?:' . $this->_mod_regexp . ')*$~', $token)) {
/* treat as a string, double-quote it escaping quotes */
$token = '"'.addslashes($token).'"';
}
case 1:
/* If the token is '=', then we go to state 2. */
if ($token == '=') {
$state = 2;
} else
$this->_syntax_error("expecting '=' after attribute name '$last_token'", E_USER_ERROR, __FILE__, __LINE__);
break;

$attrs[$attr_name] = $token;
$state = 0;
} else
$this->_syntax_error("'=' cannot be an attribute value", E_USER_ERROR, __FILE__, __LINE__);
break;
case 2:
/* If token is not '=', we set the attribute value and go to
state 0. */
if ($token != '=') {
/* We booleanize the token if it's a non-quoted possible
boolean value. */
if (preg_match('~^(on|yes|true)$~', $token)) {
$token = 'true';
} else if (preg_match('~^(off|no|false)$~', $token)) {
$token = 'false';
} else if ($token == 'null') {
$token = 'null';
} else if (preg_match('~^' . $this->_num_const_regexp . '|0[xX][0-9a-fA-F]+$~', $token)) {
/* treat integer literally */
} else if (!preg_match('~^' . $this->_obj_call_regexp . '|' . $this->_var_regexp . '(?:' . $this->_mod_regexp . ')*$~', $token)) {
/* treat as a string, double-quote it escaping quotes */
$token = '"'.addslashes($token).'"';
}

$attrs[$attr_name] = $token;
$state = 0;
} else
$this->_syntax_error("'=' cannot be an attribute value", E_USER_ERROR, __FILE__, __LINE__);
break;
}
$last_token = $token;
}
$last_token = $token;
}

if($state != 0) {
if($state == 1) {
$this->_syntax_error("expecting '=' after attribute name '$last_token'", E_USER_ERROR, __FILE__, __LINE__);
} else {
$this->_syntax_error("missing attribute value", E_USER_ERROR, __FILE__, __LINE__);
if($state != 0) {
if($state == 1) {
$this->_syntax_error("expecting '=' after attribute name '$last_token'", E_USER_ERROR, __FILE__, __LINE__);
} else {
$this->_syntax_error("missing attribute value", E_USER_ERROR, __FILE__, __LINE__);
}
}
}

$this->_parse_vars_props($attrs);
$this->_parse_vars_props($attrs);
}

return $attrs;
}
Expand Down

0 comments on commit 1b1f687

Please sign in to comment.