use of com.ibm.cloud.cloudant.v1.model.Attachment in project fhir-bridge by ehrbase.
the class DocumentReferenceToHipDocumentConverter method getMultimedia.
private MediendateiCluster getMultimedia(DocumentReference documentReference) {
Attachment attachment = documentReference.getContentFirstRep().getAttachment();
DvMultimedia multimedia = new DvMultimedia();
multimedia.setUri(new DvURI(attachment.getUrl()));
multimedia.setMediaType(new CodePhrase(new TerminologyId("IANA_media-types"), attachment.getContentType()));
multimedia.setSize(attachment.getSize());
MediendateiCluster result = new MediendateiCluster();
result.setMediendateiInhalt(multimedia);
result.setMediendateiInhaltValue(attachment.getTitle());
result.setBeschreibungValue(documentReference.getDescription());
getCreation(attachment).ifPresent(result::setErstelltValue);
return result;
}
use of com.ibm.cloud.cloudant.v1.model.Attachment in project geoprism-registry by terraframe.
the class AbstractFhirResourceProcessor method getGeometry.
protected Geometry getGeometry(Location location, ServerGeoObjectType type) {
Extension extension = location.getExtensionByUrl("http://hl7.org/fhir/StructureDefinition/location-boundary-geojson");
if (extension != null) {
Attachment value = (Attachment) extension.getValue();
if (value.hasData()) {
Decoder decoder = Base64.getDecoder();
byte[] binary = decoder.decode(value.getDataElement().getValueAsString());
String geojson = new String(binary);
GeoJsonReader reader = new GeoJsonReader();
try {
return reader.read(geojson);
} catch (ParseException e) {
e.printStackTrace();
}
}
}
return null;
}
use of com.ibm.cloud.cloudant.v1.model.Attachment in project geoprism-registry by terraframe.
the class ListTypeFhirExporter method createFacility.
private Facility createFacility(Business row, Identifier identifier) {
String code = row.getValue(DefaultAttribute.CODE.getName());
Organization org = new Organization();
org.setId(new IdType(org.getResourceType().name(), code));
org.setName(row.getValue(DefaultAttribute.DISPLAY_LABEL.getName() + ListTypeVersion.DEFAULT_LOCALE));
org.addIdentifier(identifier);
Location location = new Location();
location.setId(new IdType(location.getResourceType().name(), code));
location.setName(row.getValue(DefaultAttribute.DISPLAY_LABEL.getName() + ListTypeVersion.DEFAULT_LOCALE));
location.setManagingOrganization(new Reference(org.getIdElement()));
location.addIdentifier(identifier);
Geometry geometry = row.getObjectValue(RegistryConstants.GEOMETRY_ATTRIBUTE_NAME);
if (geometry != null) {
Point centroid = geometry.getCentroid();
GeoJsonWriter writer = new GeoJsonWriter();
String geojson = writer.write(geometry);
Encoder encoder = Base64.getEncoder();
// Create a location
Attachment attachment = new Attachment();
attachment.setContentType("application/json");
attachment.setDataElement(new Base64BinaryType(encoder.encodeToString(geojson.getBytes())));
attachment.setTitle("Geojson");
Extension extension = new Extension("http://hl7.org/fhir/StructureDefinition/location-boundary-geojson");
extension.setValue(attachment);
location.setPosition(new LocationPositionComponent(new DecimalType(centroid.getX()), new DecimalType(centroid.getY())));
location.addExtension(extension);
}
return new Facility(org, location);
}
use of com.ibm.cloud.cloudant.v1.model.Attachment in project quality-measure-and-cohort-service by Alvearie.
the class CohortCLI method toCqlLibraryMap.
private Map<CqlLibraryDescriptor, CqlLibrary> toCqlLibraryMap(List<Library> libraries) {
Map<CqlLibraryDescriptor, CqlLibrary> retVal = new HashMap<>();
for (Library library : libraries) {
String libraryId = library.getName();
String version = library.getVersion();
for (Attachment attachment : library.getContent()) {
Format libraryFormat = Format.lookupByName(attachment.getContentType());
if (libraryFormat != null) {
CqlLibraryDescriptor key = new CqlLibraryDescriptor().setLibraryId(libraryId).setVersion(version).setFormat(libraryFormat);
CqlLibrary value = new CqlLibrary().setContent(new String(attachment.getData())).setDescriptor(key);
retVal.put(key, value);
}
}
}
return retVal;
}
use of com.ibm.cloud.cloudant.v1.model.Attachment in project quality-measure-and-cohort-service by Alvearie.
the class R4LibraryDependencyGathererTest method withContent.
private void withContent(Library library, String contentType) {
Attachment attachment = new Attachment();
attachment.setContentType(contentType);
library.addContent(attachment);
}
Aggregations