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

Rule apply patient export #4892

Open
wants to merge 41 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
55305ad
Force Verify tests
tadgh May 3, 2023
71edea3
fix ITs (#4809)
fil512 May 3, 2023
5855ea9
Fix migrator error on Oracle (#4814)
jamesagnew May 4, 2023
2821201
Update clinical reasoning version (#4816)
barhodes May 4, 2023
b33263d
Opening the care-gaps endpoint for GET. (#4823)
chalmarm May 5, 2023
9af24ad
added version to mdm golden resource tag (#4820)
longma1 May 5, 2023
f97da3b
Update the changelog for 4697 to be more descriptive (#4827)
JPercival May 5, 2023
609bc53
Fixes a bug with tags. (#4813)
tadgh May 5, 2023
a8e823a
fix migration issue (#4830)
fil512 May 6, 2023
5212009
Create correct version enum
tadgh May 7, 2023
ab070ef
Remove superfluous migration
tadgh May 7, 2023
5fa92dc
fixing test (#4835)
TipzCM May 8, 2023
d63dc07
email subscription, throw NullPointerException (#4790)
samguntersmilecdr May 10, 2023
37bfbf0
Add docs for CR operations (#4855)
barhodes May 11, 2023
9d9df27
Add documentation for $care-gaps operation. (#4862)
chalmarm May 11, 2023
22c9a18
4853 validation does not error when display is not the same as the di…
StevenXLi May 11, 2023
99f58f5
fixing patient everything operator (#4845)
TipzCM May 11, 2023
c3ccfb3
fix link
tadgh May 12, 2023
1891a19
Move image file
tadgh May 12, 2023
f464113
Bundle resources containing over 100 references to the same Organizat…
lukedegruchy May 12, 2023
e8cc02f
added warn message and test (#4848)
longma1 May 12, 2023
681a21c
Issue 4804 full table scan on mpi link during mdm clear (#4805)
jmarchionatto May 12, 2023
30eea1b
Fix erroneous batch 2 $export 75% complete count when the job is COMP…
lukedegruchy May 12, 2023
cf8935e
disable wars (#4877)
fil512 May 14, 2023
2973b65
4868 fix paging hapi (#4870)
TipzCM May 15, 2023
0303120
Test, fix, and changelog
michaelabuckley May 15, 2023
680dcc0
4875-binary-access-write-doest-trigger-STORAGE-BINARY-ASSIGN-BLOB-ID-…
jmarchionatto May 15, 2023
35f7b52
Better partition resolution
michaelabuckley May 15, 2023
dd56b13
Add checks based on rule applier
tadgh May 15, 2023
0a8e516
Fix ordering failure due to hash set
tadgh May 15, 2023
cf19036
Allow empty auth interceptor
tadgh May 15, 2023
75e28ba
Fix batch job (bulk export) processed record count (#4879)
michaelabuckley May 15, 2023
3c788c1
Fix up operation type on invocation
tadgh May 15, 2023
835d6d2
Throw 404 when requesting $export of non-existent Group or Patient (#…
michaelabuckley May 15, 2023
9d9dc9a
Add more tests, make hack implementation for patient instance level o…
tadgh May 15, 2023
7d0813f
Tighten test name
tadgh May 15, 2023
879e5c9
Merge branch 'rel_6_6' into rule-apply-patient-export
tadgh May 16, 2023
792e755
Changelog
tadgh May 16, 2023
f60f6aa
Default method
tadgh May 16, 2023
b989710
remove dead method
tadgh May 16, 2023
c20eab6
Remove dead autowire
tadgh May 16, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ stages:
# Put to top, but kept in order here
# - name: hapi_fhir_jpaserver_test_utilities
# module: hapi-fhir-jpaserver-test-utilities
- name: hapi_fhir_jpaserver_uhnfhirtest
module: hapi-fhir-jpaserver-uhnfhirtest
# - name: hapi_fhir_jpaserver_uhnfhirtest
# module: hapi-fhir-jpaserver-uhnfhirtest
- name: hapi_fhir_server
module: hapi-fhir-server
- name: hapi_fhir_server_mdm
Expand Down Expand Up @@ -129,8 +129,8 @@ stages:
module: hapi-tinder-plugin
- name: hapi_tinder_test
module: hapi-tinder-test
- name: tests_hapi_fhir_base_test_jaxrsserver_kotlin
module: tests/hapi-fhir-base-test-jaxrsserver-kotlin
# - name: tests_hapi_fhir_base_test_jaxrsserver_kotlin
# module: tests/hapi-fhir-base-test-jaxrsserver-kotlin
- name: tests_hapi_fhir_base_test_mindeps_client
module: tests/hapi-fhir-base-test-mindeps-client
- name: tests_hapi_fhir_base_test_mindeps_server
Expand Down
2 changes: 1 addition & 1 deletion hapi-deployable-pom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>6.5.19-SNAPSHOT</version>
<version>6.5.20-SNAPSHOT</version>

<relativePath>../pom.xml</relativePath>
</parent>
Expand Down
2 changes: 1 addition & 1 deletion hapi-fhir-android/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.5.19-SNAPSHOT</version>
<version>6.5.20-SNAPSHOT</version>

<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>
Expand Down
2 changes: 1 addition & 1 deletion hapi-fhir-base/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.5.19-SNAPSHOT</version>
<version>6.5.20-SNAPSHOT</version>

<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>
Expand Down
48 changes: 20 additions & 28 deletions hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/Tag.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@
*/
package ca.uhn.fhir.model.api;

import java.net.URI;

import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.hl7.fhir.instance.model.api.IBaseCoding;

import java.net.URI;
import java.util.Objects;

/**
* A single tag
* <p>
Expand Down Expand Up @@ -58,7 +59,7 @@ public class Tag extends BaseElement implements IElement, IBaseCoding {
private String myScheme;
private String myTerm;
private String myVersion;
private boolean myUserSelected;
private Boolean myUserSelected;

public Tag() {
}
Expand Down Expand Up @@ -114,37 +115,22 @@ public boolean equals(Object obj) {
if (getClass() != obj.getClass())
return false;
Tag other = (Tag) obj;
if (myScheme == null) {
if (other.myScheme != null)
return false;
} else if (!myScheme.equals(other.myScheme))
return false;
if (myTerm == null) {
if (other.myTerm != null)
return false;
} else if (!myTerm.equals(other.myTerm))
return false;

if (myVersion == null) {
if (other.getVersion() != null)
return false;
} else if (!myVersion.equals(other.getVersion()))
return false;

if (myUserSelected != other.getUserSelected())
return false;

return true;
return
Objects.equals(myScheme, other.myScheme) &&
Objects.equals(myTerm, other.myTerm) &&
Objects.equals(myVersion, other.myVersion) &&
Objects.equals(myUserSelected, other.myUserSelected);
}

@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((myScheme == null) ? 0 : myScheme.hashCode());
result = prime * result + ((myTerm == null) ? 0 : myTerm.hashCode());
result = prime * result + ((myVersion == null) ? 0 : myVersion.hashCode());
result = prime * result + Boolean.hashCode(myUserSelected);
result = prime * result + Objects.hashCode(myScheme);
result = prime * result + Objects.hashCode(myTerm);
result = prime * result + Objects.hashCode(myVersion);
result = prime * result + Objects.hashCode(myUserSelected);
return result;
}

Expand Down Expand Up @@ -234,12 +220,18 @@ public IBaseCoding setVersion(String theVersion) {
}

@Override
public boolean getUserSelected() { return myUserSelected; }
public boolean getUserSelected() { return myUserSelected != null && myUserSelected; }

public Boolean getUserSelectedBoolean() { return myUserSelected; }

@Override
public IBaseCoding setUserSelected(boolean theUserSelected) {
myUserSelected = theUserSelected;
return this;
}

public void setUserSelectedBoolean(Boolean theUserSelected) {
myUserSelected = theUserSelected;
}

}
123 changes: 64 additions & 59 deletions hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/JsonParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -724,78 +724,83 @@
}

if (theResource instanceof IResource) {
IResource resource = (IResource) theResource;
// Object securityLabelRawObj =

List<BaseCodingDt> securityLabels = extractMetadataListNotNull(resource, ResourceMetadataKeyEnum.SECURITY_LABELS);
List<? extends IIdType> profiles = extractMetadataListNotNull(resource, ResourceMetadataKeyEnum.PROFILES);
profiles = super.getProfileTagsForEncoding(resource, profiles);

TagList tags = getMetaTagsForEncoding(resource, theEncodeContext);
InstantDt updated = (InstantDt) resource.getResourceMetadata().get(ResourceMetadataKeyEnum.UPDATED);
IdDt resourceId = resource.getId();
String versionIdPart = resourceId.getVersionIdPart();
if (isBlank(versionIdPart)) {
versionIdPart = ResourceMetadataKeyEnum.VERSION.get(resource);
}
List<Map.Entry<ResourceMetadataKeyEnum<?>, Object>> extensionMetadataKeys = getExtensionMetadataKeys(resource);
parseMetaForDSTU2(theResDef, theResource, theEventWriter, theContainedResource, theEncodeContext, resDef);
}

if (super.shouldEncodeResourceMeta(resource) && (ElementUtil.isEmpty(versionIdPart, updated, securityLabels, tags, profiles) == false) || !extensionMetadataKeys.isEmpty()) {
beginObject(theEventWriter, "meta");
encodeCompositeElementToStreamWriter(theResDef, theResource, theResource, theEventWriter, theContainedResource, new CompositeChildElement(resDef, theEncodeContext), theEncodeContext);

if (shouldEncodePath(resource, "meta.versionId")) {
writeOptionalTagWithTextNode(theEventWriter, "versionId", versionIdPart);
}
if (shouldEncodePath(resource, "meta.lastUpdated")) {
writeOptionalTagWithTextNode(theEventWriter, "lastUpdated", updated);
}
theEventWriter.endObject();
}

if (profiles != null && profiles.isEmpty() == false) {
beginArray(theEventWriter, "profile");
for (IIdType profile : profiles) {
if (profile != null && isNotBlank(profile.getValue())) {
theEventWriter.write(profile.getValue());
}
private void parseMetaForDSTU2(RuntimeResourceDefinition theResDef, IBaseResource theResource, BaseJsonLikeWriter theEventWriter, boolean theContainedResource, EncodeContext theEncodeContext, RuntimeResourceDefinition resDef) throws IOException {

Check warning on line 735 in hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/JsonParser.java

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/JsonParser.java#L735

The method 'parseMetaForDSTU2(RuntimeResourceDefinition, IBaseResource, BaseJsonLikeWriter, boolean, EncodeContext, RuntimeResourceDefinition)' has an NPath complexity of 726, current threshold is 200
IResource resource = (IResource) theResource;
// Object securityLabelRawObj =

List<BaseCodingDt> securityLabels = extractMetadataListNotNull(resource, ResourceMetadataKeyEnum.SECURITY_LABELS);
List<? extends IIdType> profiles = extractMetadataListNotNull(resource, ResourceMetadataKeyEnum.PROFILES);
profiles = super.getProfileTagsForEncoding(resource, profiles);

TagList tags = getMetaTagsForEncoding(resource, theEncodeContext);
InstantDt updated = (InstantDt) resource.getResourceMetadata().get(ResourceMetadataKeyEnum.UPDATED);
IdDt resourceId = resource.getId();
String versionIdPart = resourceId.getVersionIdPart();
if (isBlank(versionIdPart)) {
versionIdPart = ResourceMetadataKeyEnum.VERSION.get(resource);
}
List<Map.Entry<ResourceMetadataKeyEnum<?>, Object>> extensionMetadataKeys = getExtensionMetadataKeys(resource);

if (super.shouldEncodeResourceMeta(resource) && (ElementUtil.isEmpty(versionIdPart, updated, securityLabels, tags, profiles) == false) || !extensionMetadataKeys.isEmpty()) {
beginObject(theEventWriter, "meta");

if (shouldEncodePath(resource, "meta.versionId")) {
writeOptionalTagWithTextNode(theEventWriter, "versionId", versionIdPart);
}
if (shouldEncodePath(resource, "meta.lastUpdated")) {
writeOptionalTagWithTextNode(theEventWriter, "lastUpdated", updated);
}

if (profiles != null && profiles.isEmpty() == false) {
beginArray(theEventWriter, "profile");
for (IIdType profile : profiles) {
if (profile != null && isNotBlank(profile.getValue())) {
theEventWriter.write(profile.getValue());
}
theEventWriter.endArray();
}
theEventWriter.endArray();
}

if (securityLabels.isEmpty() == false) {
beginArray(theEventWriter, "security");
for (BaseCodingDt securityLabel : securityLabels) {
theEventWriter.beginObject();
theEncodeContext.pushPath("security", false);
encodeCompositeElementChildrenToStreamWriter(resDef, resource, securityLabel, theEventWriter, theContainedResource, null, theEncodeContext);
theEncodeContext.popPath();
theEventWriter.endObject();
}
theEventWriter.endArray();
if (securityLabels.isEmpty() == false) {
beginArray(theEventWriter, "security");
for (BaseCodingDt securityLabel : securityLabels) {
theEventWriter.beginObject();
theEncodeContext.pushPath("security", false);
encodeCompositeElementChildrenToStreamWriter(resDef, resource, securityLabel, theEventWriter, theContainedResource, null, theEncodeContext);
theEncodeContext.popPath();
theEventWriter.endObject();
}
theEventWriter.endArray();
}

if (tags != null && tags.isEmpty() == false) {
beginArray(theEventWriter, "tag");
for (Tag tag : tags) {
if (tag.isEmpty()) {
continue;
}
theEventWriter.beginObject();
writeOptionalTagWithTextNode(theEventWriter, "system", tag.getScheme());
writeOptionalTagWithTextNode(theEventWriter, "code", tag.getTerm());
writeOptionalTagWithTextNode(theEventWriter, "display", tag.getLabel());
theEventWriter.endObject();
if (tags != null && tags.isEmpty() == false) {
beginArray(theEventWriter, "tag");
for (Tag tag : tags) {
if (tag.isEmpty()) {
continue;
}
theEventWriter.endArray();
theEventWriter.beginObject();
writeOptionalTagWithTextNode(theEventWriter, "system", tag.getScheme());
writeOptionalTagWithTextNode(theEventWriter, "code", tag.getTerm());
writeOptionalTagWithTextNode(theEventWriter, "display", tag.getLabel());
// wipmb should we be writing the new properties here? There must be another path.
theEventWriter.endObject();
}

addExtensionMetadata(theResDef, theResource, theContainedResource, extensionMetadataKeys, resDef, theEventWriter, theEncodeContext);

theEventWriter.endObject(); // end meta
theEventWriter.endArray();
}
}

encodeCompositeElementToStreamWriter(theResDef, theResource, theResource, theEventWriter, theContainedResource, new CompositeChildElement(resDef, theEncodeContext), theEncodeContext);
addExtensionMetadata(theResDef, theResource, theContainedResource, extensionMetadataKeys, resDef, theEventWriter, theEncodeContext);

theEventWriter.endObject();
theEventWriter.endObject(); // end meta
}
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,9 @@ public enum VersionEnum {
V6_4_1,
V6_4_2,
V6_5_0,
V6_6_0
V6_6_0,
V6_7_0,
V6_8_0,
;

public static VersionEnum latestVersion() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public void testEquals() {
@Test
public void testHashCode() {
Tag tag1 = new Tag().setScheme("scheme").setTerm("term").setLabel("label");
assertEquals(-1029266947, tag1.hashCode());
assertEquals(-1029268184, tag1.hashCode());
}

@Test
Expand Down
4 changes: 2 additions & 2 deletions hapi-fhir-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
<modelVersion>4.0.0</modelVersion>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-bom</artifactId>
<version>6.5.19-SNAPSHOT</version>
<version>6.5.20-SNAPSHOT</version>

<packaging>pom</packaging>
<name>HAPI FHIR BOM</name>

<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.5.19-SNAPSHOT</version>
<version>6.5.20-SNAPSHOT</version>

<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>
Expand Down
2 changes: 1 addition & 1 deletion hapi-fhir-checkstyle/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>6.5.19-SNAPSHOT</version>
<version>6.5.20-SNAPSHOT</version>

<relativePath>../pom.xml</relativePath>
</parent>
Expand Down
2 changes: 1 addition & 1 deletion hapi-fhir-cli/hapi-fhir-cli-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.5.19-SNAPSHOT</version>
<version>6.5.20-SNAPSHOT</version>

<relativePath>../../hapi-deployable-pom/pom.xml</relativePath>
</parent>
Expand Down
2 changes: 1 addition & 1 deletion hapi-fhir-cli/hapi-fhir-cli-app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-cli</artifactId>
<version>6.5.19-SNAPSHOT</version>
<version>6.5.20-SNAPSHOT</version>

<relativePath>../pom.xml</relativePath>
</parent>
Expand Down
2 changes: 1 addition & 1 deletion hapi-fhir-cli/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>6.5.19-SNAPSHOT</version>
<version>6.5.20-SNAPSHOT</version>

<relativePath>../pom.xml</relativePath>
</parent>
Expand Down
2 changes: 1 addition & 1 deletion hapi-fhir-client-okhttp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.5.19-SNAPSHOT</version>
<version>6.5.20-SNAPSHOT</version>

<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>
Expand Down
2 changes: 1 addition & 1 deletion hapi-fhir-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.5.19-SNAPSHOT</version>
<version>6.5.20-SNAPSHOT</version>

<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>
Expand Down
2 changes: 1 addition & 1 deletion hapi-fhir-converter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.5.19-SNAPSHOT</version>
<version>6.5.20-SNAPSHOT</version>

<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,9 @@ public Coding codingToCanonical(IBaseCoding theCoding) {
retVal.setSystem(coding.getSystem());
retVal.setDisplay(coding.getDisplay());
retVal.setVersion(coding.getVersion());
retVal.setUserSelected(!coding.getUserSelectedElement().isEmpty() && coding.getUserSelected());
if (!coding.getUserSelectedElement().isEmpty()) {
retVal.setUserSelected( coding.getUserSelected() );
}

return retVal;
}
Expand Down
Loading