Search in sources :

Example 1 with Vines

use of com.ibm.streamsx.health.vines.model.Vines in project streamsx.health by IBMStreams.

the class VinesMessageParser method fromJson.

public static Vines fromJson(String jsonString) {
    Gson gson = createGson();
    Vines vinesMsg = gson.fromJson(jsonString, Vines.class);
    vinesMsg.setRawMessage(jsonString);
    return vinesMsg;
}
Also used : Vines(com.ibm.streamsx.health.vines.model.Vines) Gson(com.google.gson.Gson)

Example 2 with Vines

use of com.ibm.streamsx.health.vines.model.Vines in project streamsx.health by IBMStreams.

the class Tests method testPatient.

@Test
public void testPatient() {
    Vines vines = VinesMessageParser.fromJson(simpleMessage);
    Patient patient = vines.getData().getPatient();
    Assert.assertEquals("537e1f98db23c810388ae214", patient.get_id());
    Assert.assertEquals("HO60002", patient.getMRN());
    Assert.assertEquals("VinesIHEAddin", patient.getMRNSource());
    Assert.assertEquals("M", patient.getSex());
    NameList nameList = patient.getNameList();
    Assert.assertTrue(nameList.size() > 0);
    Name name = nameList.get(0);
    Assert.assertEquals("Charles", name.getFirstName());
    Assert.assertEquals("Darwin", name.getLastName());
    Assert.assertEquals("Robert", name.getMiddleName());
    Assert.assertEquals("Mr.", name.getPrefix());
    Assert.assertEquals("I", name.getSuffix());
}
Also used : NameList(com.ibm.streamsx.health.vines.model.NameList) Vines(com.ibm.streamsx.health.vines.model.Vines) Patient(com.ibm.streamsx.health.vines.model.Patient) Name(com.ibm.streamsx.health.vines.model.Name) Test(org.junit.Test)

Example 3 with Vines

use of com.ibm.streamsx.health.vines.model.Vines in project streamsx.health by IBMStreams.

the class Tests method testLocation.

@Test
public void testLocation() {
    Vines vines = VinesMessageParser.fromJson(simpleMessage);
    Location location = vines.getData().getLocation();
    Assert.assertEquals("537e1f98db23c810388ae216", location.get_id());
    Assert.assertEquals("Default Patient Location", location.getName());
    Assert.assertEquals(false, location.getIsDeleted());
    Assert.assertEquals("537e1f98db23c810388ae214", location.getPatientId());
    Assert.assertEquals(true, location.getIsDefault());
}
Also used : Vines(com.ibm.streamsx.health.vines.model.Vines) Location(com.ibm.streamsx.health.vines.model.Location) Test(org.junit.Test)

Example 4 with Vines

use of com.ibm.streamsx.health.vines.model.Vines in project streamsx.health by IBMStreams.

the class Tests method testWaveformTerm.

@Test
public void testWaveformTerm() {
    Vines vines = VinesMessageParser.fromJson(waveformMessage);
    Terms terms = vines.getData().getBody().getTerms();
    Assert.assertTrue(terms.containsKey("CH01"));
    /* Test waveform */
    Channel chan = terms.getChannel("CH01");
    Assert.assertTrue(chan.containsKey("MDC_ATTR_WAV"));
    ITerm t = chan.getTerm("MDC_ATTR_WAV");
    Assert.assertTrue(t instanceof TermArray);
    TermArray ta = (TermArray) t;
    Assert.assertTrue(ta.size() > 0);
    ITermValue itv = ta.get(0);
    Assert.assertTrue(itv instanceof TermValueMap);
    TermValueMap tvm = (TermValueMap) itv;
    Assert.assertTrue(tvm.containsKey("MDC_PRESS_BLD_ART_ABP"));
    t = tvm.get("MDC_PRESS_BLD_ART_ABP");
    Assert.assertTrue(t instanceof Term);
    Term term = (Term) t;
    itv = term.getValue();
    Assert.assertTrue(itv instanceof TermValueString);
    TermValueString tvs = (TermValueString) itv;
    String waveformString = "115.3125^116.5^117.4375^118.1875^118.8125^119.25^119.625^119.9375^120.125^120.25^120.125^119.875^119.375^118.75^117.9375^117^115.875^114.5^113^11 1.3125^109.8125^108.4375^107.3125^106.375^105.5625^104.875^104.25^103.6875^103.1875^102.8125^102.875^103.5625";
    Assert.assertEquals(waveformString, tvs.getValue());
    /* Test vitals */
    t = chan.getTerm("MDC_ATTR_SCALE_RANGE");
    Assert.assertTrue(t instanceof Term);
    term = (Term) t;
    Assert.assertEquals("", term.getCode());
    Assert.assertEquals("-40", term.getLowerValue());
    Assert.assertEquals("520", term.getUpperValue());
    Assert.assertEquals("MDC_DIM_MMHG", term.getUOM());
    Assert.assertEquals("266016", term.getUOMCode());
}
Also used : ITermValue(com.ibm.streamsx.health.vines.model.ITermValue) Vines(com.ibm.streamsx.health.vines.model.Vines) TermArray(com.ibm.streamsx.health.vines.model.TermArray) Channel(com.ibm.streamsx.health.vines.model.Channel) Terms(com.ibm.streamsx.health.vines.model.Terms) ITerm(com.ibm.streamsx.health.vines.model.ITerm) ITerm(com.ibm.streamsx.health.vines.model.ITerm) Term(com.ibm.streamsx.health.vines.model.Term) TermValueString(com.ibm.streamsx.health.vines.model.TermValueString) TermValueString(com.ibm.streamsx.health.vines.model.TermValueString) TermValueMap(com.ibm.streamsx.health.vines.model.TermValueMap) Test(org.junit.Test)

Example 5 with Vines

use of com.ibm.streamsx.health.vines.model.Vines in project streamsx.health by IBMStreams.

the class Tests method serviceIdTest.

@Test
public void serviceIdTest() {
    Vines vines = VinesMessageParser.fromJson(simpleMessage);
    ServiceId serviceId = vines.getData().getBody().getServiceId();
    Assert.assertTrue(serviceId.containsKey("Dopamine 475"));
    Service service = serviceId.get("Dopamine 475");
    Assert.assertEquals("2222", service.getCode());
}
Also used : Vines(com.ibm.streamsx.health.vines.model.Vines) Service(com.ibm.streamsx.health.vines.model.Service) ServiceId(com.ibm.streamsx.health.vines.model.ServiceId) Test(org.junit.Test)

Aggregations

Vines (com.ibm.streamsx.health.vines.model.Vines)10 Test (org.junit.Test)9 Channel (com.ibm.streamsx.health.vines.model.Channel)3 Terms (com.ibm.streamsx.health.vines.model.Terms)3 ITerm (com.ibm.streamsx.health.vines.model.ITerm)2 ITermValue (com.ibm.streamsx.health.vines.model.ITermValue)2 Term (com.ibm.streamsx.health.vines.model.Term)2 TermValueMap (com.ibm.streamsx.health.vines.model.TermValueMap)2 TermValueString (com.ibm.streamsx.health.vines.model.TermValueString)2 Gson (com.google.gson.Gson)1 Location (com.ibm.streamsx.health.vines.model.Location)1 Name (com.ibm.streamsx.health.vines.model.Name)1 NameList (com.ibm.streamsx.health.vines.model.NameList)1 Patient (com.ibm.streamsx.health.vines.model.Patient)1 Service (com.ibm.streamsx.health.vines.model.Service)1 ServiceId (com.ibm.streamsx.health.vines.model.ServiceId)1 TermArray (com.ibm.streamsx.health.vines.model.TermArray)1