use of org.hl7.fhir.dstu3.model.Person in project compss by bsc-wdc.
the class Internal method testMergeReduceTarget.
public static void testMergeReduceTarget() {
// Init
Person[] people = new Person[4];
for (int i = 0; i < people.length; ++i) {
String id = "person_" + UUID.randomUUID().toString();
System.out.println("[LOG][PSCO_MR_TARGET] Person " + i + " BeginId = " + id);
people[i] = new Person("PName" + i, i, i);
people[i].makePersistent(id);
}
// Map
for (int i = 0; i < people.length; ++i) {
people[i].taskMap("NewName" + i);
}
// Reduce
LinkedList<Integer> q = new LinkedList<Integer>();
for (int i = 0; i < people.length; i++) {
q.add(i);
}
int x = 0;
while (!q.isEmpty()) {
x = q.poll();
int y;
if (!q.isEmpty()) {
y = q.poll();
people[x].taskReduce(people[y]);
q.add(x);
}
}
// Get (sync) and write result
Person p1 = people[0];
String name = p1.getName();
int age = p1.getAge();
int numC = p1.getNumComputers();
System.out.println("[LOG][PSCO_MR_TARGET] Person " + name + " with age " + age + " has " + numC + " computers");
System.out.println("[LOG][PSCO_MR_TARGET] EndId = " + p1.getID());
}
use of org.hl7.fhir.dstu3.model.Person in project compss by bsc-wdc.
the class Internal method testPSCOReturn.
private static void testPSCOReturn() {
String id = "person_" + UUID.randomUUID().toString();
Person p = InternalImpl.taskPSCOReturn("PName3", 3, 3, id);
String name = p.getName();
int age = p.getAge();
int numC = p.getNumComputers();
System.out.println("[LOG][PSCO_RETURN] Person " + name + " with age " + age + " has " + numC + " computers");
System.out.println("[LOG][PSCO_RETURN] BeginId = " + id + " EndId = " + p.getID());
}
use of org.hl7.fhir.dstu3.model.Person in project compss by bsc-wdc.
the class Redis method testNewVersionAndConsolidate.
private static void testNewVersionAndConsolidate() throws StorageException {
Person original = new Person("Original", 0, 0);
original.makePersistent("Original");
Stack<String> personStack = new Stack<>();
personStack.push("Original");
System.out.println("[LOG][PSCO_NEW_VERSION_CONSOLIDATE] Id 0: Original");
for (int i = 1; i <= 10; ++i) {
original.setAge(i);
original.setName("person_" + i);
String oldId = original.getID();
String newId = StorageItf.newVersion(oldId, true, "none");
original = (Person) StorageItf.getByID(newId);
System.out.println("[LOG][PSCO_NEW_VERSION_CONSOLIDATE] Id " + i + ": " + newId);
personStack.push(newId);
}
StorageItf.consolidateVersion(personStack.pop());
boolean success = true;
while (!personStack.isEmpty() && success) {
String currentId = personStack.pop();
try {
StorageItf.getByID(currentId);
System.out.println("[LOG][PSCO_NEW_VERSION_CONSOLIDATE] Error, id " + currentId + " is still in Redis!");
success = false;
} catch (StorageException e) {
System.out.println("[LOG][PSCO_NEW_VERSION_CONSOLIDATE] Ok, id " + currentId + " is no longer in Redis!");
}
}
System.out.println("[LOG][PSCO_NEW_VERSION_CONSOLIDATE]: " + (success ? "OK" : "ERROR"));
}
use of org.hl7.fhir.dstu3.model.Person in project compss by bsc-wdc.
the class Redis method testPSCOInOut.
private static void testPSCOInOut() {
String id = "person_" + UUID.randomUUID().toString();
Person p = new Person("PName2", 2, 2);
p.makePersistent(id);
RedisImpl.taskPSCOInOut(p);
String name = p.getName();
int age = p.getAge();
int numC = p.getNumComputers();
System.out.println("[LOG][PSCO_INOUT] Person " + name + " with age " + age + " has " + numC + " computers");
System.out.println("[LOG][PSCO_INOUT] BeginId = " + id + " EndId = " + p.getID());
}
use of org.hl7.fhir.dstu3.model.Person in project hl7v2-fhir-converter by LinuxForHealth.
the class Hl7FinancialInsuranceTest method testForDataBleedFromPatientToOrganization.
@Test
// Ensure that Patient data does not bleed into Organizations created for the Patient's insurance
void testForDataBleedFromPatientToOrganization() throws IOException {
String hl7message = "MSH|^~\\&|TEST|TEST|||20220101120000||ADT^A01^ADT_A01|1234|P|2.6\n" + // PID.12 Used for district calculation
"PID|1|103456|MR12345678^^^^MR||DOE^JANE^|||F|||19 Raymond St^Route3^Albany^NY^56321^USA^P|12||||||||||||||||||||||||||\n" + // PD1.4 Used for org creation to check for bleed of districts
"PD1|||Mayo|123456^Walt^^^^Dr||||||||||||||||||\n" + // IN1 Broadly populated to create organization
"IN1|1|GLOBAL|7776664|Blue Cross Blue Shield|456 Blue Cross Lane||||Blue|987123|IBM||||||NON||||||||||||20210322145350|Dr Disney|S|GOOD|200|12|B6543|H789456|||17|||1|M|123 IBM way|True|NONE|B|NO|J321456|M|20210322145605|London|YES\n" + // IN2 Broadly populated to create organizations
"IN2|A23456|222001111|IBM 1345|EMPLOYEED|E|N23497234|R3294809|S234234|Army|U439823|SGT SCHULTZ|Army|Fort Wayne|USA|E1... E9|ACT|20300402145954|N|N|N|Yes|Grey Duck|Goose|T34941341232|D123123123|C435435345|2|SPR|2ANC|1234.00|O|A0|USA|EN|F|F|Y|N|COG|Stanley|DUTCH|N|M|20170322150208||Software Engineer|8|P|Mr Blue|1-555-333-4444|SURGERY|Jim Stanley|1-555-222-3333|FIRST|20170202150409|20210322150400|3|1-222-333-4444|GLOBAL|GROUP|B14456789|OTH|1-444-777-8888|1-444-555-3333|NONE|N|Y|N|GVH 123456|CDP 98765|2106-3|9\n";
List<BundleEntryComponent> e = ResourceUtils.createFHIRBundleFromHL7MessageReturnEntryList(ftv, hl7message);
List<Resource> patients = ResourceUtils.getResourceList(e, ResourceType.Patient);
// From PID
assertThat(patients).hasSize(1);
Patient patient = (Patient) patients.get(0);
assertThat(patient.getAddressFirstRep().getDistrict()).hasToString("12");
List<Resource> organizations = ResourceUtils.getResourceList(e, ResourceType.Organization);
// From Payor created by IN1
assertThat(organizations).hasSize(3);
Organization org = (Organization) organizations.get(0);
assertThat(org.getAddressFirstRep().hasDistrict()).isFalse();
org = (Organization) organizations.get(1);
assertThat(org.hasAddress()).isFalse();
org = (Organization) organizations.get(2);
assertThat(org.hasAddress()).isFalse();
List<Resource> coverages = ResourceUtils.getResourceList(e, ResourceType.Coverage);
// From IN1 segment
assertThat(coverages).hasSize(1);
Coverage coverage = (Coverage) coverages.get(0);
// Confirm Coverage Identifiers
assertThat(coverage.getIdentifier()).hasSize(6);
// Coverage Identifiers deep check in testBasicInsuranceCoverageFields
// Because the relationship is NON, no subscriber is created
assertThat(coverage.hasSubscriber()).isFalse();
// Expect no RelatedPerson because IN1.17 is NON
List<Resource> relatedPersons = ResourceUtils.getResourceList(e, ResourceType.RelatedPerson);
// No related person should be created because IN1.17 was an unknown code
assertThat(relatedPersons).isEmpty();
// Confirm there are no unaccounted for resources
// Expected: Coverage, Organization (3), Patient, Practitioner
assertThat(e).hasSize(6);
}
Aggregations