Search in sources :

Example 26 with Account

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);
    for (int i = 0; i < element.getIdentifier().size(); i++) composeIdentifier(t, "ChargeItem", "identifier", element.getIdentifier().get(i), i);
    for (int i = 0; i < element.getDefinitionUri().size(); i++) composeUri(t, "ChargeItem", "definitionUri", element.getDefinitionUri().get(i), i);
    for (int i = 0; i < element.getDefinitionCanonical().size(); i++) composeCanonical(t, "ChargeItem", "definitionCanonical", element.getDefinitionCanonical().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.getPerformer().size(); i++) composeChargeItemChargeItemPerformerComponent(t, "ChargeItem", "performer", element.getPerformer().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.hasCostCenter())
        composeReference(t, "ChargeItem", "costCenter", element.getCostCenter(), -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);
    if (element.hasProduct())
        composeType(t, "ChargeItem", "product", element.getProduct(), -1);
    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);
}
Also used : Complex(org.hl7.fhir.r4.utils.formats.Turtle.Complex)

Example 27 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 = 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");
}
Also used : IWorkerContext(org.hl7.fhir.r4.context.IWorkerContext) JsonElement(com.google.gson.JsonElement) FileOutputStream(java.io.FileOutputStream) File(java.io.File) TextFile(org.hl7.fhir.utilities.TextFile) FileInputStream(java.io.FileInputStream)

Example 28 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 = 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.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.r4b.context.IWorkerContext) JsonElement(com.google.gson.JsonElement) NamedElement(org.hl7.fhir.r4b.elementmodel.ParserBase.NamedElement) FileOutputStream(java.io.FileOutputStream) File(java.io.File) TextFile(org.hl7.fhir.utilities.TextFile) FileInputStream(java.io.FileInputStream)

Example 29 with Account

use of org.hl7.fhir.dstu3.model.Account in project googleads-adsense-examples by googleads.

the class GetAllAccounts method run.

/**
 * Runs this sample.
 *
 * @param adsense AdSense service object on which to run the requests.
 * @param maxPageSize the maximum page size to retrieve.
 * @return the retrieved accounts.
 * @throws Exception
 */
public static List<Account> run(Adsense adsense, int maxPageSize) throws Exception {
    System.out.println("=================================================================");
    System.out.println("Listing all AdSense accounts");
    System.out.println("=================================================================");
    List<Account> allAccounts = new ArrayList<Account>();
    // Retrieve account list in pages and display data as we receive it.
    String pageToken = null;
    do {
        ListAccountsResponse response = null;
        response = adsense.accounts().list().setPageSize(maxPageSize).setPageToken(pageToken).execute();
        List<Account> accounts = response.getAccounts();
        if (accounts != null && !accounts.isEmpty()) {
            allAccounts.addAll(accounts);
            for (Account account : accounts) {
                System.out.printf("Account with ID \"%s\" and name \"%s\" was found.\n", account.getName(), account.getDisplayName());
            }
        } else {
            System.out.println("No accounts found.");
        }
        pageToken = response.getNextPageToken();
    } while (pageToken != null);
    System.out.println();
    return allAccounts;
}
Also used : Account(com.google.api.services.adsense.v2.model.Account) ListAccountsResponse(com.google.api.services.adsense.v2.model.ListAccountsResponse) ArrayList(java.util.ArrayList)

Example 30 with Account

use of org.hl7.fhir.dstu3.model.Account in project googleads-adsense-examples by googleads.

the class AdSenseSample method main.

/**
 * Runs all the AdSense Management API samples.
 *
 * @param args command-line arguments.
 */
public static void main(String[] args) {
    try {
        httpTransport = GoogleNetHttpTransport.newTrustedTransport();
        dataStoreFactory = new FileDataStoreFactory(DATA_STORE_DIR);
        Adsense adsense = initializeAdsense();
        List<Account> accounts = GetAllAccounts.run(adsense, MAX_LIST_PAGE_SIZE);
        if ((accounts != null) && !accounts.isEmpty()) {
            // Get an example account ID, so we can run the following sample.
            String chosenAccount = chooseAccount(accounts);
            GetAccountTree.run(adsense, chosenAccount);
            List<AdClient> adClients = GetAllAdClients.run(adsense, chosenAccount, MAX_LIST_PAGE_SIZE);
            if ((adClients != null) && !adClients.isEmpty()) {
                // Get an ad client ID, so we can run the rest of the samples.
                String exampleAdClientId = adClients.get(6).getName();
                List<AdUnit> units = GetAllAdUnits.run(adsense, exampleAdClientId, MAX_LIST_PAGE_SIZE);
                if ((units != null) && !units.isEmpty()) {
                    // Get an example ad unit ID, so we can run the following sample.
                    String exampleAdUnitId = units.get(0).getName();
                    GetAllCustomChannelsForAdUnit.run(adsense, exampleAdUnitId, MAX_LIST_PAGE_SIZE);
                }
                List<CustomChannel> channels = GetAllCustomChannels.run(adsense, exampleAdClientId, MAX_LIST_PAGE_SIZE);
                if ((channels != null) && !channels.isEmpty()) {
                    // Get an example custom channel ID, so we can run the following sample.
                    String exampleCustomChannelId = channels.get(1).getName();
                    GetAllAdUnitsForCustomChannel.run(adsense, exampleCustomChannelId, MAX_LIST_PAGE_SIZE);
                }
                GetAllUrlChannels.run(adsense, exampleAdClientId, MAX_LIST_PAGE_SIZE);
                GenerateReport.run(adsense, chosenAccount, exampleAdClientId);
            } else {
                System.out.println("No ad clients found, unable to run remaining methods.");
            }
            List<SavedReport> savedReports = GetAllSavedReports.run(adsense, chosenAccount, MAX_LIST_PAGE_SIZE);
            if ((savedReports != null) && !savedReports.isEmpty()) {
                // Get a saved report ID, so we can generate its report.
                String exampleSavedReportId = savedReports.get(0).getName();
                GenerateSavedReport.run(adsense, exampleSavedReportId);
            } else {
                System.out.println("No saved report found.");
            }
            GetAllAlerts.run(adsense, chosenAccount);
        }
    } catch (IOException e) {
        System.err.println(e.getMessage());
    } catch (Throwable t) {
        t.printStackTrace();
    }
}
Also used : Account(com.google.api.services.adsense.v2.model.Account) SavedReport(com.google.api.services.adsense.v2.model.SavedReport) IOException(java.io.IOException) FileDataStoreFactory(com.google.api.client.util.store.FileDataStoreFactory) AdUnit(com.google.api.services.adsense.v2.model.AdUnit) Adsense(com.google.api.services.adsense.v2.Adsense) AdClient(com.google.api.services.adsense.v2.model.AdClient) CustomChannel(com.google.api.services.adsense.v2.model.CustomChannel)

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