use of org.hl7.fhir.dstu3.model.Account in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeChargeItem.
protected void composeChargeItem(Complex parent, String parentType, String name, ChargeItem element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeDomainResource(t, "ChargeItem", name, element, index);
if (element.hasIdentifier())
composeIdentifier(t, "ChargeItem", "identifier", element.getIdentifier(), -1);
for (int i = 0; i < element.getDefinition().size(); i++) composeUri(t, "ChargeItem", "definition", element.getDefinition().get(i), i);
if (element.hasStatusElement())
composeEnum(t, "ChargeItem", "status", element.getStatusElement(), -1);
for (int i = 0; i < element.getPartOf().size(); i++) composeReference(t, "ChargeItem", "partOf", element.getPartOf().get(i), i);
if (element.hasCode())
composeCodeableConcept(t, "ChargeItem", "code", element.getCode(), -1);
if (element.hasSubject())
composeReference(t, "ChargeItem", "subject", element.getSubject(), -1);
if (element.hasContext())
composeReference(t, "ChargeItem", "context", element.getContext(), -1);
if (element.hasOccurrence())
composeType(t, "ChargeItem", "occurrence", element.getOccurrence(), -1);
for (int i = 0; i < element.getParticipant().size(); i++) composeChargeItemChargeItemParticipantComponent(t, "ChargeItem", "participant", element.getParticipant().get(i), i);
if (element.hasPerformingOrganization())
composeReference(t, "ChargeItem", "performingOrganization", element.getPerformingOrganization(), -1);
if (element.hasRequestingOrganization())
composeReference(t, "ChargeItem", "requestingOrganization", element.getRequestingOrganization(), -1);
if (element.hasQuantity())
composeQuantity(t, "ChargeItem", "quantity", element.getQuantity(), -1);
for (int i = 0; i < element.getBodysite().size(); i++) composeCodeableConcept(t, "ChargeItem", "bodysite", element.getBodysite().get(i), i);
if (element.hasFactorOverrideElement())
composeDecimal(t, "ChargeItem", "factorOverride", element.getFactorOverrideElement(), -1);
if (element.hasPriceOverride())
composeMoney(t, "ChargeItem", "priceOverride", element.getPriceOverride(), -1);
if (element.hasOverrideReasonElement())
composeString(t, "ChargeItem", "overrideReason", element.getOverrideReasonElement(), -1);
if (element.hasEnterer())
composeReference(t, "ChargeItem", "enterer", element.getEnterer(), -1);
if (element.hasEnteredDateElement())
composeDateTime(t, "ChargeItem", "enteredDate", element.getEnteredDateElement(), -1);
for (int i = 0; i < element.getReason().size(); i++) composeCodeableConcept(t, "ChargeItem", "reason", element.getReason().get(i), i);
for (int i = 0; i < element.getService().size(); i++) composeReference(t, "ChargeItem", "service", element.getService().get(i), i);
for (int i = 0; i < element.getAccount().size(); i++) composeReference(t, "ChargeItem", "account", element.getAccount().get(i), i);
for (int i = 0; i < element.getNote().size(); i++) composeAnnotation(t, "ChargeItem", "note", element.getNote().get(i), i);
for (int i = 0; i < element.getSupportingInformation().size(); i++) composeReference(t, "ChargeItem", "supportingInformation", element.getSupportingInformation().get(i), i);
}
use of org.hl7.fhir.dstu3.model.Account in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeAccountCoverageComponent.
protected void composeAccountCoverageComponent(Complex parent, String parentType, String name, Account.CoverageComponent element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeBackboneElement(t, "coverage", name, element, index);
if (element.hasCoverage())
composeReference(t, "Account", "coverage", element.getCoverage(), -1);
if (element.hasPriorityElement())
composePositiveInt(t, "Account", "priority", element.getPriorityElement(), -1);
}
use of org.hl7.fhir.dstu3.model.Account in project org.hl7.fhir.core by hapifhir.
the class Tester method main.
public static void main(String[] args) throws Exception {
IWorkerContext context = SimpleWorkerContext.fromPack(Utilities.path("C:\\work\\org.hl7.fhir\\build\\publish", "validation-min.xml.zip"));
int t = 0;
int ok = 0;
for (String f : new File("C:\\work\\org.hl7.fhir\\build\\publish").list()) {
if (f.endsWith(".xml") && !f.endsWith(".canonical.xml") && !f.contains("profile") && !f.contains("questionnaire") && new File("C:\\work\\org.hl7.fhir\\build\\publish\\" + Utilities.changeFileExt(f, ".ttl")).exists()) {
// if (f.equals("account-questionnaire.xml")) {
System.out.print("convert " + f);
// Manager.convert(context, new FileInputStream("C:\\work\\org.hl7.fhir\\build\\publish\\"+f), FhirFormat.XML,
// new FileOutputStream("C:\\work\\org.hl7.fhir\\build\\publish\\"+Utilities.changeFileExt(f, ".mm.json")), FhirFormat.JSON, OutputStyle.PRETTY);
// String src = normalise(TextFile.fileToString("C:\\work\\org.hl7.fhir\\build\\publish\\"+Utilities.changeFileExt(f, ".mm.json")));
// String tgt = normalise(TextFile.fileToString("C:\\work\\org.hl7.fhir\\build\\publish\\"+Utilities.changeFileExt(f, ".json")));
Element e = Manager.parse(context, new FileInputStream("C:\\work\\org.hl7.fhir\\build\\publish\\" + f), FhirFormat.XML);
Manager.compose(context, e, new FileOutputStream("C:\\work\\org.hl7.fhir\\build\\publish\\" + Utilities.changeFileExt(f, ".mm.ttl")), FhirFormat.TURTLE, OutputStyle.PRETTY, null);
Manager.compose(context, e, new FileOutputStream(Utilities.path("[tmp]", "resource.xml")), FhirFormat.XML, OutputStyle.PRETTY, null);
String src = TextFile.fileToString("C:\\work\\org.hl7.fhir\\build\\publish\\" + Utilities.changeFileExt(f, ".mm.ttl"));
String tgt = TextFile.fileToString("C:\\work\\org.hl7.fhir\\build\\publish\\" + Utilities.changeFileExt(f, ".ttl"));
t++;
if (src.equals(tgt)) {
System.out.println(".. ok");
ok++;
} else
System.out.println(".. fail");
}
// }
}
System.out.println("done - " + Integer.toString(t) + " files, " + Integer.toString(ok) + " ok");
}
use of org.hl7.fhir.dstu3.model.Account in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeAccountGuarantorComponent.
protected void composeAccountGuarantorComponent(Complex parent, String parentType, String name, Account.GuarantorComponent element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeBackboneElement(t, "guarantor", name, element, index);
if (element.hasParty())
composeReference(t, "Account", "party", element.getParty(), -1);
if (element.hasOnHoldElement())
composeBoolean(t, "Account", "onHold", element.getOnHoldElement(), -1);
if (element.hasPeriod())
composePeriod(t, "Account", "period", element.getPeriod(), -1);
}
use of org.hl7.fhir.dstu3.model.Account in project org.hl7.fhir.core by hapifhir.
the class ShExGenerator method genShapeDefinition.
/**
* Emit a ShEx definition for the supplied StructureDefinition
* @param sd Structure definition to emit
* @return ShEx definition
*/
private String genShapeDefinition(StructureDefinition sd, boolean isResource) {
ST resource_decl = tmplt(RESOURCE_DECL_TEMPLATE);
ST struct_def = tmplt(SHAPE_DEFINITION_TEMPLATE);
// todo: Figure out why this doesn't identify "Account" as a resource. getResourceNames() returns "Resource", "Resource"
// this.context.getResourceNames().contains(sd.getId())
resource_decl.add("id", sd.getId());
struct_def.add("resourceDecl", isResource ? resource_decl.render() : "");
struct_def.add("id", sd.getId());
List<String> elements = new ArrayList<String>();
for (ElementDefinition ed : sd.getSnapshot().getElement()) {
if (StringUtils.countMatches(ed.getPath(), ".") == 1) {
elements.add(genElementDefinition(sd, ed));
}
}
struct_def.add("elements", StringUtils.join(elements, ",\n\t"));
return struct_def.render();
}
Aggregations