Package gov.nysenate.openleg.processors

Examples of gov.nysenate.openleg.processors.BillProcessor$ParseError


    public HashMap<String, Change> ingestFiles(Collection<File> files)
    {
        Timer timer = new Timer();
        Storage storage = new Storage(getStorageDirectory());
        BillProcessor billProcessor = new BillProcessor();
        CalendarProcessor calendarProcessor = new CalendarProcessor();
        AgendaProcessor agendaProcessor = new AgendaProcessor();
        TranscriptProcessor transcriptProcessor = new TranscriptProcessor();

        Collections.sort((List<File>)files, new FileNameComparator());

        // Process each file individually, flushing changes to storage as necessary
        // Each file processor should produce a change log indicating what happened
        timer.start();
        for(File file : files) {
            try {
                logger.debug("Ingesting: "+file);
                String type = file.getParentFile().getName();
                if (type.equals("bills")) {
                    billProcessor.process(file, storage);
                }
                else if (type.equals("calendars")) {
                    calendarProcessor.process(file, storage);
                }
                else if (type.equals("agendas")) {
View Full Code Here


    {
        HashMap<String, Integer> errors = new HashMap<String, Integer>();
        errors.put("missing",0);
        errors.put("mismatch", 0);
        File blockFile = new File("/data/openleg/PALMER.SEN.ALL.MEMO2011.TXT");
        BillProcessor bp = new BillProcessor();
        Storage storage = Application.getStorage();
        List<SOBIBlock> blocks = bp.getBlocks(blockFile);
        for (SOBIBlock block : blocks) {
            String billNo = block.getPrintNo()+block.getAmendment()+"-"+block.getYear();
            Bill jsonBill = storage.getBill(block.getPrintNo()+block.getAmendment(), block.getYear());
            Bill lbdcBill = new Bill(billNo, block.getYear());
            bp.applyText(new String(block.getData().getBytes(), "utf-8"), lbdcBill, new Date());
            String jsonMemo = StringUtils.normalizeSpace(jsonBill.getMemo().replaceAll("-\n+ *", "").replaceAll("\n *", " ").replaceAll(" *([:,]) *", "$1").replaceAll(" *([()!\\\"]) *", " $1 ").replaceAll("([A-Za-z])- ?([A-Za-z])","$1$2").replaceAll("-", "").trim()).toLowerCase();
            String lbdcMemo = StringUtils.normalizeSpace(lbdcBill.getMemo().replaceAll("�", "§").replaceAll("-\n+ *", "").replaceAll("\n *", " ").replaceAll(" *([:,]) *", "$1").replaceAll(" *([()!\\\"]) *", " $1 ").replaceAll("([A-Za-z])- ?([A-Za-z])","$1$2").replaceAll("-", "").trim()).toLowerCase();

            if(jsonMemo.isEmpty()) {
                logger.error(billNo+": MISSING");
View Full Code Here

public class BillProcessorTests
{
    @Test
    public void testGetBlocks() throws IOException
    {
        BillProcessor processor = new BillProcessor();
        List<SOBIBlock> blocks = processor.getBlocks(new File("src/test/resources/BLOCKTEST.txt"));
        Iterator<SOBIBlock> blockIterator = blocks.iterator();
        assertEquals(new SOBIBlock("2013A03006D1Budget              00000"), blockIterator.next());
        assertEquals(new SOBIBlock("2013A03006D1Budget              00000"), blockIterator.next());
        assertEquals(new SOBIBlock("2013A03006D2Budget Bills"), blockIterator.next());
        assertEquals(new SOBIBlock("2013A03006D2Budget Bills"), blockIterator.next());
View Full Code Here

TOP

Related Classes of gov.nysenate.openleg.processors.BillProcessor$ParseError

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.