Search in sources :

Example 21 with Account

use of org.hl7.fhir.dstu3.model.Account in project org.hl7.fhir.core by hapifhir.

the class RdfParser method composeAccount.

protected void composeAccount(Complex parent, String parentType, String name, Account element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeDomainResource(t, "Account", name, element, index);
    for (int i = 0; i < element.getIdentifier().size(); i++) composeIdentifier(t, "Account", "identifier", element.getIdentifier().get(i), i);
    if (element.hasStatusElement())
        composeEnum(t, "Account", "status", element.getStatusElement(), -1);
    if (element.hasType())
        composeCodeableConcept(t, "Account", "type", element.getType(), -1);
    if (element.hasNameElement())
        composeString(t, "Account", "name", element.getNameElement(), -1);
    for (int i = 0; i < element.getSubject().size(); i++) composeReference(t, "Account", "subject", element.getSubject().get(i), i);
    if (element.hasServicePeriod())
        composePeriod(t, "Account", "servicePeriod", element.getServicePeriod(), -1);
    for (int i = 0; i < element.getCoverage().size(); i++) composeAccountCoverageComponent(t, "Account", "coverage", element.getCoverage().get(i), i);
    if (element.hasOwner())
        composeReference(t, "Account", "owner", element.getOwner(), -1);
    if (element.hasDescriptionElement())
        composeString(t, "Account", "description", element.getDescriptionElement(), -1);
    for (int i = 0; i < element.getGuarantor().size(); i++) composeAccountGuarantorComponent(t, "Account", "guarantor", element.getGuarantor().get(i), i);
    if (element.hasPartOf())
        composeReference(t, "Account", "partOf", element.getPartOf(), -1);
}
Also used : Complex(org.hl7.fhir.r4.utils.formats.Turtle.Complex)

Example 22 with Account

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 = new SimpleWorkerContext.SimpleWorkerContextBuilder().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.parseSingle(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");
}
Also used : IWorkerContext(org.hl7.fhir.r5.context.IWorkerContext) JsonElement(com.google.gson.JsonElement) NamedElement(org.hl7.fhir.r5.elementmodel.ParserBase.NamedElement) FileOutputStream(java.io.FileOutputStream) SimpleWorkerContext(org.hl7.fhir.r5.context.SimpleWorkerContext) File(java.io.File) TextFile(org.hl7.fhir.utilities.TextFile) FileInputStream(java.io.FileInputStream)

Example 23 with Account

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);
}
Also used : Complex(org.hl7.fhir.r4.utils.formats.Turtle.Complex)

Example 24 with Account

use of org.hl7.fhir.dstu3.model.Account in project org.hl7.fhir.core by hapifhir.

the class RdfParser method composeInvoice.

protected void composeInvoice(Complex parent, String parentType, String name, Invoice element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeDomainResource(t, "Invoice", name, element, index);
    for (int i = 0; i < element.getIdentifier().size(); i++) composeIdentifier(t, "Invoice", "identifier", element.getIdentifier().get(i), i);
    if (element.hasStatusElement())
        composeEnum(t, "Invoice", "status", element.getStatusElement(), -1);
    if (element.hasCancelledReasonElement())
        composeString(t, "Invoice", "cancelledReason", element.getCancelledReasonElement(), -1);
    if (element.hasType())
        composeCodeableConcept(t, "Invoice", "type", element.getType(), -1);
    if (element.hasSubject())
        composeReference(t, "Invoice", "subject", element.getSubject(), -1);
    if (element.hasRecipient())
        composeReference(t, "Invoice", "recipient", element.getRecipient(), -1);
    if (element.hasDateElement())
        composeDateTime(t, "Invoice", "date", element.getDateElement(), -1);
    for (int i = 0; i < element.getParticipant().size(); i++) composeInvoiceInvoiceParticipantComponent(t, "Invoice", "participant", element.getParticipant().get(i), i);
    if (element.hasIssuer())
        composeReference(t, "Invoice", "issuer", element.getIssuer(), -1);
    if (element.hasAccount())
        composeReference(t, "Invoice", "account", element.getAccount(), -1);
    for (int i = 0; i < element.getLineItem().size(); i++) composeInvoiceInvoiceLineItemComponent(t, "Invoice", "lineItem", element.getLineItem().get(i), i);
    for (int i = 0; i < element.getTotalPriceComponent().size(); i++) composeInvoiceInvoiceLineItemPriceComponentComponent(t, "Invoice", "totalPriceComponent", element.getTotalPriceComponent().get(i), i);
    if (element.hasTotalNet())
        composeMoney(t, "Invoice", "totalNet", element.getTotalNet(), -1);
    if (element.hasTotalGross())
        composeMoney(t, "Invoice", "totalGross", element.getTotalGross(), -1);
    if (element.hasPaymentTermsElement())
        composeMarkdown(t, "Invoice", "paymentTerms", element.getPaymentTermsElement(), -1);
    for (int i = 0; i < element.getNote().size(); i++) composeAnnotation(t, "Invoice", "note", element.getNote().get(i), i);
}
Also used : Complex(org.hl7.fhir.r4.utils.formats.Turtle.Complex)

Example 25 with Account

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);
}
Also used : Complex(org.hl7.fhir.r4.utils.formats.Turtle.Complex)

Aggregations

Test (org.testng.annotations.Test)17 Patient (org.hl7.fhir.dstu3.model.Patient)10 ArrayList (java.util.ArrayList)8 Appointment (org.hl7.fhir.dstu3.model.Appointment)8 Account (org.sagebionetworks.bridge.models.accounts.Account)8 Complex (org.hl7.fhir.r4.utils.formats.Turtle.Complex)7 StatusMessage (org.sagebionetworks.bridge.models.StatusMessage)7 IOException (java.io.IOException)6 DateRangeResourceList (org.sagebionetworks.bridge.models.DateRangeResourceList)6 Account (com.google.api.services.adsense.v2.model.Account)5 JsonElement (com.google.gson.JsonElement)5 ProcedureRequest (org.hl7.fhir.dstu3.model.ProcedureRequest)5 Complex (org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)5 HealthDataSubmission (org.sagebionetworks.bridge.models.healthdata.HealthDataSubmission)5 Account (Model.Account)4 File (java.io.File)4 FileInputStream (java.io.FileInputStream)4 FileOutputStream (java.io.FileOutputStream)4 Account (model.Account)4 ContactPoint (org.hl7.fhir.dstu3.model.ContactPoint)4