Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Openemr fix 4959 amc pi hie 1 #5065

Merged

Conversation

adunsulag
Copy link
Sponsor Member

Implement the Send Referral loops code. Starting this off as a draft so people can see what I'm doing.

Created and implemented the AMC 315g Required Rule 7 which is the Support Electronic Referral Loops by Sending Health Information rule for MIPS.

Updated the transactions help to discuss MIPS reporting pieces. Implemented a help file for the AMC report that also explains how to run the report and specific information for MIPS calculations.

Added a new checkbox flag on the transactions for providers to confirm
that the recipient they sent a summary of care document to actually
received the document.

Made it so the confirmation receipt is set to true when EMRDirect is sent since EMRDirect automatically confirms that the recipient received the message.

Added facility selector to referral form. Changed up the AMC report to use the billing_facility_id.

Still need to update the ccda amc_sum change to make sure that is working but I can at least now generate the baseline report. Will do more tests on ONC and make sure that is all working properly.

INSERT INTO `layout_options` (`form_id`,`field_id`,`group_id`,`title`,`seq`,`data_type`,`uor`,`fld_length`,`max_length`
,`list_id`,`titlecols`,`datacols`,`default_value`,`edit_options`,`description`,`fld_rows`)
VALUES ('LBTref', 'encounter_id', '1', 'Patient Referral Encounter', 10, 53, 1, 0, 0, '', 1, 1, '', ''
,'Encounter that the referral/transfer of care is based on', 0);
Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fare thee well poor encounter_id 😿

Added initial comments explaining the algorithms to the 304i classes for
the 2015 requirements.
Created and implemented the AMC 315g Required Rule 7 which is the Support
Electronic Referral Loops by Sending Health Information rule for MIPS.

Updated the transactions help file to include the encounter id
information and MIPS reporting pieces.  Implemented a help file for the
AMC report that also explains how to run the report and specific
information for MIPS calculations.

Added a new checkbox flag on the transactions for providers to confirm
that the recipient they sent a summary of care document to actually
received the document.

Made it so the confirmation receipt is set to true when EMRDirect is
sent since EMRDirect automatically confirms that the recipient received
the message.

Added the new rule definitions to the database.
Made the referral form use billing facility instead of last encounter.

Added facility selector to referral form.  Changed up the AMC report
to use the billing_facility_id.

Still need to update the ccda amc_sum change to make sure that is
working but I can at least now generate the baseline report.
Will do more tests on ONC and make sure that is all working properly.

Added an AMC help file with documentation to help people use the AMC
calculator.
For ONC reporting we have to display the specific patients and their
actions that support a measure's pass/fail process all in one report.  I
built a report to do that instead of aggregating 240 different pdfs into
a single report (that would have rough continuity problems).  I built
out an infrastructure for the itemized report pieces that makes it
possible to record specific sub-pass fail criterias ie actions for each
measure's pass / fail.

I added two new columns to report_itemized to track the rule_id and the
item_details pieces.

Added the confirmation tracking amc for the AMC rule 7.

Still need to go and update the CCDA pieces to use the sub-actions.
Right now they can just be set directly from the referral form.
@adunsulag adunsulag force-pushed the openemr-fix-4959-amc-pi-hie-1 branch from a852efd to 2e93d23 Compare April 1, 2022 00:24
Changed the AMC reporting for sending the referral loop with care
coordination.  Reworked the tracking of problems, medications, and
allergies to be an AND clause instead of an OR condition for reporting.
Made it so the ccda is directly connected via the database to a
transaction referral.  Changed the 315(g)(2) Test 7 implementation to
use the amc's ccda valid flag.

This fully implements openemr#4959 referral loops for the test.
@adunsulag adunsulag marked this pull request as ready for review April 2, 2022 01:11
When we added the inclusion of referrals into the buildPatientData array
it makes the 2c tests fail since patients were included that had a
referral to a provider (needed for AMC test 7) but had no encounter.
Since the denominator rule is that the patient has to have been seen in
an encounter check that in the denominator.

Currently we don't specify explicit action labels for the denominator
but I built some initial support if ONC ends up mandating we have to
have that.
@bradymiller
Copy link
Sponsor Member

@adunsulag , code looks great! just need to add the transaction_id column to database.sql and then ready for codebase

Fixes openemr#4958, openemr#4959 which is the AMC Rule 2c and Rule 7.  I reworked the
patient details report so it places denominator and numerator
horizontally side by side which matches the reports from ONC that they
will compare against.  I also had to go this route in order to
de-duplicate the patient data and display multiple referral records
alongside a single patient record.  The prior method was too confusing
when there was multiple records.

I added action tracking to denominators.  Right now the two rules each
have just a single denominator check, but if there are multiple
denominator criteria the code now facilitates that.
@adunsulag
Copy link
Sponsor Member Author

@bradymiller Hey Brady, I thought I was done here, but had to make a number of changes in 11 files. If you can do another pass through this when you get a chance I'll get them resolved. Course my fingers are crossed it all looks good and can just be merged :)

@bradymiller
Copy link
Sponsor Member

@adunsulag , looks great!

2DV-2

The printing on individual reports was overlaying table headers since we
had a table nested inside a table and the browser printer was getting
confused.

I rewrote the report to drop the outer table and make it so we had a
single tabulated table that made the print work out properly.
Removed a lot of the old unused amc options but made it so old reports
still display properly.  Migrated the entire cqm.php file over to php
and added twig extensions for display help icons and the oemrUI below
container extension.  Also added extensions for dealing with the wierd
date settings that are used in some of the twig functions.
So we don't blow up the mysql server we batch the queries in sets of 100
items at a time.  The reports will still run a long time if there is a
lot of patients but it won't kill the MySQL server.
@adunsulag
Copy link
Sponsor Member Author

@bradymiller Thought I was done this morning, but this is the last bit haha! I went ahead and cleaned up the cqm report to remove unused fields for the current AMC rule set. I also decided we just don't to execute the old AMC rulesets as there's no point for MIPs reporting. I made it so all of the old reports still load but that for new reports you get the limited subset of AMC selections.

The standard alert report selections were cleaned up to remove AMC features.

I revamped the patient details report as the printing was going completely haywire. It can still be a bit finicky due to the table columns but I think I got things resolved.

I also added in batching so that the MySQL server doesn't die.

At this point all AMC scenarios pass and when this PR is brought in AMC will be code complete.

({{ 'Non-electronic'|xlt }})
</td>
<td>
<input {{ dis_text|text }} type="text" id="labs_manual_entry" name="labs_manual_entry" class='form-control' value="{{ labs_manual|attr }}">
Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will escaping dis_text break this? (looks like it has quotes in it that are likely needed for html and is not escaped above)

Copy link
Sponsor Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I can tell escaping it didn't break it.

@bradymiller
Copy link
Sponsor Member

looks good to go! amc is done!
2DV-2

@adunsulag adunsulag merged commit 198cbb3 into openemr:master Apr 5, 2022
@adunsulag adunsulag deleted the openemr-fix-4959-amc-pi-hie-1 branch April 5, 2024 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants