Phil 5.10.2010

7:30 – 4:30

  • Prepping for demo
  • Got dong’s war file deployed on my machine. That works, rather than building. He’s going to ask Mike to try building and see where the problem lies
  • Problems with ie today – it can’t open multiple Flex programs.
  • Spent some time getting the projmanager user working in mySql
  • better pull for errors: SELECT p.title as project, f.name as funding, o.* FROM obligations_outlays o, fundings f, projects p;
  • IngestManager problems:
    • Can’t parse special characters into column names or the values can’t be inserted properly in the column. For example, ‘2/15/60’ won’t read in at all, ‘2-15-60’ won’t have any data in the columns, and ‘2_15_60’ is a date format that Actionscript can’t recognize
    • If the XML SOLR file has CRs in the text file, they are kept, which screws up VISIBILITY. They need to be stripped.

Script to look for decreasing values in outlays:

# Strip off a column based on its name
def stripColumn(headers, table, columnName):
    newRow = []
    for item in headers:
        if item != columnName:
            newRow.append(item)
    newTable = [];
    newTable.append(newRow)
    for row in table:
        newRow = []
        for i in xrange(len(headers)):
            if headers[i] != columnName:
                newRow.append(row[i])
        newTable.append(newRow)
    return newTable

# Find a month that is less than the previous
def errorsToSolrXml(doc, root, header, table):
    for row in table:
        for i in xrange(len(row)-1):
            if header[i].count("month_") > 0:
                cur = int(float(row[i]))
                next = int(float(row[i+1]))
                #print row[0]+": "+header[i]+" = "+str(cur)
                if(cur > next):
                    #print header[i]+" = "+str(cur)+" > ("+str(next)+")"

                    errorNode = doc.createElement('doc')
                    root.appendChild(errorNode)
                    fieldNode = doc.createElement('field')
                    fieldNode.setAttribute('name', 'type')
                    textNode = doc.createTextNode(str(row[0]))
                    fieldNode.appendChild(textNode)
                    errorNode.appendChild(fieldNode)

                    fieldNode = doc.createElement('field')
                    fieldNode.setAttribute('name', 'cur_month')
                    textNode = doc.createTextNode(header[i])
                    fieldNode.appendChild(textNode)
                    errorNode.appendChild(fieldNode)

                    fieldNode = doc.createElement('field')
                    fieldNode.setAttribute('name', 'next_month')
                    textNode = doc.createTextNode(header[i+1])
                    fieldNode.appendChild(textNode)
                    errorNode.appendChild(fieldNode)

                    fieldNode = doc.createElement('field')
                    fieldNode.setAttribute('name', 'value')
                    textNode = doc.createTextNode(str(cur - next))
                    fieldNode.appendChild(textNode)
                    errorNode.appendChild(fieldNode)

#################### 'main'

impl = getDOMImplementation()

jf = ScriptFacades()
table = jf.dbQuery('project_portfolio', 'SELECT * from obligations_outlays where project_id=1 and year=2010')
tableData = table.getTable()
newTable = stripColumn(tableData[:1][0], tableData[1:], 'uid')

errorDoc = impl.createDocument(None, "add", None)
root = errorDoc.documentElement
errorsToSolrXml(errorDoc, root, newTable[:1][0], newTable[1:])
#print errorDoc.toprettyxml()
jf.publishXml("/obligation_errors.xml", errorDoc.toxml())