use of org.hl7.fhir.r4.model.Observation.ObservationStatus.FINAL in project kindling by HL7.
the class Publisher method execute.
/**
* Entry point to the publisher. This classes Java Main() calls this function
* to actually produce the specification
*
* @param folder
* @throws IOException
*/
public void execute(String folder) throws IOException {
tester = new PublisherTestSuites();
page.log("Publish FHIR in folder " + folder + " @ " + Config.DATE_FORMAT().format(page.getGenDate().getTime()), LogMessageType.Process);
if (web)
page.log("Build final copy for HL7 web site", LogMessageType.Process);
else
page.log("Build local copy", LogMessageType.Process);
if (outputdir != null) {
page.log("Create output in " + outputdir, LogMessageType.Process);
}
page.log("Detected Java version: " + System.getProperty("java.version") + " from " + System.getProperty("java.home") + " on " + System.getProperty("os.arch"), LogMessageType.Process);
try {
tester.initialTests();
page.setFolders(new FolderManager(folder, outputdir));
if (!initialize(folder))
throw new Exception("Unable to publish as preconditions aren't met");
cache = new IniFile(page.getFolders().rootDir + "temp" + File.separator + "build.cache");
loadSuppressedMessages(page.getFolders().rootDir);
boolean doAny = false;
for (String n : dates.keySet()) {
Long d = cache.getLongProperty("dates", n);
boolean b = d == null || (dates.get(n) > d);
cache.setLongProperty("dates", n, dates.get(n).longValue(), null);
buildFlags.put(n.toLowerCase(), b);
doAny = doAny || b;
}
cache.save();
if (noPartialBuild || !doAny || !(new File(page.getFolders().dstDir + "qa.html").exists()))
// nothing - build all
buildFlags.put("all", true);
if (singlePage != null) {
for (String n : buildFlags.keySet()) buildFlags.put(n, false);
buildFlags.put("page-" + singlePage.toLowerCase(), true);
} else if (singleResource != null) {
for (String n : buildFlags.keySet()) buildFlags.put(n, false);
buildFlags.put(singleResource.toLowerCase(), true);
}
if (!buildFlags.get("all")) {
if (!noSound) {
AudioUtilities.tone(1000, 10);
AudioUtilities.tone(1400, 10);
AudioUtilities.tone(1800, 10);
AudioUtilities.tone(1000, 10);
AudioUtilities.tone(1400, 10);
AudioUtilities.tone(1800, 10);
}
page.log("Partial Build (if you want a full build, just run the build again)", LogMessageType.Process);
CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder();
for (String n : buildFlags.keySet()) if (buildFlags.get(n))
b.append(n);
page.log(" Build: " + b.toString(), LogMessageType.Process);
} else {
if (!noSound)
AudioUtilities.tone(1200, 30);
page.log("Full Build", LogMessageType.Process);
}
if (isGenerate && page.getBuildId() == null)
page.setBuildId(getGitBuildId());
page.log("Version " + page.getVersion() + "-" + page.getBuildId(), LogMessageType.Hint);
Utilities.createDirectory(page.getFolders().dstDir);
Utilities.deleteTempFiles();
page.getBreadCrumbManager().parse(page.getFolders().srcDir + "hierarchy.xml");
page.loadSnomed();
page.loadLoinc();
page.loadUcum();
buildFeedsAndMaps();
prsr.setExternals(externals);
prsr.parse(page.getGenDate(), page.getValidationErrors());
for (String n : page.getDefinitions().sortedResourceNames()) if (!page.getBreadCrumbManager().knowsResource(n))
page.getValidationErrors().add(new ValidationMessage(Source.Publisher, IssueType.INVALID, -1, -1, "hierarchy.xml", "Resource not found: " + n, IssueSeverity.ERROR));
for (String n : prsr.getErrors()) page.getValidationErrors().add(new ValidationMessage(Source.Publisher, IssueType.INVALID, -1, -1, "source spreadsheets", n, IssueSeverity.ERROR));
if (web) {
page.log("Clear Directory", LogMessageType.Process);
Utilities.clearDirectory(page.getFolders().dstDir);
}
if (web || (isGenerate && buildFlags.get("all"))) {
Utilities.createDirectory(page.getFolders().dstDir + "html");
Utilities.createDirectory(page.getFolders().dstDir + "examples");
}
for (ImplementationGuideDefn ig : page.getDefinitions().getSortedIgs()) if (!ig.isCore())
Utilities.createDirectory(page.getFolders().dstDir + ig.getCode());
if (buildFlags.get("all")) {
copyStaticContent();
}
page.makeRenderingContext();
loadValueSets1();
prsr.getRegistry().commit();
generateSCMaps();
validate();
processProfiles();
checkAllOk();
if (isGenerate) {
produceSpecification();
checkAllOk();
}
if (doValidate)
validationProcess();
page.saveSnomed();
page.getWorkerContext().saveCache();
processWarnings(false);
if (isGenerate && buildFlags.get("all"))
produceQA();
if (!buildFlags.get("all")) {
page.log("This was a Partial Build", LogMessageType.Process);
CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder();
for (String n : buildFlags.keySet()) if (buildFlags.get(n))
b.append(n);
page.log(" Build: " + b.toString(), LogMessageType.Process);
} else
page.log("This was a Full Build", LogMessageType.Process);
if (!noSound) {
AudioUtilities.tone(800, 10);
AudioUtilities.tone(1000, 10);
AudioUtilities.tone(1200, 10);
AudioUtilities.tone(1000, 10);
AudioUtilities.tone(800, 10);
}
page.log("Finished publishing FHIR @ " + Config.DATE_FORMAT().format(Calendar.getInstance().getTime()), LogMessageType.Process);
} catch (Exception e) {
if (!(e instanceof NullPointerException)) {
// because NullPointerException is unexpected...
try {
processWarnings(e instanceof EValidationFailed);
} catch (Exception e2) {
page.log(" ERROR: Unable to process warnings: " + e2.getMessage(), LogMessageType.Error);
e2.printStackTrace();
}
}
if (buildFlags.containsKey("all") && !buildFlags.get("all")) {
page.log("This was a Partial Build", LogMessageType.Process);
CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder();
for (String n : buildFlags.keySet()) if (buildFlags.get(n))
b.append(n);
page.log(" Build: " + b.toString(), LogMessageType.Process);
} else
page.log("This was a Full Build", LogMessageType.Process);
if (!noSound) {
AudioUtilities.tone(800, 20);
AudioUtilities.tone(1000, 20);
AudioUtilities.tone(1200, 20);
}
try {
Thread.sleep(50);
} catch (InterruptedException e1) {
}
if (!noSound) {
AudioUtilities.tone(800, 20);
AudioUtilities.tone(1000, 20);
AudioUtilities.tone(1200, 20);
}
try {
Thread.sleep(50);
} catch (InterruptedException e1) {
}
if (!noSound) {
AudioUtilities.tone(800, 20);
AudioUtilities.tone(1000, 20);
AudioUtilities.tone(1200, 20);
}
page.log("FHIR build failure @ " + Config.DATE_FORMAT().format(Calendar.getInstance().getTime()), LogMessageType.Process);
System.out.println("Error: " + e.getMessage());
e.printStackTrace();
TextFile.stringToFile(StringUtils.defaultString(e.getMessage()), Utilities.path(folder, "publish", "simple-error.txt"));
System.exit(1);
}
}
use of org.hl7.fhir.r4.model.Observation.ObservationStatus.FINAL in project kindling by HL7.
the class Publisher method copyImage.
private void copyImage(String folder, String n) throws IOException {
if (n.contains("*")) {
final String filter = n.replace("?", ".?").replace("*", ".*?");
File[] files = new File(folder).listFiles(new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
return name.matches(filter);
}
});
for (File f : files) {
Utilities.copyFile(f, new CSFile(page.getFolders().dstDir + f.getName()));
page.getHTMLChecker().registerFile(f.getName(), "Support File", HTMLLinkChecker.determineType(n), true);
}
} else {
Utilities.copyFile(new CSFile(Utilities.path(folder, n)), new CSFile(page.getFolders().dstDir + (n.contains("/") ? n.substring(n.lastIndexOf("/") + 1) : n)));
page.getHTMLChecker().registerFile(n, "Support File", HTMLLinkChecker.determineType(n), true);
}
}
use of org.hl7.fhir.r4.model.Observation.ObservationStatus.FINAL in project kindling by HL7.
the class PageProcessor method asText.
private String asText(List<CodeType> list) {
StringBuilder b = new StringBuilder();
boolean first = true;
for (CodeType rn : list) {
if (first) {
first = false;
b.append("<br/>(");
} else
b.append(", ");
final String value = rn.getValue();
if ("Any".equals(value))
b.append("Any");
else
b.append("<a href=\"").append(value.toLowerCase()).append(".html\">").append(value).append("</a>");
}
if (!first)
b.append(")");
return b.toString();
}
use of org.hl7.fhir.r4.model.Observation.ObservationStatus.FINAL in project kindling by HL7.
the class Publisher method copyIgImage.
private void copyIgImage(ImplementationGuideDefn ig, String path) throws IOException {
File file = new File(Utilities.path(page.getFolders().rootDir, ig.getSource(), "..", path));
String prefix = ig.isCore() ? "" : ig.getCode() + File.separator;
if (path.contains("*")) {
final String filter = file.getName().replace("?", ".?").replace("*", ".*?");
File[] files = new File(file.getParent()).listFiles(new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
return name.matches(filter);
}
});
for (File f : files) {
Utilities.copyFile(f, new CSFile(Utilities.path(page.getFolders().dstDir, prefix + f.getName())));
page.getHTMLChecker().registerFile(prefix + f.getName(), "Support File", HTMLLinkChecker.determineType(f.getName()), true);
}
} else {
Utilities.copyFile(file, new CSFile(Utilities.path(page.getFolders().dstDir, prefix + file.getName())));
page.getHTMLChecker().registerFile(prefix + file.getName(), "Support File", HTMLLinkChecker.determineType(file.getName()), true);
}
}
use of org.hl7.fhir.r4.model.Observation.ObservationStatus.FINAL in project hl7v2-fhir-converter by LinuxForHealth.
the class Hl7DocumentReferenceFHIRConversionTest method doc_ref_doc_status_test.
@ParameterizedTest
@ValueSource(strings = { "MDM^T02", "MDM^T06" })
void doc_ref_doc_status_test(String segment) {
String documentReferenceMessage = "MSH|^~\\&|HL7Soup|Instance1|MCM|Instance2|200911021022|Security|" + segment + "^MDM_T02|64322|P|2.6|123|456|ER|AL|USA|ASCII|en|2.6|56789^NID^UID|MCM||||\n" + "PID|1||000054321^^^MRN|||||||||||||M|CAT|||||N\n" + "PV1|1|I||||||||||||||||||||||||||||||||||||||||||\n" + "ORC|NW|||PGN001|SC|D|1|||MS|MS|||||\n" + "OBR|1||||||20170825010500|||||||||||||002|||||F||||||||\n" + "TXA|1||TEXT|||20180117144200|201801180346||<PHYSID1>||||||||PA||AV|||<PHYSID2>||\n" + "OBX|1|ST|100||This is content|||||||X\n";
DocumentReference report = ResourceUtils.getDocumentReference(ftv, documentReferenceMessage);
DocumentReference.ReferredDocumentStatus docStatus = report.getDocStatus();
// TXA.17
assertThat(docStatus.toCode()).isEqualTo("preliminary");
assertThat(docStatus.getDefinition()).contains("This is a preliminary composition or document (also known as initial or interim).");
assertThat(docStatus.getSystem()).isEqualTo("http://hl7.org/fhir/composition-status");
// Check OBX.11 as fallback
documentReferenceMessage = "MSH|^~\\&|HL7Soup|Instance1|MCM|Instance2|200911021022|Security|" + segment + "^MDM_T02|64322|P|2.6|123|456|ER|AL|USA|ASCII|en|2.6|56789^NID^UID|MCM||||\n" + "PID|1||000054321^^^MRN|||||||||||||M|CAT|||||N\n" + "PV1|1|I||||||||||||||||||||||||||||||||||||||||||\n" + "ORC|NW|||PGN001|SC|D|1|||MS|MS|||||\n" + "OBR|1|||555|||20170825010500|||||||||||||002|||||F||||||||\n" + "TXA|1||TEXT|||20180117144200|201801180346||<PHYSID1>||||||||||AV|||<PHYSID2>||\n" + "OBX|1|SN|||||||||F";
report = ResourceUtils.getDocumentReference(ftv, documentReferenceMessage);
docStatus = report.getDocStatus();
// OBX.11
assertThat(docStatus.toCode()).isEqualTo("final");
assertThat(docStatus.getDefinition()).contains("This version of the composition is complete and verified by an appropriate person and no further work is planned.");
assertThat(docStatus.getSystem()).isEqualTo("http://hl7.org/fhir/composition-status");
// Check a value that is not mapped results is no docStatus
documentReferenceMessage = "MSH|^~\\&|HL7Soup|Instance1|MCM|Instance2|200911021022|Security|" + segment + "^MDM_T02|64322|P|2.6|123|456|ER|AL|USA|ASCII|en|2.6|56789^NID^UID|MCM||||\n" + "PID|1||000054321^^^MRN|||||||||||||M|CAT|||||N\n" + "PV1|1|I||||||||||||||||||||||||||||||||||||||||||\n" + "ORC|NW|||PGN001|SC|D|1|||MS|MS\n" + "OBR|1|||555|||20170825010500|||||||||||||002|||||F\n" + "TXA|1||TEXT|||20180117144200|201801180346||<PHYSID1>||||||||||AV|||<PHYSID2>\n" + "OBX|1|SN|||||||||X";
report = ResourceUtils.getDocumentReference(ftv, documentReferenceMessage);
// OBX-11 'X' is not mapped
assertThat(report.getDocStatus()).isNull();
}
Aggregations