/search.css" rel="stylesheet" type="text/css"/> /search.js">
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

Public Member Functions | Private Member Functions
Scraper::adlidsensor::AdLidSensorScraper Class Reference
Inheritance diagram for Scraper::adlidsensor::AdLidSensorScraper:
Inheritance graph
[legend]
Collaboration diagram for Scraper::adlidsensor::AdLidSensorScraper:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def changed
def propagate
def seed

Private Member Functions

def _adlsdict

Detailed Description

Specialization of generic scraper for AD temperature tables

Definition at line 74 of file adlidsensor.py.


Member Function Documentation

def Scraper::adlidsensor::AdLidSensorScraper::changed (   self,
  sv 
)
returns changed decision to base class

Caution DB/SQLAlchemy is providing decimal.Decimal
values... unify types to float before comparison to avoid surprises

Definition at line 80 of file adlidsensor.py.

00081                            :
00082         """
00083         returns changed decision to base class
00084 
00085         Caution DB/SQLAlchemy is providing decimal.Decimal
00086         values... unify types to float before comparison to avoid surprises
00087         """
00088         #pd = self._adlsdict( sv[0] )
00089         #ud = self._adlsdict( sv[-1] )
00090         #log.debug("prev %s " % pd )
00091         #log.debug("curr %s " % ud )
00092         log.debug("prev %s " % sv[0] )
00093         log.debug("curr %s " % sv[-1] )
00094         log.debug("source vector length %d" % len(sv));
00095 
00096         #if not hasattr(self, 'state'):          ## only on 1st call when no state
00097         #    kls = self.target.kls               ## the genDbi target  class
00098         #    keys = kls.SpecKeys().aslist()
00099         #    state = dict(zip(keys,map(lambda _:0, keys)))    ## state dict with all values 0
00100         #    self.state = state
00101 
00102         ## work of associating source to target attributes
00103         #for k in self.state:
00104             #sk = ..some_fn..( k )       ## source key from target key
00105             ## do running aggregates  min/max/avg
00106             #self.state[k] += sv[-1][sk]
00107 
00108         return False    ## True if sufficient changes to warrant non-age based propagation 
00109 
00110 #        for adls in sorted(pd.keys()):
00111 #            pv = float(pd[adls])    ## often decimal.Decimal types
00112 #            uv = float(ud[adls])
00113 #            df = abs(pv-uv) 
00114 #            if float(df) > float(self.threshold):
00115 #                chg = True
00116 #            else:
00117 #                chg = False
00118 #            log.debug("pv %r uv %r df %r threshold %s change %s  " % (pv,uv,df, self.threshold, chg)) 
00119 #            if chg:
00120 #                return True
00121 #        return False

def Scraper::adlidsensor::AdLidSensorScraper::propagate (   self,
  sv 
)
yields one or more target dicts ready for writing to target DB

Definition at line 122 of file adlidsensor.py.

00123                             :
00124         """yields one or more target dicts ready for writing to target DB"""
00125         #dd = self._adlsdict(sv[-1])
00126         #log.debug("propagate %r " % dd)
00127         #yield self.state
00128         aggd=sv[-1].aggd
00129         assert aggd, "missing aggd - this should always be present"
00130         for k,v in sorted(aggd.items()):
00131             print k,v
00132         if aggd['NSamples']==0:
00133             kls = self.target.kls               ## the genDbi target  class
00134             keys = kls.SpecKeys().aslist()
00135             yield dict(zip(keys,map(lambda _:-1, keys))) ## state dict with all values -1
00136         else:    
00137             yield aggd

def Scraper::adlidsensor::AdLidSensorScraper::seed (   self,
  sc 
)
Used for seeding target DB when testing into empty tables

:param sc: source class, potentially different seeds will be needed 
   for each source that feeds into a single target

Definition at line 138 of file adlidsensor.py.

00139                       :
00140         """
00141         Used for seeding target DB when testing into empty tables
00142 
00143         :param sc: source class, potentially different seeds will be needed 
00144                    for each source that feeds into a single target
00145         """
00146         kls = self.target.kls               ## the genDbi target  class
00147         keys = kls.SpecKeys().aslist()
00148         return dict(zip(keys,map(lambda _:0, keys)))    ## state dict with all values 0

def Scraper::adlidsensor::AdLidSensorScraper::_adlsdict (   self,
  inst 
) [private]
converts source instance into target dicts

Definition at line 149 of file adlidsensor.py.

00150                               :
00151         """converts source instance into target dicts"""
00152         dd = {}
00153         for k,v in inst.asdict.items():
00154             if k in 'id date_time'.split():
00155                 continue
00156             #adls = self.adls_matcher(k)
00157             if adls and adls != "5":      ## SKIPPING Temp5 AS NO LONGER IN SPEC
00158                 dd['Temp%s'%adls] = v
00159         return dd 
00160 


The documentation for this class was generated from the following file:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Fri May 16 2014 09:50:03 for Scraper by doxygen 1.7.4