All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.julielab.xmlData.dataBase.SubsetStatus Maven / Gradle / Ivy

Go to download

A utility for managing documents stored in a PostgreSQL database. The documents are imported into a PostgreSQL DB as full texts with the goal to be able to retrieve the documents by their PubMedID efficiently. For more sophisticated tasks, a user configuration file can be delivered which can take control of the table schema to use, the PostgreSQL schema to use and the actual database server to connect to as well as the concrete database.

There is a newer version: 1.6.2
Show newest version
package de.julielab.xmlData.dataBase;

import java.text.DecimalFormat;
import java.util.Map.Entry;
import java.util.SortedMap;
import java.util.StringJoiner;

public class SubsetStatus {
    private static final DecimalFormat df = new DecimalFormat("#,###,###,##0.00");

    public Long total;
    public Long inProcess;
    public Long isProcessed;
    public Long hasErrors;
    public SortedMap pipelineStates;

    @Override
    public String toString() {
        StringJoiner sj = new StringJoiner(", ");
        if (hasErrors != null)
            sj.add("have errors: " + hasErrors);
        if (inProcess != null)
            sj.add("in process: " + inProcess);
        if (isProcessed != null)
            sj.add("is processed: " + isProcessed);
        if (total != null && inProcess != null && isProcessed != null)
            sj.add("untouched: " + String.valueOf(total - inProcess - isProcessed));
        if (total != null)
            sj.add("total: " + total);
        StringBuilder sb = new StringBuilder();
        sb.append(sj.toString());
        sb.append("\n");

        if (inProcess != null && total != null) {
            sb.append("   ");
            sb.append(String.valueOf(df.format(((double) inProcess / total) * 100)));
            sb.append("% in process\n");
        }

        if (isProcessed != null && total != null) {
            sb.append("   ");
            sb.append(String.valueOf(df.format(((double) isProcessed / total) * 100)));
            sb.append("% is processed\n");
        }

        if (pipelineStates != null) {
            sb.append("Pipeline states:\n");
            for (Entry entry : pipelineStates.entrySet()) {
                sb.append("  ");
                sb.append(entry.getKey());
                sb.append(":  ");
                sb.append(entry.getValue());
                sb.append("\n");
            }
        }
        return sb.toString();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy