use of org.hl7.fhir.r4.model.Observation.ObservationStatus.FINAL in project org.hl7.fhir.core by hapifhir.
the class ProfileUtilities method sortDifferential.
public void sortDifferential(StructureDefinition base, StructureDefinition diff, String name, List<String> errors) throws FHIRException {
final List<ElementDefinition> diffList = diff.getDifferential().getElement();
int lastCount = diffList.size();
// first, we move the differential elements into a tree
if (diffList.isEmpty())
return;
ElementDefinitionHolder edh = null;
int i = 0;
if (diffList.get(0).getPath().contains(".")) {
String newPath = diffList.get(0).getPath().split("\\.")[0];
ElementDefinition e = new ElementDefinition(new StringType(newPath));
edh = new ElementDefinitionHolder(e, true);
} else {
edh = new ElementDefinitionHolder(diffList.get(0));
i = 1;
}
boolean hasSlicing = false;
// in a differential, slicing may not be stated explicitly
List<String> paths = new ArrayList<String>();
for (ElementDefinition elt : diffList) {
if (elt.hasSlicing() || paths.contains(elt.getPath())) {
hasSlicing = true;
break;
}
paths.add(elt.getPath());
}
if (!hasSlicing) {
// if Differential does not have slicing then safe to pre-sort the list
// so elements and subcomponents are together
Collections.sort(diffList, new ElementNameCompare());
}
processElementsIntoTree(edh, i, diff.getDifferential().getElement());
// now, we sort the siblings throughout the tree
ElementDefinitionComparer cmp = new ElementDefinitionComparer(true, base.getSnapshot().getElement(), "", 0, name);
sortElements(edh, cmp, errors);
// now, we serialise them back to a list
diffList.clear();
writeElements(edh, diffList);
if (lastCount != diffList.size())
errors.add("Sort failed: counts differ; at least one of the paths in the differential is illegal");
}
use of org.hl7.fhir.r4.model.Observation.ObservationStatus.FINAL in project org.hl7.fhir.core by hapifhir.
the class ValueSetExpansionCache method loadCache.
private void loadCache() throws FHIRFormatError, IOException {
File[] files = new File(cacheFolder).listFiles();
for (File f : files) {
if (f.getName().endsWith(".xml")) {
final FileInputStream is = new FileInputStream(f);
try {
Resource r = context.newXmlParser().setOutputStyle(OutputStyle.PRETTY).parse(is);
if (r instanceof OperationOutcome) {
OperationOutcome oo = (OperationOutcome) r;
expansions.put(ToolingExtensions.getExtension(oo, VS_ID_EXT).getValue().toString(), new ValueSetExpansionOutcome(new XhtmlComposer(XhtmlComposer.XML, false).composePlainText(oo.getText().getDiv()), TerminologyServiceErrorClass.UNKNOWN));
} else if (r instanceof ValueSet) {
ValueSet vs = (ValueSet) r;
if (vs.hasExpansion())
expansions.put(vs.getUrl(), new ValueSetExpansionOutcome(vs));
else {
canonicals.put(vs.getUrl(), vs);
if (vs.hasVersion())
canonicals.put(vs.getUrl() + "|" + vs.getVersion(), vs);
}
} else if (r instanceof CanonicalResource) {
CanonicalResource md = (CanonicalResource) r;
canonicals.put(md.getUrl(), md);
if (md.hasVersion())
canonicals.put(md.getUrl() + "|" + md.getVersion(), md);
}
} finally {
IOUtils.closeQuietly(is);
}
}
}
}
use of org.hl7.fhir.r4.model.Observation.ObservationStatus.FINAL in project org.hl7.fhir.core by hapifhir.
the class TerminologyCacheTests method testExtractedUnder1000.
@ParameterizedTest
@MethodSource("under1000IntParams")
public void testExtractedUnder1000(int max) throws IOException {
TerminologyCache cache = createTerminologyCache();
ValueSet vs = new ValueSet();
List<ValueSet.ValueSetExpansionContainsComponent> list = createContainsArray(max);
vs.setUrl("http://dummy.org");
vs.getExpansion().setContains(list);
org.hl7.fhir.r5.formats.JsonParser json = new org.hl7.fhir.r5.formats.JsonParser();
json.setOutputStyle(IParser.OutputStyle.PRETTY);
String extracted = cache.extracted(json, vs);
JsonElement element = jsonParser.parse(extracted);
final int expansionSize = element.getAsJsonObject().has("expansion") ? element.getAsJsonObject().getAsJsonObject("expansion").getAsJsonArray("contains").size() : 0;
assertEquals(max, expansionSize);
}
use of org.hl7.fhir.r4.model.Observation.ObservationStatus.FINAL in project org.hl7.fhir.core by hapifhir.
the class XhtmlParser method parseLiteral.
private void parseLiteral(StringBuilder s) throws IOException, FHIRFormatError {
// UInt16 w;
readChar();
String c = readUntil(";&'\"><");
if (c.isEmpty())
throw new FHIRFormatError("Invalid literal declaration following text: " + s);
else if (c.charAt(0) == '#') {
if (isInteger(c.substring(1), 10))
s.append((char) Integer.parseInt(c.substring(1)));
else if (c.charAt(1) == 'x' && isInteger(c.substring(2), 16))
s.append((char) Integer.parseInt(c.substring(2), 16));
} else if (entities.containsKey(c)) {
s.append(entities.get(c));
// what's going on here?
// the contents that follow already existed, and then I added the routine to populate the entities
// which was generated from other code. The code that follows is probably redundant, but I haven't
// cross checked it. some is welcome to do so... (GG 8-Nov 2021)
} else if (c.equals("apos"))
s.append('\'');
else if (c.equals("quot"))
s.append('"');
else if (c.equals("nbsp"))
s.append(XhtmlNode.NBSP);
else if (c.equals("amp"))
s.append('&');
else if (c.equals("lsquo"))
// right single quotation, U+2019 ISOnum
s.append((char) 8216);
else if (c.equals("rsquo"))
// right single quotation, U+2019 ISOnum
s.append((char) 8217);
else if (c.equals("gt"))
s.append('>');
else if (c.equals("lt"))
s.append('<');
else if (c.equals("copy"))
s.append((char) 169);
else if (c.equals("reg"))
s.append((char) 174);
else if (c.equals("sect"))
s.append((char) 0xA7);
else if (c.equals("fnof"))
// latin small f with hook = function = florin, U+0192 ISOtech -->
s.append((char) 402);
else if (c.equals("Alpha"))
// greek capital letter alpha, U+0391
s.append((char) 913);
else if (c.equals("Beta"))
// greek capital letter beta, U+0392
s.append((char) 914);
else if (c.equals("Gamma"))
// greek capital letter gamma, U+0393 ISOgrk3
s.append((char) 915);
else if (c.equals("Delta"))
// greek capital letter delta, U+0394 ISOgrk3
s.append((char) 916);
else if (c.equals("Epsilon"))
// greek capital letter epsilon, U+0395
s.append((char) 917);
else if (c.equals("Zeta"))
// greek capital letter zeta, U+0396
s.append((char) 918);
else if (c.equals("Eta"))
// greek capital letter eta, U+0397
s.append((char) 919);
else if (c.equals("Theta"))
// greek capital letter theta, U+0398 ISOgrk3
s.append((char) 920);
else if (c.equals("Iota"))
// greek capital letter iota, U+0399
s.append((char) 921);
else if (c.equals("Kappa"))
// greek capital letter kappa, U+039A
s.append((char) 922);
else if (c.equals("Lambda"))
// greek capital letter lambda, U+039B ISOgrk3
s.append((char) 923);
else if (c.equals("Mu"))
// greek capital letter mu, U+039C
s.append((char) 924);
else if (c.equals("Nu"))
// greek capital letter nu, U+039D
s.append((char) 925);
else if (c.equals("Xi"))
// greek capital letter xi, U+039E ISOgrk3
s.append((char) 926);
else if (c.equals("Omicron"))
// greek capital letter omicron, U+039F
s.append((char) 927);
else if (c.equals("Pi"))
// greek capital letter pi, U+03A0 ISOgrk3
s.append((char) 928);
else if (c.equals("Rho"))
// greek capital letter rho, U+03A1
s.append((char) 929);
else if (c.equals("Sigma"))
// greek capital letter sigma, U+03A3 ISOgrk3
s.append((char) 931);
else if (c.equals("Tau"))
// greek capital letter tau, U+03A4
s.append((char) 932);
else if (c.equals("Upsilon"))
// greek capital letter upsilon, U+03A5 ISOgrk3
s.append((char) 933);
else if (c.equals("Phi"))
// greek capital letter phi, U+03A6 ISOgrk3
s.append((char) 934);
else if (c.equals("Chi"))
// greek capital letter chi, U+03A7
s.append((char) 935);
else if (c.equals("Psi"))
// greek capital letter psi, U+03A8 ISOgrk3
s.append((char) 936);
else if (c.equals("Omega"))
// greek capital letter omega, U+03A9 ISOgrk3
s.append((char) 937);
else if (c.equals("alpha"))
// greek small letter alpha, U+03B1 ISOgrk3
s.append((char) 945);
else if (c.equals("beta"))
// greek small letter beta, U+03B2 ISOgrk3
s.append((char) 946);
else if (c.equals("gamma"))
// greek small letter gamma, U+03B3 ISOgrk3
s.append((char) 947);
else if (c.equals("delta"))
// greek small letter delta, U+03B4 ISOgrk3
s.append((char) 948);
else if (c.equals("epsilon"))
// greek small letter epsilon, U+03B5 ISOgrk3
s.append((char) 949);
else if (c.equals("zeta"))
// greek small letter zeta, U+03B6 ISOgrk3
s.append((char) 950);
else if (c.equals("eta"))
// greek small letter eta, U+03B7 ISOgrk3
s.append((char) 951);
else if (c.equals("theta"))
// greek small letter theta, U+03B8 ISOgrk3
s.append((char) 952);
else if (c.equals("iota"))
// greek small letter iota, U+03B9 ISOgrk3
s.append((char) 953);
else if (c.equals("kappa"))
// greek small letter kappa, U+03BA ISOgrk3
s.append((char) 954);
else if (c.equals("lambda"))
// greek small letter lambda, U+03BB ISOgrk3
s.append((char) 955);
else if (c.equals("mu"))
// greek small letter mu, U+03BC ISOgrk3
s.append((char) 956);
else if (c.equals("nu"))
// greek small letter nu, U+03BD ISOgrk3
s.append((char) 957);
else if (c.equals("xi"))
// greek small letter xi, U+03BE ISOgrk3
s.append((char) 958);
else if (c.equals("omicron"))
// greek small letter omicron, U+03BF NEW
s.append((char) 959);
else if (c.equals("pi"))
// greek small letter pi, U+03C0 ISOgrk3
s.append((char) 960);
else if (c.equals("rho"))
// greek small letter rho, U+03C1 ISOgrk3
s.append((char) 961);
else if (c.equals("sigmaf"))
// greek small letter final sigma, U+03C2 ISOgrk3
s.append((char) 962);
else if (c.equals("sigma"))
// greek small letter sigma, U+03C3 ISOgrk3
s.append((char) 963);
else if (c.equals("tau"))
// greek small letter tau, U+03C4 ISOgrk3
s.append((char) 964);
else if (c.equals("upsilon"))
// greek small letter upsilon, U+03C5 ISOgrk3
s.append((char) 965);
else if (c.equals("phi"))
// greek small letter phi, U+03C6 ISOgrk3
s.append((char) 966);
else if (c.equals("chi"))
// greek small letter chi, U+03C7 ISOgrk3
s.append((char) 967);
else if (c.equals("psi"))
// greek small letter psi, U+03C8 ISOgrk3
s.append((char) 968);
else if (c.equals("omega"))
// greek small letter omega, U+03C9 ISOgrk3
s.append((char) 969);
else if (c.equals("thetasym"))
// greek small letter theta symbol, U+03D1 NEW
s.append((char) 977);
else if (c.equals("upsih"))
// greek upsilon with hook symbol, U+03D2 NEW
s.append((char) 978);
else if (c.equals("piv"))
// greek pi symbol, U+03D6 ISOgrk3
s.append((char) 982);
else if (c.equals("bull"))
// bullet = black small circle, U+2022 ISOpub
s.append((char) 8226);
else if (c.equals("hellip"))
// horizontal ellipsis = three dot leader, U+2026 ISOpub
s.append((char) 8230);
else if (c.equals("prime"))
// prime = minutes = feet, U+2032 ISOtech
s.append((char) 8242);
else if (c.equals("Prime"))
// double prime = seconds = inches, U+2033 ISOtech
s.append((char) 8243);
else if (c.equals("oline"))
// overline = spacing overscore, U+203E NEW
s.append((char) 8254);
else if (c.equals("frasl"))
// fraction slash, U+2044 NEW
s.append((char) 8260);
else if (c.equals("weierp"))
// script capital P = power set = Weierstrass p, U+2118 ISOamso
s.append((char) 8472);
else if (c.equals("image"))
// blackletter capital I = imaginary part, U+2111 ISOamso
s.append((char) 8465);
else if (c.equals("real"))
// blackletter capital R = real part symbol, U+211C ISOamso
s.append((char) 8476);
else if (c.equals("trade"))
// trade mark sign, U+2122 ISOnum
s.append((char) 8482);
else if (c.equals("alefsym"))
// alef symbol = first transfinite cardinal, U+2135 NEW
s.append((char) 8501);
else if (c.equals("larr"))
// leftwards arrow, U+2190 ISOnum
s.append((char) 8592);
else if (c.equals("uarr"))
// upwards arrow, U+2191 ISOnum
s.append((char) 8593);
else if (c.equals("rarr"))
// rightwards arrow, U+2192 ISOnum
s.append((char) 8594);
else if (c.equals("darr"))
// downwards arrow, U+2193 ISOnum
s.append((char) 8595);
else if (c.equals("harr"))
// left right arrow, U+2194 ISOamsa
s.append((char) 8596);
else if (c.equals("crarr"))
// downwards arrow with corner leftwards = carriage return, U+21B5 NEW
s.append((char) 8629);
else if (c.equals("lArr"))
// leftwards double arrow, U+21D0 ISOtech
s.append((char) 8656);
else if (c.equals("uArr"))
// upwards double arrow, U+21D1 ISOamsa
s.append((char) 8657);
else if (c.equals("rArr"))
// rightwards double arrow, U+21D2 ISOtech
s.append((char) 8658);
else if (c.equals("dArr"))
// downwards double arrow, U+21D3 ISOamsa
s.append((char) 8659);
else if (c.equals("hArr"))
// left right double arrow, U+21D4 ISOamsa
s.append((char) 8660);
else if (c.equals("forall"))
// for all, U+2200 ISOtech
s.append((char) 8704);
else if (c.equals("part"))
// partial differential, U+2202 ISOtech
s.append((char) 8706);
else if (c.equals("exist"))
// there exists, U+2203 ISOtech
s.append((char) 8707);
else if (c.equals("empty"))
// empty set = null set = diameter, U+2205 ISOamso
s.append((char) 8709);
else if (c.equals("nabla"))
// nabla = backward difference, U+2207 ISOtech
s.append((char) 8711);
else if (c.equals("isin"))
// element of, U+2208 ISOtech
s.append((char) 8712);
else if (c.equals("notin"))
// not an element of, U+2209 ISOtech
s.append((char) 8713);
else if (c.equals("ni"))
// contains as member, U+220B ISOtech
s.append((char) 8715);
else if (c.equals("prod"))
// n-ary product = product sign, U+220F ISOamsb
s.append((char) 8719);
else if (c.equals("sum"))
// n-ary sumation, U+2211 ISOamsb
s.append((char) 8721);
else if (c.equals("minus"))
// minus sign, U+2212 ISOtech
s.append((char) 8722);
else if (c.equals("lowast"))
// asterisk operator, U+2217 ISOtech
s.append((char) 8727);
else if (c.equals("radic"))
// square root = radical sign, U+221A ISOtech
s.append((char) 8730);
else if (c.equals("prop"))
// proportional to, U+221D ISOtech
s.append((char) 8733);
else if (c.equals("infin"))
// infinity, U+221E ISOtech -->
s.append((char) 8734);
else if (c.equals("ang"))
// angle, U+2220 ISOamso
s.append((char) 8736);
else if (c.equals("and"))
// logical and = wedge, U+2227 ISOtech
s.append((char) 8743);
else if (c.equals("or"))
// logical or = vee, U+2228 ISOtech
s.append((char) 8744);
else if (c.equals("cap"))
// intersection = cap, U+2229 ISOtech
s.append((char) 8745);
else if (c.equals("cup"))
// union = cup, U+222A ISOtech
s.append((char) 8746);
else if (c.equals("int"))
// integral, U+222B ISOtech
s.append((char) 8747);
else if (c.equals("there4"))
// therefore, U+2234 ISOtech
s.append((char) 8756);
else if (c.equals("sim"))
// tilde operator = varies with = similar t U+223C ISOtech
s.append((char) 8764);
else if (c.equals("cong"))
// approximately equal to, U+2245 ISOtec
s.append((char) 8773);
else if (c.equals("asymp"))
// almost equal to = asymptotic to, U+2248 ISOamsr
s.append((char) 8776);
else if (c.equals("ne"))
// not equal to, U+2260 ISOtech
s.append((char) 8800);
else if (c.equals("equiv"))
// identical to, U+2261 ISOtech
s.append((char) 8801);
else if (c.equals("le"))
// less-than or equal to, U+2264 ISOtech
s.append((char) 8804);
else if (c.equals("ge"))
// greater-than or equal to, U+2265 ISOtech
s.append((char) 8805);
else if (c.equals("sub"))
// subset of, U+2282 ISOtech
s.append((char) 8834);
else if (c.equals("sup"))
// superset of, U+2283 ISOtech
s.append((char) 8835);
else if (c.equals("nsub"))
// not a subset of, U+2284 ISOamsn
s.append((char) 8836);
else if (c.equals("sube"))
// subset of or equal to, U+2286 ISOtech
s.append((char) 8838);
else if (c.equals("supe"))
// superset of or equal to, U+2287 ISOtech
s.append((char) 8839);
else if (c.equals("oplus"))
// circled plus = direct sum, U+2295 ISOamsb
s.append((char) 8853);
else if (c.equals("otimes"))
// circled times = vector product, U+2297 ISOamsb -->
s.append((char) 8855);
else if (c.equals("perp"))
// up tack = orthogonal to = perpendicular, U+22A5 ISOtech
s.append((char) 8869);
else if (c.equals("sdot"))
// dot operator, U+22C5 ISOamsb
s.append((char) 8901);
else if (c.equals("lceil"))
// left ceiling = apl upstile, U+2308 ISOamsc
s.append((char) 8968);
else if (c.equals("rceil"))
// right ceiling, U+2309 ISOamsc
s.append((char) 8969);
else if (c.equals("lfloor"))
// left floor = apl downstile, U+230A ISOamsc
s.append((char) 8970);
else if (c.equals("rfloor"))
// right floor, U+230B ISOamsc
s.append((char) 8971);
else if (c.equals("lang"))
// left-pointing angle bracket = bra, U+2329 ISOtech
s.append((char) 9001);
else if (c.equals("rang"))
// right-pointing angle bracket = ket, U+232A ISOtech
s.append((char) 9002);
else if (c.equals("loz"))
// lozenge, U+25CA ISOpub
s.append((char) 9674);
else if (c.equals("spades"))
// black spade suit, U+2660 ISOpub
s.append((char) 9824);
else if (c.equals("clubs"))
// black club suit = shamrock, U+2663 ISOpub
s.append((char) 9827);
else if (c.equals("hearts"))
// black heart suit = valentine, U+2665 ISOpub
s.append((char) 9829);
else if (c.equals("diams"))
// black diamond suit, U+2666 ISOpub --
s.append((char) 9830);
else if (c.equals("ndash"))
s.append((char) 8211);
else if (c.equals("mdash"))
s.append((char) 8212);
else if (c.equals("ldquo"))
s.append((char) 8221);
else if (c.equals("rdquo"))
s.append((char) 201D);
else if (c.equals("frac14"))
s.append((char) 188);
else if (!mustBeWellFormed) {
// we guess that this is an accidentally unescaped &
s.append("&" + c);
} else {
throw new FHIRFormatError("unable to parse character reference '" + c + "'' (last text = '" + lastText + "'" + descLoc());
}
}
use of org.hl7.fhir.r4.model.Observation.ObservationStatus.FINAL in project org.hl7.fhir.core by hapifhir.
the class CachingPackageClientTests method testExists.
// private static final String SERVER2 = "http://local.fhir.org:8080/packages";
@Test
public void testExists() throws IOException {
CachingPackageClient client = new CachingPackageClient(CachingPackageClientTests.SERVER1);
Assertions.assertTrue(client.exists("hl7.fhir.r4.core", "4.0.1"));
Assertions.assertTrue(!client.exists("hl7.fhir.r4.core", "1.0.2"));
Assertions.assertTrue(client.exists("HL7.fhir.r4.core", "4.0.1"));
Assertions.assertTrue(!client.exists("hl7.fhir.nothing", "1.0.1"));
}
Aggregations