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

Issue 3486 #3487

Merged
merged 8 commits into from
Mar 30, 2022
Merged

Issue 3486 #3487

merged 8 commits into from
Mar 30, 2022

Conversation

markiantorno
Copy link
Collaborator

Addresses issue #3486

@codecov
Copy link

codecov bot commented Mar 24, 2022

Codecov Report

Merging #3487 (1d955a4) into master (77b4c2a) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##             master    #3487   +/-   ##
=========================================
  Coverage     83.00%   83.00%           
- Complexity    21004    21007    +3     
=========================================
  Files          1406     1406           
  Lines         75568    75575    +7     
  Branches      11262    11266    +4     
=========================================
+ Hits          62723    62730    +7     
+ Misses         8524     8521    -3     
- Partials       4321     4324    +3     
Impacted Files Coverage Δ
...uhn/fhir/jpa/packages/PackageInstallerSvcImpl.java 83.64% <100.00%> (+0.55%) ⬆️
...r/UserRequestRetryVersionConflictsInterceptor.java 83.33% <0.00%> (-4.17%) ⬇️
...ca/uhn/fhir/jpa/dao/tx/HapiTransactionService.java 71.69% <0.00%> (-1.89%) ⬇️
...hn/fhir/rest/client/impl/RestfulClientFactory.java 91.36% <0.00%> (-0.72%) ⬇️
...or/TransactionConcurrencySemaphoreInterceptor.java 83.82% <0.00%> (+4.41%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 476e754...1d955a4. Read the comment docs.

// Resource does not have a status field
if (statusTypes.size() == 0) return true;
// Resource has an empty or null status field
if (statusTypes.isEmpty() || statusTypes.get(0).getValue() == null) return false;
Copy link
Collaborator

Choose a reason for hiding this comment

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

what is the difference between statusTypes.isEmpty() and statusTypes.size() == 0?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No diff, was a duplicated case. Fixed.

if (statusTypes.isEmpty() || statusTypes.get(0).getValue() == null) return false;
// Resource has a status, and we need to check based on type
return switch (theResource.fhirType()) {
case "Subscription" -> (statusTypes.get(0).getValueAsString().equals("requested"));
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You shouldn't be able to add a Subscription with an active status. The server sets to active after loaded the subscription and checking that it can be run.

// Resource has a status, and we need to check based on type
return switch (theResource.fhirType()) {
case "Subscription" -> (statusTypes.get(0).getValueAsString().equals("requested"));
case "DocumentReference", "Communication" -> (!statusTypes.get(0).getValueAsString().equals("?"));
Copy link
Contributor

Choose a reason for hiding this comment

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

DocumentReference.status seems to use superseded and entered-in-error for inactive. https://www.hl7.org/fhir/valueset-document-reference-status.html

And Communication has a bunch. Maybe I don't understand what this is.
Maybe some docs, and links to the spec?
https://www.hl7.org/fhir/valueset-event-status.html

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, so when I talked with the support team on this, they stated that the code in the past only allowed for resources that had a value of status as empty or for this, but this was restrictive, as DocumentReferences could exist with statuses such as entered in error, or others, and still need to be loaded from the package. The same goes for Communication types. I will expand the javadoc for the method further.

@markiantorno markiantorno merged commit 179c970 into master Mar 30, 2022
@markiantorno markiantorno deleted the issue_3486 branch March 30, 2022 12:52
jkiddo pushed a commit to trifork/hapi-fhir that referenced this pull request Apr 19, 2022
* added failing tests

* tests pass

* Added changelog and javadocs

* fixed package tests for resources with no active field

* adding jira ticket number

* feedback from code review'

* switching to old style switch statement'
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.

None yet

3 participants