use of org.hl7.fhir.r4b.model.CanonicalResource in project org.hl7.fhir.core by hapifhir.
the class CanonicalResourceComparer method compareCodeList.
protected void compareCodeList(String name, List<CodeType> left, List<CodeType> right, Map<String, StructuralMatch<String>> comp, IssueSeverity level, CanonicalResourceComparison<? extends CanonicalResource> res, List<CodeType> union, List<CodeType> intersection) {
List<CodeType> matchR = new ArrayList<>();
StructuralMatch<String> combined = new StructuralMatch<String>();
for (CodeType l : left) {
CodeType r = findCodeInList(right, l);
if (r == null) {
union.add(l);
combined.getChildren().add(new StructuralMatch<String>(l.getValue(), vm(IssueSeverity.INFORMATION, "Removed the item '" + l.getValue() + "'", fhirType() + "." + name, res.getMessages())));
} else {
matchR.add(r);
union.add(r);
intersection.add(r);
StructuralMatch<String> sm = new StructuralMatch<String>(l.getValue(), r.getValue());
combined.getChildren().add(sm);
}
}
for (CodeType r : right) {
if (!matchR.contains(r)) {
union.add(r);
combined.getChildren().add(new StructuralMatch<String>(vm(IssueSeverity.INFORMATION, "Added the item '" + r.getValue() + "'", fhirType() + "." + name, res.getMessages()), r.getValue()));
}
}
comp.put(name, combined);
}
use of org.hl7.fhir.r4b.model.CanonicalResource in project org.hl7.fhir.core by hapifhir.
the class CanonicalResourceComparer method comparePrimitives.
@SuppressWarnings("rawtypes")
protected void comparePrimitives(String name, PrimitiveType l, PrimitiveType r, Map<String, StructuralMatch<String>> comp, IssueSeverity level, CanonicalResourceComparison<? extends CanonicalResource> res) {
StructuralMatch<String> match = null;
if (l.isEmpty() && r.isEmpty()) {
match = new StructuralMatch<>(null, null, null);
} else if (l.isEmpty()) {
match = new StructuralMatch<>(null, r.primitiveValue(), vmI(IssueSeverity.INFORMATION, "Added the item '" + r.primitiveValue() + "'", fhirType() + "." + name));
} else if (r.isEmpty()) {
match = new StructuralMatch<>(l.primitiveValue(), null, vmI(IssueSeverity.INFORMATION, "Removed the item '" + l.primitiveValue() + "'", fhirType() + "." + name));
} else if (!l.hasValue() && !r.hasValue()) {
match = new StructuralMatch<>(null, null, vmI(IssueSeverity.INFORMATION, "No Value", fhirType() + "." + name));
} else if (!l.hasValue()) {
match = new StructuralMatch<>(null, r.primitiveValue(), vmI(IssueSeverity.INFORMATION, "No Value on Left", fhirType() + "." + name));
} else if (!r.hasValue()) {
match = new StructuralMatch<>(l.primitiveValue(), null, vmI(IssueSeverity.INFORMATION, "No Value on Right", fhirType() + "." + name));
} else if (l.getValue().equals(r.getValue())) {
match = new StructuralMatch<>(l.primitiveValue(), r.primitiveValue(), null);
} else {
match = new StructuralMatch<>(l.primitiveValue(), r.primitiveValue(), vmI(level, "Values Differ", fhirType() + "." + name));
if (level != IssueSeverity.NULL) {
res.getMessages().add(new ValidationMessage(Source.ProfileComparer, IssueType.INFORMATIONAL, fhirType() + "." + name, "Values for " + name + " differ: '" + l.primitiveValue() + "' vs '" + r.primitiveValue() + "'", level));
}
}
comp.put(name, match);
}
use of org.hl7.fhir.r4b.model.CanonicalResource in project org.hl7.fhir.core by hapifhir.
the class CanonicalResourceComparer method compareCanonicalList.
protected void compareCanonicalList(String name, List<CanonicalType> left, List<CanonicalType> right, Map<String, StructuralMatch<String>> comp, IssueSeverity level, CanonicalResourceComparison<? extends CanonicalResource> res, List<CanonicalType> union, List<CanonicalType> intersection) {
List<CanonicalType> matchR = new ArrayList<>();
StructuralMatch<String> combined = new StructuralMatch<String>();
for (CanonicalType l : left) {
CanonicalType r = findCanonicalInList(right, l);
if (r == null) {
union.add(l);
combined.getChildren().add(new StructuralMatch<String>(l.getValue(), vm(IssueSeverity.INFORMATION, "Removed the item '" + l.getValue() + "'", fhirType() + "." + name, res.getMessages())));
} else {
matchR.add(r);
union.add(r);
intersection.add(r);
StructuralMatch<String> sm = new StructuralMatch<String>(l.getValue(), r.getValue());
combined.getChildren().add(sm);
}
}
for (CanonicalType r : right) {
if (!matchR.contains(r)) {
union.add(r);
combined.getChildren().add(new StructuralMatch<String>(vm(IssueSeverity.INFORMATION, "Added the item '" + r.getValue() + "'", fhirType() + "." + name, res.getMessages()), r.getValue()));
}
}
comp.put(name, combined);
}
use of org.hl7.fhir.r4b.model.CanonicalResource in project org.hl7.fhir.core by hapifhir.
the class CanonicalSpreadsheetGenerator method renderCanonicalResource.
protected Sheet renderCanonicalResource(CanonicalResource cr) {
Sheet sheet = makeSheet("Metadata");
Row headerRow = sheet.createRow(0);
addCell(headerRow, 0, "Property", styles.get("header"));
addCell(headerRow, 1, "Value", styles.get("header"));
addMetadataRow(sheet, "URL", cr.getUrl());
for (Identifier id : cr.getIdentifier()) {
addMetadataRow(sheet, "Identifier", dr.display(id));
}
addMetadataRow(sheet, "Version", cr.getVersion());
addMetadataRow(sheet, "Name", cr.getName());
addMetadataRow(sheet, "Title", cr.getTitle());
addMetadataRow(sheet, "Status", cr.getStatusElement().asStringValue());
addMetadataRow(sheet, "Experimental", cr.getExperimentalElement().asStringValue());
addMetadataRow(sheet, "Date", cr.getDateElement().asStringValue());
addMetadataRow(sheet, "Publisher", cr.getPublisher());
for (ContactDetail c : cr.getContact()) {
addMetadataRow(sheet, "Contact", dr.display(c));
}
for (CodeableConcept j : cr.getJurisdiction()) {
addMetadataRow(sheet, "Jurisdiction", dr.display(j));
}
addMetadataRow(sheet, "Description", cr.getDescription());
addMetadataRow(sheet, "Purpose", cr.getPurpose());
addMetadataRow(sheet, "Copyright", cr.getCopyright());
configureSheet(sheet);
return sheet;
}
use of org.hl7.fhir.r4b.model.CanonicalResource in project org.hl7.fhir.core by hapifhir.
the class ResourceRenderer method renderCommitteeLink.
protected void renderCommitteeLink(XhtmlNode x, CanonicalResource cr) {
String code = ToolingExtensions.readStringExtension(cr, ToolingExtensions.EXT_WORKGROUP);
CodeSystem cs = context.getWorker().fetchCodeSystem("http://terminology.hl7.org/CodeSystem/hl7-work-group");
if (cs == null || !cs.hasUserData("path"))
x.tx(code);
else {
ConceptDefinitionComponent cd = CodeSystemUtilities.findCode(cs.getConcept(), code);
if (cd == null) {
x.tx(code);
} else {
x.ah(cs.getUserString("path") + "#" + cs.getId() + "-" + cd.getCode()).tx(cd.getDisplay());
}
}
}
Aggregations