use of ambit2.base.data.study.ProtocolEffectRecord in project ambit-mirror by ideaconsult.
the class ProtocolEffectRecord2SubstanceProperty method process.
@Override
public SubstanceProperty process(ProtocolEffectRecord<String, IParams, String> detail) throws Exception {
SubstanceProperty key = new SubstanceProperty(detail.getProtocol().getTopCategory(), detail.getProtocol().getCategory(), detail.getEndpoint() == null ? "interpretation_result" : detail.getEndpoint(), detail.getUnit(), getReference(detail));
key.setExtendedURI(true);
key.setIdentifier(detail.getSampleID());
key.setAnnotations(conditions2annotations(detail));
try {
key.setStudyResultType(_r_flags.valueOf(detail.getStudyResultType().replace(":", "").replace("_", "").replace(" ", "").replace("-", "").replace(")", "").replace("(", "")));
} catch (Exception x) {
key.setStudyResultType(null);
}
return key;
}
use of ambit2.base.data.study.ProtocolEffectRecord in project ambit-mirror by ideaconsult.
the class ProtocolEffectRecord2SubstanceProperty method processValue.
public static Value processValue(ProtocolEffectRecord<String, String, String> detail, boolean istextvalue) {
if (istextvalue) {
Value<String> value = new Value<String>();
if (detail.getTextValue() == null)
if (detail.getInterpretationResult() == null)
value.setLoValue("");
else
value.setLoValue(detail.getInterpretationResult());
else
value.setLoValue(detail.getTextValue().toString());
return value;
} else {
Value value = new Value();
value.setLoQualifier(detail.getLoQualifier());
value.setUpQualifier(detail.getUpQualifier());
value.setUpValue(detail.getUpValue());
value.setLoValue(detail.getLoValue());
return value;
}
}
use of ambit2.base.data.study.ProtocolEffectRecord in project ambit-mirror by ideaconsult.
the class CallableSubstancePropertyCreatorTest method testCreateSubstancePropertyFromRDF.
@Test
public void testCreateSubstancePropertyFromRDF() throws Exception {
URL url = getClass().getClassLoader().getResource("feature.rdf");
File file = new File(url.getFile());
Assert.assertTrue(file.exists());
try {
PropertyURIReporter reporter = new PropertyURIReporter(new Reference("http://localhost:8081/ambit2"));
CallableSubstancePropertyCreator callable = new CallableSubstancePropertyCreator(reporter, Method.POST, file, MediaType.APPLICATION_RDF_XML, null, null);
TaskResult task = callable.call();
ProtocolEffectRecord2SubstanceProperty p = new ProtocolEffectRecord2SubstanceProperty();
ProtocolEffectRecord<String, IParams, String> effect = new ProtocolEffectRecord<String, IParams, String>();
Protocol protocol = new Protocol(null);
Protocol._categories category = Protocol._categories.EC_DAPHNIATOX_SECTION;
protocol.setCategory(category.name());
protocol.setTopCategory(category.getTopCategory());
protocol.addGuideline("http://localhost:8080/ambit2/dataset/Method%3A+other%3A+Am.+Soc.+Test.+Mater.+%281980%29+and+U.S.+EPA+%281975%29");
effect.setProtocol(protocol);
effect.setEndpoint("EC10");
effect.setUnit("mg/L");
effect.setConditions(new Params());
/*
* Value value = new Value(); value.setLoValue(48.0);
* value.setUnits("h"); effect.getConditions().put("Exposure",
* value);
*/
SubstanceProperty prop = p.process(effect);
prop.setIdentifier(prop.createHashedIdentifier(effect.getConditions()));
Assert.assertEquals(reporter.getURI(prop), task.getUri());
} catch (Exception x) {
throw x;
} finally {
}
}
use of ambit2.base.data.study.ProtocolEffectRecord in project ambit-mirror by ideaconsult.
the class BundleMatrixResource method processValue.
@Override
protected Value processValue(ProtocolEffectRecord<String, String, String> detail, boolean istextvalue) {
ValueAnnotated value = null;
if (istextvalue) {
if (detail.getTextValue() == null) {
if (detail.getInterpretationResult() != null && !"".equals(detail.getInterpretationResult().trim())) {
value = new ValueAnnotated<Object, String>();
value.setTextValue(detail.getInterpretationResult());
value.setIdresult(detail.getDocumentUUID());
if (detail instanceof ProtocolEffectRecordMatrix)
try {
value.setCopied(((ProtocolEffectRecordMatrix) detail).isProtocolapp_copied());
value.setDeleted(((ProtocolEffectRecordMatrix) detail).isProtocolapp_deleted());
value.setRemark(((ProtocolEffectRecordMatrix) detail).getProtocolapp_remarks());
} catch (Exception x) {
}
return value;
} else {
}
// now why should we care about empty values?
// else value.setTextValue("");
} else {
value = new ValueAnnotated<Object, Integer>();
value.setTextValue(detail.getTextValue().toString());
value.setIdresult(detail.getIdresult());
}
} else {
value = new ValueAnnotated<Object, Integer>();
value.setLoQualifier(detail.getLoQualifier());
value.setUpQualifier(detail.getUpQualifier());
value.setUpValue(detail.getUpValue());
value.setLoValue(detail.getLoValue());
value.setIdresult(detail.getIdresult());
}
if (value != null)
if (detail instanceof ProtocolEffectRecordMatrix)
try {
value.setCopied(((ProtocolEffectRecordMatrix) detail).isCopied());
value.setDeleted(((ProtocolEffectRecordMatrix) detail).isDeleted());
value.setRemark(((ProtocolEffectRecordMatrix) detail).getRemarks());
} catch (Exception x) {
}
return value;
}
Aggregations