Skip to content
bdeshong edited this page Dec 25, 2011 · 16 revisions

High-level technical requirements

  • Take full advantage of Automatic Reference Counting

  • Use blocks for NSURLConnection success/failure handling

  • Use blocks when making calls to classes that report success/failure

  • Retrieve gauges for agencies:

    • USGS
    • USACE
  • Retrieve most recent height level reading

  • Retrieve precipitation totals, if available for:

    • Past 24 hours
    • Past 7 days
    • Since date?
  • Map USGS gage ID to NWS gage ID

  • Retrieve flood stage levels from NWS for a given gauge

  • Retrieve discharge levels for USGS gauge for:

    • Past 24 hours
    • Past 7 days
    • Since date?
  • Render graph of readings with arbitrary X and Y axes

Class and interface structure

  • DFGWaterGaugeDataRequestParameters

    • gaugeID -- NSString
    • height -- BOOL
    • precipitation -- BOOL
    • discharge -- BOOL
    • delegate -- id
    • Date values -- only get most recent value if all of these are null
      • sinceDate
      • endDate
      • numDaysAgo
    • initWithGaugeID:numDaysAgo:height:precipitation:discharge:
    • initWithGaugeID:sinceDate:endDate:height:precipitation:discharge:
    • initWithGaugeIDForMostRecentReading:height:precipitation:discharge:
    • initWithGaugeIDForAllMostRecentReadings:
      • calls to method above with all BOOLs set to YES
  • DFGWaterGaugeDataRetrieverProtocol

    • Methods:
      • retrieveData:(DFGWaterGaugeDataRequestParameters*)params
    • Implementations:
      • USGS: DFGWaterUSGSGaugeDataRetriever
      • USACE: DFGWaterUSGSGaugeDataRetriever
  • DFGWaterGaugeDataRetrieverDelegateProtocol

    • retriever:willRetrieveDataForParameters:
    • retriever:didFailToRetrieveDataForParameters:
    • retriever:retrievedHeightReadings:forParameters:
    • retriever:retrievedPrecipitationReadings:forParameters:
    • retriever:retrievedDischargeReadings:forParameters:
    • retriever:didFailToRetrieveHeightReadingsForParameters:error:
    • retriever:didFailToRetrievePrecipitationReadingsForParameters:error:
    • retriever:didFailToRetrieveDischargeReadingsForParameters:error:
    • retriever:heightReadingsNotAvailableForParameters:
    • retriever:precipitationReadingsNotAvailableForParameters:
    • retriever:dischargeReadingsNotAvailableForParameters:
  • DFGWaterReading

    • initWithValue:(NSString*)value
    • initWithValue:atDate:
    • value -- NSString
    • date -- NSDate

Use cases

  1. What's the current height at gauge XXXXX?
    • Create params object: initWithGaugeIDForMostRecentReading:@"02336910" height:YES precipitation:NO discharge:NO
    • Use retriever: retrieveData:params
    • Get delegate message: retriever:retrievedHeightReadings:forParameters:
  2. Give me all data available for gauge XXXXX
    • Create params object: initWithGaugeIDForMostRecentReading:@"02336910" height:YES precipitation:YES discharge:YES
    • Use retriever: retrieveData:params
    • Get delegate message: retriever:retrievedHeightReadings:forParameters:
    • Get delegate message: retriever:retrievedPrecipitationReadings:forParameters:
    • Get delegate message: retriever:retrievedDischargeReadings:forParameters:

Clone this wiki locally