diff --git a/library/standard_tables_capture.inc b/library/standard_tables_capture.inc index 0cdc28f191e..58b1dddc432 100644 --- a/library/standard_tables_capture.inc +++ b/library/standard_tables_capture.inc @@ -47,18 +47,10 @@ function temp_unarchive($filename, $type) return false; } else { // let's unzip the file - // use checksums to determine the "version" - // - $zip = new ZipArchive; - if ($zip->open($filename, ZipArchive::CREATE) === true) { - // cms.gov added a subfolder to the archive :| filed a ticket with them 8-20-19 :) - for ($i = 0; $i < $zip->numFiles; $i++) { - $full_file_name = $zip->getNameIndex($i); - $fileinfo = pathinfo($full_file_name); - if (!copy("zip://".$filename."#".$full_file_name, $GLOBALS['temporary_files_dir']."/". - $type."/".$fileinfo['basename'])) { - return false; - }; + $zip = new ZipArchive(); + if ($zip->open($filename) === true) { + if (!($zip->extractTo($GLOBALS['temporary_files_dir'] . "/" . $type))) { + return false; } $zip->close(); return true; @@ -434,10 +426,13 @@ function snomedRF2_import() // function icd_import($type) { - // set up paths - $dir_icd = $GLOBALS['temporary_files_dir']."/".$type."/"; - $dir=str_replace('\\', '/', $dir_icd); + $dir_icd = $GLOBALS['temporary_files_dir'] . "/" . $type . "/"; + $dir = str_replace('\\', '/', $dir_icd); + // since CMS nested the ICD10 codes... + if ($type == 'ICD10') { + $dir = $dir . "/2020 Code Descriptions/"; + } $db_load = ''; $db_update = '';