Next / Previous / Contents / TCC Help System / NM Tech homepage

Abstract

Describes the implementation of an automated system for producing reports displaying Christmas Bird Count data.

This publication is available in Web form and also as a PDF document. Please forward any comments to john@nmt.edu.

Table of Contents

1. Introduction
2. Requirements
3. Functional design
3.1. Alias sets
3.2. The art of combining circles
4. Page designs
4.1. Layout of the top page
4.2. General controls on the regional index page
4.3. Format of regional page entries
4.4. The detail history report
4.5. CSS considerations in page design
4.6. The PDF history report
5. Data structure design
5.1. Data structures for the regional index page
5.2. Data structures for the history detail report
6. pickaregion.cgi: Select a region
6.1. pickaregion.cgi: Prologue
6.2. pickaregion.cgi: Imports
6.3. pickaregion.cgi: Manifest constants
6.4. pickaregion.cgi: main()
6.5. buildEmptyPage(): Set up an empty page
6.6. buildRegionsForm(): Build the table of region radiobuttons
6.7. addRadios(): Add regional selection radiobuttons
6.8. buildRow(): Build one row of region radiobuttons
6.9. buildRegionCell(): Build one cell of the region radiobuttons table
6.10. pickaregion.cgi: Epilogue
7. topform.py: Form constants for the top-level page
8. regx.cgi: Generate a region index page
8.1. regx.cgi: Prologue
8.2. regx.cgi: Imports
8.3. regx.cgi: main()
8.4. regx.cgi: buildEmptyPage(): Set up an empty page
8.5. regx.cgi: buildRegionsForm: Build the regional index form
8.6. regx.cgi: buildRegionTitles(): Set up the titles for the selected region
8.7. regx.cgi: startForm(): Set up the form and static controls
8.8. regx.cgi: buildIndexSection(): Add the primary and secondary index entries
8.9. regx.cgi: buildEntries(): Build all the BaseIndex instances
8.10. regx.cgi: buildCircle(): Build entries for one circle center
8.11. regx.cgi: addSecondaries(): Generate secondary index entries for one circle
8.12. class RegArgs: The CGI arguments
8.13. RegArgs.__init__()
8.14. regx.cgi: Epilogue
9. regform.py: Form constants for the regional index page
10. hist.cgi: Generate a history detail page
10.1. hist.cgi: Overall flow
10.2. hist.cgi: Prologue
10.3. hist.cgi: Imports
10.4. hist.cgi: Manifest constants
10.5. hist.cgi: main()
10.6. fullErrorPage()
10.7. hist.cgi: findCircles: Pull the circle records from the database
10.8. hist.cgi: findHistory(): Pull the effort and census records
10.9. hist.cgi: buildXhtml()
10.10. hist.cgi: buildXhtmlBody(): Main report logic
10.11. hist.cgi: buildHeadings()
10.12. hist.cgi: findEfforts(): Locate selected effort records
10.13. hist.cgi: buildFilter—Set up census record filtration
10.14. hist.cgi: updateAbbrs()
10.15. hist.cgi: updateSimpleAbbrs()
10.16. hist.cgi: updateCompoundAbbrs
10.17. hist.cgi: fixOldAbbr(): Update an outdated bird code
10.18. hist.cgi: subspLumper()—Lump subspecies
10.19. hist.cgi: lumpCompoundForm
10.20. hist.cgi: lumpSimpleForm
10.21. hist.cgi: outputAllRows(): Build the body of the table
10.22. hist.cgi: buildPdf(): Render the report as a PDF file
10.23. hist.cgi: foPhase(): Create the PDF report
10.24. hist.cgi: foWrite()
10.25. hist.cgi: foMasters(): Set up the XSL-FO page layout
10.26. hist.cgi: simpleMaster()
10.27. hist.cgi: foStatic(): Add running headers and footers
10.28. hist.cgi: foHeader(): Set up a header
10.29. hist.cgi: foContent(): Generate the index and main table
10.30. hist.cgi: foTable(): Format the main table
10.31. hist.cgi: foTableStart(): Build the table preamble
10.32. hist.cgi: foTableColumns()
10.33. hist.cgi: foTableHeader(): Generate the table's running heads
10.34. hist.cgi: foTableBody()
10.35. hist.cgi: foColophon(): Add credits
10.36. hist.cgi: convertToPdf
10.37. class HistArgs(): CGI argument processing
10.38. HistArgs.__init__()
10.39. HistArgs._findLatLons(): Check all lat-lon arguments
10.40. HistArgs._allSelected(): Report on selected circles
10.41. HistArgs._checkLatLon(): Check one lat-lon argument
10.42. hist.cgi: Epilogue
11. cbchistlib.py: Prologue
12. cbchistlib.py: Imports
13. cbchistlib.py: Manifest constants
13.1. CGI form constants
13.2. Descriptive color names
13.3. Functional color names
13.4. CSS constants
13.5. Unicode constants
13.6. Database constants
13.7. Report layout constants
13.8. XHTML constants
13.9. Fonts for XSL-FO use
13.10. XSL-FO layout constants
13.11. XSL-FO attributes
14. Specification functions
14.1. census-filter
14.2. class-dict
14.3. row-key
14.4. year-number
15. class ScriptError: Our exception
16. openDatabase(): Open the CBC database
17. buildErrorPage()
18. buildErrorSox()
19. addDocLink(): Add a link to the documentation
20. addDocLinkSox(): Add a link to the documentation (sox version)
21. class BaseIndex: Base class for regional page index entries
21.1. BaseIndex.__init__()
21.2. BaseIndex.__cmp__(): Comparator
22. class PriIndex: Primary regional index entry
22.1. PriIndex.__init__()
22.2. PriIndex.effByYear(): Sorting function for effort records
22.3. PriIndex.html()
22.4. PriIndex.htmlMain: First line of the primary index entry
22.5. PriIndex.soxMain()
22.6. PriIndex.foMain(): Generate a primary index as XSL-FO
22.7. PriIndex.htmlAs(): Generate primary “As” entries
22.8. PriIndex._buildAs(): Build an “As” line
22.9. PriIndex._htmlOverlaps(): Generate primary “Overlaps” index entries
22.10. PriIndex._overlapEntry(): Generate one overlap line
23. class SecIndex: Secondary regional index entry
23.1. SecIndex.__init__()
23.2. SecIndex.html()
24. yearBrackets(): Display a bracketed list of years worked
25. countValues(): Summarize a list of years
26. peelGroup(): Find the first date group in a list
27. latLonFormat(): Present the center coordinates in standard format
28. class CbcHist: The history class
28.1. CbcHist.nPhysCols(): How many physical detail columns will this occupy?
28.2. CbcHist.nCensusRows(): How many census rows are there?
28.3. CbcHist.genCensusRows(): Generate the census rows in self
28.4. CbcHist.colLabel(): Retrieve a column label
28.5. CbcHist.findColumn()
28.6. CbcHist.genColLabels(): Generate the logical column labels
28.7. CbcHist.__init__()
28.8. CbcHist._buildCensusRows(): Build the census rows
28.9. CbcHist._addOneEffort()
28.10. CbcHist._addOneCensus()
28.11. CbcHist._rowKey(): What is the ._rowMap key for this census record?
29. class Row: Abstract class for logical rows
29.1. Row.__init__()
29.2. Row.nPhysRows(): How many physical rows will this logical row occupy?
29.3. Row.nPhysCols(): How many physical columns?
29.4. Row.fold(): Fold a logical row into physical rows
29.5. Row._setSuffixCells(): Copy the suffix cells to physical rows
29.6. Row.html(): Render a logical row into XHTML
29.7. Row.fo(): Render as XSL-FO
30. class KeyRow: The first heading line
30.1. KeyRow.__init__()
30.2. KeyRow.suffixes()
31. class StatRow: Parent class for rows with statistics
31.1. StatRow.suffixes(): Compute statistics
32. class PartyHoursRow: Heading row showing total effort
32.1. PartyHoursRow.__init__()
32.2. PartyHoursRow._sumEfforts(): Find all the party-hours for a logical column
33. class RowLabel: Base class for row labels
33.1. RowLabel.__init__()
33.2. RowLabel.html()
33.3. RowLabel.fo()
33.4. RowLabel.foRowSpan()
34. class CensusRow: Numbers of individuals
34.1. CensusRow.__init__()
34.2. CensusRow.addCensus(): Accumulate data from one census record
35. class HeadRowLabel: Row label for a heading
35.1. HeadRowLabel.html(): Render a heading row label as XHTML
35.2. HeadRowLabel.fo(): Render as XSL-FO
36. class CensusRowLabel: Row label for kinds of birds
36.1. CensusRowLabel.__init__()
36.2. CensusRowLabel.html()
36.3. CensusRowLabel._htmlSimple()
36.4. CensusRowLabel._htmlCompound()
36.5. CensusRowLabel.fo()
36.6. CensusRowLabel._foSimple(): Render a simple name as XSL-FO
36.7. CensusRowLabel.foCompound()
36.8. CensusRowLabel._foBirdName()
36.9. CensusRowLabel._foItalicize(): Render in italics
36.10. CensusRowLabel._foRealQuotes()
37. class Cell: Base class for table cells
38. class LabelCell: Column label cell
38.1. LabelCell.__init__()
38.2. LabelCell.html()
38.3. LabelCell.fo(): XSL-FO rendering
39. class SpacerCell: Empty cell
39.1. SpacerCell.html()
39.2. SpacerCell.fo()
40. class NumberCell: Base class for numeric table cells
41. class PartyHoursCell: Heading row showing effort
41.1. PartyHoursCell.__init__()
41.2. PartyHoursCell.add(): Accumulate party-hours
41.3. PartyHoursCell.__float__()
41.4. PartyHoursCell.html()
41.5. PartyHoursCell.fo()
42. class CensusCell: Accumulator for counts of individual birds
42.1. CensusCell.__init__()
42.2. CensusCell.add(): Accumulate data from one census record
42.3. CensusCell.html()
42.4. CensusCell._display()
42.5. CensusCell.__float__()
42.6. CensusCell.fo()
43. class CensusTotal: Number of individuals in one category
43.1. CensusTotal.__init__()
43.2. CensusTotal.add(): Accumulate one count of individuals
43.3. CensusTotal.html()
43.4. CensusTotal.__float__()
44. class StatCell: Display a statistic
44.1. StatCell.__init__()
44.2. StatCell.html()
44.3. StatCell._display(): What text should appear?
44.4. StatCell.fo()
45. class PhysRow: One physical row
45.1. PhysRow.__init__()
45.2. PhysRow.setLabel()
45.3. PhysRow.setCell(): Set up a detail cell
45.4. PhysRow.html(): Render as XHTML
45.5. PhysRow.fo(): Render as XSL-FO
45.6. PhysRow._rowAttributes(): Decorate a physical row
46. class ColumnLayout: Column layout controller
47. class LumpedLayout: Column layout for lumped years
47.1. LumpedLayout.__init__(): Constructor
47.2. LumpedLayout.findColumn()
47.3. LumpedLayout.label()
48. class SplitLayout: Column layout for split years
48.1. SplitLayout.__init__()
48.2. SplitLayout.findColumn()
48.3. SplitLayout.label()
49. class EffortKey: A unique key for the effort table
49.1. EffortKey.__init__()
49.2. EffortKey.__cmp__()
49.3. EffortKey.__str__()
50. FOR(): Build a “for=” attribute
51. divCeil(): Discrete rounding function
52. anchorName(): Format a page anchor
53. latLonKey(): Generate the lat-lon key for a given circle
54. yearCheck(): Validate a year number form entry
55. aliasFactory
56. nmAlias(): The New Mexico alias set
57. meanSigma(): Compute statistics
58. statNumber(): Display a float without too much precision
59. combineCss(): Combine CSS classes from different sources
60. The CSS-2 stylesheet
60.1. div.pri-div
60.2. span.pri-name
60.3. span.lat-lon
60.4. span.year-list
60.5. div.as-div
60.6. div.sec-div
60.7. span.sec-name
60.8. table.tb
60.9. td.col
60.10. div.hrl
60.11. td.crl
60.12. css-th-ph-cell
60.13. css-td-stat-cell
60.14. css-td-spacer-cell
60.15. td.cc
60.16. td.c1
60.17. th.c1
60.18. td.cl
60.19. td.ct
60.20. th.cl
60.21. th.ct
61. Directions for future work
61.1. Flexible aliasing
61.2. Rigorous comparability option
61.3. Overlap control
61.4. Alternate output formats
61.5. Nonparametric rank statistic for detecting low and high numbers