Skip to content

Commit

Permalink
Qdm 2022 qrda export (openemr#5046)
Browse files Browse the repository at this point in the history
* Added 5.6 QDM models, and a readme how to generate new models

* merge date helper

* Intermediate

* intermediate

* ported a bunch of Ruby code to support Cat III to PHP

* intermediate

* finished porting coding only, haven't run/tested

* Hook up basic rendering of Cat3 XML

* intermediate, walking through template population

* intermediate

* intermedite: added in result calculator

* fix input to export service, now just requires array of measure strings

* added patient addresses and telcoms for qrda cat 1 export

* Updated mustache templates to 3.1.8 qrda-reports

Found we were using a newer version of the mustache templates then what
we will test against for ONC.  I've gone ahead and changed those to the
old version for the Cat 3 reports.  Also found that the templates using
the ruby-ism of ? to denote a boolean question can't be processed in PHP.
So I've switched the templates that use the functionName? to drop the
question mark which allows those functions to actually execute
correctly.

* Updated to latest oe-cqm-module version.

* resolve patient extension

* fix date format for JSON cqm calculation, add result to procedure QDM

* fix typos in query

* fix styling

* trying to fix styles again

* try fixing style again

Co-authored-by: Stephen Nielson <snielson@discoverandchange.com>
  • Loading branch information
kchapple and adunsulag authored Mar 29, 2022
1 parent c45b386 commit 5ff37bc
Showing 222 changed files with 8,350 additions and 1,564 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -69,7 +69,8 @@
"vlucas/phpdotenv": "5.4.1",
"waryway/php-traits-library": "1.0.4",
"yubico/u2flib-server": "1.0.2",
"openemr/mustache": "2.15.2"
"openemr/mustache": "2.15.2",
"openemr/oe-module-cqm": "dev-main"
},
"config": {
"platform": {
135 changes: 132 additions & 3 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 16 additions & 11 deletions src/Cqm/Generator.php
Original file line number Diff line number Diff line change
@@ -49,9 +49,8 @@ public function execute()
$datatypes = [];
$extends = [];
$hqmfOid_to_datatype_map = [];
$root = $GLOBALS['fileroot'];
$oids_file = __DIR__ . '/oids_qdm_5.5.json';
$modelinfo_file = __DIR__ . '/qdm-modelinfo-5.5.xml';
$oids_file = __DIR__ . '/oids_qdm_5.6.json';
$modelinfo_file = __DIR__ . '/qdm-modelinfo-5.6.xml';
$modelinfo = simplexml_load_string(file_get_contents($modelinfo_file));
$oids = json_decode(file_get_contents($oids_file), true);

@@ -106,7 +105,7 @@ public function execute()
// If there's no label, check if there is a "positive" profile
$positive_profile_element = $modelinfo->xpath("/ns4:modelInfo/ns4:typeInfo[@xsi:type='ns4:ProfileInfo'][@identifier='Positive$datatype_name']")[0];
if ($positive_profile_element !== null) {
$positive_profile = (string)$positive_profile_element->attributes();
$positive_profile = $positive_profile_element->attributes();
if (!empty((string)$positive_profile->label)) {
$qdm_title = (string)$positive_profile->label;
}
@@ -133,7 +132,10 @@ public function execute()
}

// Add the extra info that is manually maintained in the "oids" file
$extra_info = $oids[$this->underscore($datatype_name)];
$extra_info = null;
if (isset($oids[$this->underscore($datatype_name)])) {
$extra_info = $oids[$this->underscore($datatype_name)];
}
if ($extra_info !== null) {
if (isset($extra_info['hqmf_oid'])) {
$attributes[] = [
@@ -247,14 +249,17 @@ public function execute()
'classes' => [$class]
]);
$code = $file->generate();
$dir = __DIR__;
// $dir = '/Users/kchapple/Dev/openemr/openemr/src/Cqm';
mkdir($dir . '/Qdm');
$filename = $dir . '/Qdm/' . $datatype . '.php';
file_put_contents($filename, $code);
$qdm_dir = __DIR__ . DIRECTORY_SEPARATOR . 'Qdm';
if (!file_exists($qdm_dir)) {
mkdir($qdm_dir);
}
$filename = $qdm_dir . DIRECTORY_SEPARATOR . $datatype . '.php';
if (false === file_put_contents($filename, $code)) {
error_log("Error writing to QDM Model file: `$filename`");
}
}

file_put_contents($dir . '/hqmfOid_to_datatype_map.json', json_encode($hqmfOid_to_datatype_map));
file_put_contents(__DIR__ . '/hqmfOid_to_datatype_map.json', json_encode($hqmfOid_to_datatype_map));
}

public function underscore($input)
11 changes: 9 additions & 2 deletions src/Cqm/Qdm/AdverseEvent.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
<?php
/**
* @package OpenEMR
* @link http://www.open-emr.org
* @author Ken Chapple <ken@mi-squared.com>
* @copyright Copyright (c) 2021 Ken Chapple <ken@mi-squared.com>
* @license https://github.com/openemr/openemr/blob/master/LICENSE GNU GeneralPublic License 3
*/

namespace OpenEMR\Cqm\Qdm;

@@ -7,14 +14,13 @@
*
* This is a class generated with Laminas\Code\Generator.
*
* @QDM Version 5.5
* @QDM Version 5.6
* @author Ken Chapple <ken@mi-squared.com>
* @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General
* Public License 3
*/
class AdverseEvent extends QDMBaseType
{

/**
* @property BaseTypes\DateTime $authorDatetime
*/
@@ -72,3 +78,4 @@ class AdverseEvent extends QDMBaseType

public $_type = 'QDM::AdverseEvent';
}

11 changes: 9 additions & 2 deletions src/Cqm/Qdm/AllergyIntolerance.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
<?php
/**
* @package OpenEMR
* @link http://www.open-emr.org
* @author Ken Chapple <ken@mi-squared.com>
* @copyright Copyright (c) 2021 Ken Chapple <ken@mi-squared.com>
* @license https://github.com/openemr/openemr/blob/master/LICENSE GNU GeneralPublic License 3
*/

namespace OpenEMR\Cqm\Qdm;

@@ -7,14 +14,13 @@
*
* This is a class generated with Laminas\Code\Generator.
*
* @QDM Version 5.5
* @QDM Version 5.6
* @author Ken Chapple <ken@mi-squared.com>
* @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General
* Public License 3
*/
class AllergyIntolerance extends QDMBaseType
{

/**
* @property BaseTypes\DateTime $authorDatetime
*/
@@ -67,3 +73,4 @@ class AllergyIntolerance extends QDMBaseType

public $_type = 'QDM::AllergyIntolerance';
}

16 changes: 14 additions & 2 deletions src/Cqm/Qdm/AssessmentOrder.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
<?php
/**
* @package OpenEMR
* @link http://www.open-emr.org
* @author Ken Chapple <ken@mi-squared.com>
* @copyright Copyright (c) 2021 Ken Chapple <ken@mi-squared.com>
* @license https://github.com/openemr/openemr/blob/master/LICENSE GNU GeneralPublic License 3
*/

namespace OpenEMR\Cqm\Qdm;

@@ -7,14 +14,13 @@
*
* This is a class generated with Laminas\Code\Generator.
*
* @QDM Version 5.5
* @QDM Version 5.6
* @author Ken Chapple <ken@mi-squared.com>
* @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General
* Public License 3
*/
class AssessmentOrder extends QDMBaseType
{

/**
* @property BaseTypes\DateTime $authorDatetime
*/
@@ -35,6 +41,11 @@ class AssessmentOrder extends QDMBaseType
*/
public $requester = null;

/**
* @property string $qdmTitle
*/
public $qdmTitle = 'Assessment, Order';

/**
* @property string $hqmfOid
*/
@@ -57,3 +68,4 @@ class AssessmentOrder extends QDMBaseType

public $_type = 'QDM::AssessmentOrder';
}

Loading
Oops, something went wrong.

0 comments on commit 5ff37bc

Please sign in to comment.