Skip to content

Commit

Permalink
Revert "feat: Hook into the CDA Parsing functions (openemr#6716)" (op…
Browse files Browse the repository at this point in the history
…enemr#6730)

This reverts commit e2f1e03.
  • Loading branch information
robertdown authored Aug 10, 2023
1 parent e2f1e03 commit c1744d7
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 199 deletions.
125 changes: 0 additions & 125 deletions src/Events/CDA/CDAPostParseEvent.php

This file was deleted.

57 changes: 0 additions & 57 deletions src/Events/CDA/CDAPreParseEvent.php

This file was deleted.

18 changes: 1 addition & 17 deletions src/Services/Cda/CdaTemplateParse.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
namespace OpenEMR\Services\Cda;

use DOMDocument;
use OpenEMR\Events\CDA\CDAPreParseEvent;
use OpenEMR\Events\CDA\CDAPostParseEvent;
use OpenEMR\Services\CodeTypesService;

class CdaTemplateParse
Expand All @@ -24,17 +22,11 @@ class CdaTemplateParse
private $currentOid;
protected $is_qrda_import;

/**
* @var \Symfony\Contracts\EventDispatcher\EventDispatcherInterface
*/
private $ed;

public function __construct()
{
$this->templateData = [];
$this->is_qrda_import = false;
$this->codeService = new CodeTypesService();
$this->ed = $GLOBALS['kernel']->getEventDispatcher();
}

public function parseCDAEntryComponents($components): array
Expand Down Expand Up @@ -69,17 +61,12 @@ public function parseCDAEntryComponents($components): array
'2.16.840.1.113883.10.20.22.2.41' => 'dischargeSummary'
);

$preParseEvent = new CDAPreParseEvent($components);
$this->ed->dispatch($preParseEvent, CDAPreParseEvent::EVENT_HANDLE);

foreach ($preParseEvent->getComponents() as $component) {
foreach ($components as $component) {
if (!empty($component['section']['templateId']['root'])) {
if (!empty($components_oids[$component['section']['templateId']['root']])) {
$this->currentOid = $component['section']['templateId']['root'];
$func_name = $components_oids[$component['section']['templateId']['root']];
$this->$func_name($component);
$postParseEvent = new CDAPostParseEvent($func_name, $this->currentOid, $component, $this->templateData);
$this->ed->dispatch($postParseEvent, CDAPostParseEvent::EVENT_HANDLE);
}
} elseif (empty($component['section']['templateId'])) {
// uncomment for debugging information.
Expand All @@ -91,13 +78,10 @@ public function parseCDAEntryComponents($components): array
$this->currentOid = $component['section']['templateId'][$key_1]['root'];
$func_name = $components_oids[$component['section']['templateId'][$key_1]['root']];
$this->$func_name($component);
$postParseEvent = new CDAPostParseEvent($func_name, $this->currentOid, $component, $this->templateData);
$this->ed->dispatch($postParseEvent, CDAPostParseEvent::EVENT_HANDLE);
break;
}
}
}
$this->templateData = $postParseEvent->getTemplateData();
}
return $this->templateData;
}
Expand Down

0 comments on commit c1744d7

Please sign in to comment.