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

fix: check for empty postParseEvent ccda import #7348

Merged
merged 3 commits into from Apr 22, 2024

Conversation

stephenwaite
Copy link
Sponsor Member

Fixes #7347

Short description of what this resolves:

Changes proposed in this pull request:

@stephenwaite stephenwaite changed the title fix: check for empty postParseEvent fix: check for empty postParseEvent ccda import Apr 13, 2024
@@ -97,7 +97,9 @@ public function parseCDAEntryComponents($components): array
}
}
}
$this->templateData = $postParseEvent->getTemplateData();
if (!empty($postParseEvent)) {
Copy link
Sponsor Member

Choose a reason for hiding this comment

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

Does empty() function work on objects?

Copy link
Sponsor Member

Choose a reason for hiding this comment

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

It'd be safer to check the instance type. Empty will work, but if someone returns a string or something other than an object having a getTemplateData() method this will blow up

if ($postParseEvent instanceof CDAPostParseEvent)

@stephenwaite
Copy link
Sponsor Member Author

remaining errors from native ccda export to ccda import:

Schema Definition Errors - (3)
Error 1871: Element '{urn:hl7-org:v3}tbody': Missing child element(s). Expected is ( {urn:hl7-org:v3}tr ). on line 1
Error 1839: Element '{urn:hl7-org:v3}time', attribute 'value': [facet 'pattern'] The value 'Invalid date' is not accepted by the pattern '[0-9]{1,8}|([0-9]{9,14}|[0-9]{14,14}.[0-9]+)([+-][0-9]{1,4})?'. on line 1
Error 1871: Element '{urn:hl7-org:v3}component': Missing child element(s). Expected is one of ( {urn:hl7-org:v3}realmCode, {urn:hl7-org:v3}typeId, {urn:hl7-org:v3}templateId, {urn:hl7-org:v3}section ). on line 1

Schematron Errors - (8)
Error: This patientRole SHALL contain at least one [1..] telecom (CONF:1198-5280).
Error Context: cda:ClinicalDocument[cda:templateId[@root='2.16.840.1.113883.10.20.22.1.1' and @extension='2015-08-01']]
Where: /ClinicalDocument[1]
Line# 1
Error: This assignedAuthor SHALL contain at least one [1..
] telecom (CONF:1198-5428).
Error Context: cda:ClinicalDocument[cda:templateId[@root='2.16.840.1.113883.10.20.22.1.1' and @extension='2015-08-01']]
Where: /ClinicalDocument[1]
Line# 1
Error: This effectiveTime SHALL contain exactly one [1..1] low (CONF:1198-14838).
Error Context: cda:ClinicalDocument[cda:templateId[@root='2.16.840.1.113883.10.20.22.1.1' and @extension='2015-08-01']]
Where: /ClinicalDocument[1]
Line# 1
Error: This effectiveTime SHALL contain exactly one [1..1] low (CONF:1198-8454).
Error Context: cda:ClinicalDocument[cda:templateId[@root='2.16.840.1.113883.10.20.22.1.2' and @extension='2015-08-01']]
Where: /ClinicalDocument[1]
Line# 1
Error: This effectiveTime SHALL contain exactly one [1..1] high (CONF:1198-8455).
Error Context: cda:ClinicalDocument[cda:templateId[@root='2.16.840.1.113883.10.20.22.1.2' and @extension='2015-08-01']]
Where: /ClinicalDocument[1]
Line# 1
Error: This patientRole SHALL contain at least one [1..] telecom (CONF:1198-5280).
Error Context: cda:ClinicalDocument[cda:templateId[@root='2.16.840.1.113883.10.20.22.1.2' and @extension='2015-08-01']]
Where: /ClinicalDocument[1]
Line# 1
Error: This assignedAuthor SHALL contain at least one [1..
] telecom (CONF:1198-5428).
Error Context: cda:ClinicalDocument[cda:templateId[@root='2.16.840.1.113883.10.20.22.1.2' and @extension='2015-08-01']]
Where: /ClinicalDocument[1]
Line# 1
Error: This effectiveTime SHALL contain exactly one [1..1] low (CONF:1198-14838).
Error Context: cda:ClinicalDocument[cda:templateId[@root='2.16.840.1.113883.10.20.22.1.2' and @extension='2015-08-01']]
Where: /ClinicalDocument[1]
Line# 1

@adunsulag
Copy link
Sponsor Member

@stephenwaite Are you wanting your PR to address those remaining errors or is it ok to bring this in? I can bump this to the next patch if you are still working on it, otherwise this looks fine to me to bring this in.

@stephenwaite stephenwaite merged commit f633bd3 into openemr:master Apr 22, 2024
25 checks passed
sjpadgett pushed a commit to sjpadgett/openemr that referenced this pull request Apr 22, 2024
* fix: check for empty postParseEvent

* check instance type too

* fix php warns and deprecates

(cherry picked from commit f633bd3)
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.

bug: ccda import fails on empty postParseEvent
3 participants