Skip to content

Commit

Permalink
Add ResearchSubject
Browse files Browse the repository at this point in the history
  • Loading branch information
bitPogo committed Aug 25, 2021
1 parent 15b04fc commit ea7f3f7
Show file tree
Hide file tree
Showing 7 changed files with 336 additions and 11 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ toc::[]

=== Added

* Consent (R4 & STU3).
* Consent and ResearchSubject (R4 & STU3).

=== Changed

Expand Down
19 changes: 10 additions & 9 deletions fastlane/actions/fhir_java_r4.rb
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,16 @@ def self.integrate_fhir_models
"ValueSet",
"Procedure",
"Encounter",
"Contributor",
"DataRequirement",
"Expression",
"ParameterDefinition",
"RelatedArtifact",
"TriggerDefinition",
"Location",
"ServiceRequest",
"Consent"
"Contributor",
"DataRequirement",
"Expression",
"ParameterDefinition",
"RelatedArtifact",
"TriggerDefinition",
"Location",
"ServiceRequest",
"Consent",
"ResearchSubject"
]

# FIXME
Expand Down
3 changes: 2 additions & 1 deletion fastlane/actions/fhir_java_stu3.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ def self.integrate_fhir_models
"ReferralRequest",
"ValueSet",
"Procedure",
"Consent"
"Consent",
"ResearchSubject"
]

# FIXME
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
/*
* Copyright (c) 2020 D4L data4life gGmbH / All rights reserved.
*
* D4L owns all legal rights, title and interest in and to the Software Development Kit ("SDK"),
* including any intellectual property rights that subsist in the SDK.
*
* The SDK and its documentation may be accessed and used for viewing/review purposes only.
* Any usage of the SDK for other purposes, including usage for the development of
* applications/third-party applications shall require the conclusion of a license agreement
* between you and D4L.
*
* If you are interested in licensing the SDK for your own applications/third-party
* applications and/or if you’d like to contribute to the development of the SDK, please
* contact D4L by email to [email protected].
*/

package care.data4life.fhir.r4.model;

import com.squareup.moshi.Json;

import java.util.List;

import javax.annotation.Nullable;

/**
* ResearchSubject.java
* <p>
* A physical entity which is the primary unit of operational and/or administrative interest in a
* study.
*
* @see <a href="http://hl7.org/fhir/StructureDefinition/ResearchSubject">ResearchSubject</a>
* <p>
* Generated from FHIR 4.0.1-9346c8cc45 (http://hl7.org/fhir/StructureDefinition/ResearchSubject)
*/
public class ResearchSubject extends DomainResource {

public static final String resourceType = "ResearchSubject";

// Business Identifier for research subject in a study.
@Json(name = "identifier")
@Nullable
public List<Identifier> identifier;

// The current state of the subject.
@Json(name = "status")
public CodeSystemResearchSubjectStatus status;

// Start and end of participation.
@Json(name = "period")
@Nullable
public Period period;

// Study subject is part of.
@Json(name = "study")
public Reference study;

// Who is part of study.
@Json(name = "individual")
public Reference individual;

// What path should be followed.
@Json(name = "assignedArm")
@Nullable
public String assignedArm;

// What path was followed.
@Json(name = "actualArm")
@Nullable
public String actualArm;

// Agreement to participate in study.
@Json(name = "consent")
@Nullable
public Reference consent;


/**
* Constructor for all required properties.
*
* @param status CodeSystemResearchSubjectStatus
* @param study Reference
* @param individual Reference
*/
public ResearchSubject(CodeSystemResearchSubjectStatus status, Reference study, Reference individual) {
this.status = status;
this.study = study;
this.individual = individual;
}

@Override
public String getResourceType() {
return ResearchSubject.resourceType;
}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
/*
* Copyright (c) 2020 D4L data4life gGmbH / All rights reserved.
*
* D4L owns all legal rights, title and interest in and to the Software Development Kit ("SDK"),
* including any intellectual property rights that subsist in the SDK.
*
* The SDK and its documentation may be accessed and used for viewing/review purposes only.
* Any usage of the SDK for other purposes, including usage for the development of
* applications/third-party applications shall require the conclusion of a license agreement
* between you and D4L.
*
* If you are interested in licensing the SDK for your own applications/third-party
* applications and/or if you’d like to contribute to the development of the SDK, please
* contact D4L by email to [email protected].
*/

package care.data4life.fhir.stu3.model;

import com.squareup.moshi.Json;

import javax.annotation.Nullable;

/**
* ResearchSubject.java
* <p>
* A process where a researcher or organization plans and then executes a series of steps intended
* to increase the field of healthcare-related knowledge. This includes studies of safety,
* efficacy, comparative effectiveness and other information about medications, devices, therapies
* and other interventional and investigative techniques. A ResearchStudy involves the gathering of
* information about human or animal subjects.
*
* @see <a href="http://hl7.org/fhir/StructureDefinition/ResearchSubject">ResearchSubject</a>
* <p>
* Generated from FHIR 3.0.1.11917 (http://hl7.org/fhir/StructureDefinition/ResearchSubject)
*/
public class ResearchSubject extends DomainResource {

public static final String resourceType = "ResearchSubject";

// Business Identifier for research subject.
@Json(name = "identifier")
@Nullable
public Identifier identifier;

// The current state of the subject.
@Json(name = "status")
public CodeSystemResearchSubjectStatus status;

// Start and end of participation.
@Json(name = "period")
@Nullable
public Period period;

// Study subject is part of.
@Json(name = "study")
public Reference study;

// Who is part of study.
@Json(name = "individual")
public Reference individual;

// What path should be followed.
@Json(name = "assignedArm")
@Nullable
public String assignedArm;

// What path was followed.
@Json(name = "actualArm")
@Nullable
public String actualArm;

// Agreement to participate in study.
@Json(name = "consent")
@Nullable
public Reference consent;


/**
* Constructor for all required properties.
*
* @param status CodeSystemResearchSubjectStatus
* @param study Reference
* @param individual Reference
*/
public ResearchSubject(CodeSystemResearchSubjectStatus status, Reference study, Reference individual) {
this.status = status;
this.study = study;
this.individual = individual;
}

@Override
public String getResourceType() {
return ResearchSubject.resourceType;
}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*
* Copyright (c) 2020 D4L data4life gGmbH / All rights reserved.
*
* D4L owns all legal rights, title and interest in and to the Software Development Kit ("SDK"),
* including any intellectual property rights that subsist in the SDK.
*
* The SDK and its documentation may be accessed and used for viewing/review purposes only.
* Any usage of the SDK for other purposes, including usage for the development of
* applications/third-party applications shall require the conclusion of a license agreement
* between you and D4L.
*
* If you are interested in licensing the SDK for your own applications/third-party
* applications and/or if you’d like to contribute to the development of the SDK, please
* contact D4L by email to [email protected].
*/

package care.data4life.fhir.r4.model;


import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;

import care.data4life.fhir.r4.FhirR4Parser;
import care.data4life.fhir.test.util.FileHelper;

import static org.junit.Assert.assertEquals;

/**
* ResearchSubjectTest.java
* <p>
* Physical entity which is the primary unit of interest in the study.
* <p>
* A physical entity which is the primary unit of operational and/or administrative interest in a
* study.
* <p>
* <p>
* "Generated from FHIR 4.0.1-9346c8cc45
*/
public class ResearchSubjectTest {

FhirR4Parser parser = new FhirR4Parser();

@Test
public void testResearchSubject1() throws Exception {
String sourceJson = FileHelper.loadString("r4/researchsubject-example.json");
ResearchSubject data = parser.toFhir(ResearchSubject.class, sourceJson);

assertEquals(data.id, "example");
assertEquals(data.identifier.get(0).system, "http://example.org/studysubjectids");
assertEquals(data.identifier.get(0).type.text, "Subject id");
assertEquals(data.identifier.get(0).value, "123");
assertEquals(data.individual.reference, "Patient/example");
assertEquals(data.meta.tag.get(0).code, "HTEST");
assertEquals(data.meta.tag.get(0).display, "test health data");
assertEquals(data.meta.tag.get(0).system, "http://terminology.hl7.org/CodeSystem/v3-ActReason");
assertEquals(data.status, CodeSystemResearchSubjectStatus.CANDIDATE);
assertEquals(data.study.reference, "ResearchStudy/example");
assertEquals(data.text.div, "<div xmlns=\"http://www.w3.org/1999/xhtml\">[Put rendering here]</div>");
assertEquals(data.text.status, CodeSystemNarrativeStatus.GENERATED);

String json = parser.fromFhir(data);

JSONAssert.assertEquals(sourceJson, json, false);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*
* Copyright (c) 2020 D4L data4life gGmbH / All rights reserved.
*
* D4L owns all legal rights, title and interest in and to the Software Development Kit ("SDK"),
* including any intellectual property rights that subsist in the SDK.
*
* The SDK and its documentation may be accessed and used for viewing/review purposes only.
* Any usage of the SDK for other purposes, including usage for the development of
* applications/third-party applications shall require the conclusion of a license agreement
* between you and D4L.
*
* If you are interested in licensing the SDK for your own applications/third-party
* applications and/or if you’d like to contribute to the development of the SDK, please
* contact D4L by email to [email protected].
*/

package care.data4life.fhir.stu3.model;


import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;

import care.data4life.fhir.stu3.FhirStu3Parser;
import care.data4life.fhir.test.util.FileHelper;

import static org.junit.Assert.assertEquals;

/**
* ResearchSubjectTest.java
* <p>
* Investigation to increase healthcare-related patient-independent knowledge.
* <p>
* A process where a researcher or organization plans and then executes a series of steps intended
* to increase the field of healthcare-related knowledge. This includes studies of safety,
* efficacy, comparative effectiveness and other information about medications, devices, therapies
* and other interventional and investigative techniques. A ResearchStudy involves the gathering of
* information about human or animal subjects.
* <p>
* <p>
* Generated from FHIR 3.0.1.11917
*/
public class ResearchSubjectTest {

FhirStu3Parser parser = new FhirStu3Parser();

@Test
public void testResearchSubject1() throws Exception {
String sourceJson = FileHelper.loadString("stu3/researchsubject-example.json");
ResearchSubject data = parser.toFhir(ResearchSubject.class, sourceJson);

assertEquals(data.id, "example");
assertEquals(data.identifier.system, "http://example.org/studysubjectids");
assertEquals(data.identifier.type.text, "Subject id");
assertEquals(data.identifier.value, "123");
assertEquals(data.individual.reference, "Patient/example");
assertEquals(data.status, CodeSystemResearchSubjectStatus.CANDIDATE);
assertEquals(data.study.reference, "ResearchStudy/example");
assertEquals(data.text.div, "<div xmlns=\"http://www.w3.org/1999/xhtml\">[Put rendering here]</div>");
assertEquals(data.text.status, CodeSystemNarrativeStatus.GENERATED);

String json = parser.fromFhir(data);

JSONAssert.assertEquals(sourceJson, json, false);
}
}

0 comments on commit ea7f3f7

Please sign in to comment.