ecopipeline 0.9.2__py3-none-any.whl → 0.9.4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -50,6 +50,8 @@ def flag_boundary_alarms(df: pd.DataFrame, config : ConfigManager, default_fault
50
50
  raise Exception(f"{required_column} is not present in Variable_Names.csv")
51
51
  if not 'pretty_name' in bounds_df.columns:
52
52
  bounds_df['pretty_name'] = bounds_df['variable_name']
53
+ else:
54
+ bounds_df['pretty_name'] = bounds_df['pretty_name'].fillna(bounds_df['variable_name'])
53
55
  if not 'fault_time' in bounds_df.columns:
54
56
  bounds_df['fault_time'] = default_fault_time
55
57
 
@@ -686,15 +686,16 @@ def fm_api_to_df(config: ConfigManager, startTime: datetime = None, endTime: dat
686
686
  device_id = config.get_fm_device_id()
687
687
  url = f"https://www.fieldpop.io/rest/method/fieldpop-api/deviceDataLog?happn_token={api_token}&deviceID={device_id}"
688
688
  if not startTime is None:
689
- url = f"{url}&startUTCsec={startTime.timestamp()}"
689
+ url = f"{url}&startUTCsec={int(startTime.timestamp())}"
690
690
  else:
691
691
  startTime = datetime(2000, 1, 1, 0, 0, 0) # Jan 1, 2000
692
692
  if not endTime is None:
693
- url = f"{url}&endUTCsec={endTime.timestamp()}"
693
+ url = f"{url}&endUTCsec={int(endTime.timestamp())}"
694
694
  else:
695
695
  endTime = datetime.now()
696
696
 
697
697
  try:
698
+ print(url)
698
699
  response = requests.get(url)
699
700
  if response.status_code == 200:
700
701
  df = pd.DataFrame()
@@ -728,6 +729,10 @@ def fm_api_to_df(config: ConfigManager, startTime: datetime = None, endTime: dat
728
729
  json_message = response.json()
729
730
  string_to_match = 'The log size is too large - please try again with a smaller date range.'
730
731
  if 'error' in json_message and 'message' in json_message['error'] and json_message['error']['message'] == string_to_match:
732
+ if endTime - timedelta(minutes=30) < startTime:
733
+ # if we can't retrieve less then 30 minutes of data, the dataframe is bust...
734
+ print(f"Unable to retrieve data for {startTime} - {endTime}")
735
+ return pd.DataFrame()
731
736
  # Calculate the midpoint between the two datetimes
732
737
  time_diff = endTime - startTime
733
738
  midpointTime = startTime + time_diff / 2
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ecopipeline
3
- Version: 0.9.2
3
+ Version: 0.9.4
4
4
  Summary: Contains functions for use in Ecotope Datapipelines
5
5
  Classifier: Programming Language :: Python :: 3
6
6
  Classifier: License :: OSI Approved :: GNU General Public License (GPL)
@@ -1,8 +1,8 @@
1
1
  ecopipeline/__init__.py,sha256=d48mO5La6OrQDkRe_qqoY6lUx7x-e8krOH388jmWjwU,218
2
2
  ecopipeline/event_tracking/__init__.py,sha256=hVV2IHyt3pLSIOESpINr8-sQBmK98t7CiVb1IlvE5xQ,84
3
- ecopipeline/event_tracking/event_tracking.py,sha256=Ti2OJ5cVuBOWEJjgsV0049vHv8941cYusV3Xci2MVuU,16983
3
+ ecopipeline/event_tracking/event_tracking.py,sha256=0w-dgsziC-JolqCPxiyryA9PiWKETQYZ3Gbt0faVgbI,17088
4
4
  ecopipeline/extract/__init__.py,sha256=gQ3sak6NJ63Gpo-hZXrtZfeKOTHLRyAVXfTgxxRpqPo,675
5
- ecopipeline/extract/extract.py,sha256=i5e-mL4KiJfmWMFnKwvCW_BdPELGJiYKRk6FbvcEi1U,51106
5
+ ecopipeline/extract/extract.py,sha256=y32feIIzgABwrwfduNQM1hICmkVOU4PYu6-M07zCLpU,51422
6
6
  ecopipeline/load/__init__.py,sha256=NLa_efQJZ8aP-J0Y5xx9DP7mtfRH9jY6Jz1ZMZN_BAA,292
7
7
  ecopipeline/load/load.py,sha256=Ptxr0MOjns_HeVSmZsLLApHJGB-z6XOB2m8LNiVaD7E,23860
8
8
  ecopipeline/transform/__init__.py,sha256=YveBLBsNhfI4qZP04doa0NrTbEKvjDAUDEKtEPdFPfU,2545
@@ -12,8 +12,8 @@ ecopipeline/transform/transform.py,sha256=wL4B00XBwLWVlf7goOLSHKgLFmIsXprQNepGLL
12
12
  ecopipeline/utils/ConfigManager.py,sha256=-g1wtExdvhYO5Y6Q3cRbywa__DxRMFruLrB4YanwaPY,12168
13
13
  ecopipeline/utils/__init__.py,sha256=ccWUR0m7gD9DfcgsxBCLOfi4lho6RdYuB2Ugy_g6ZdQ,28
14
14
  ecopipeline/utils/unit_convert.py,sha256=VFh1we2Y8KV3u21BeWb-U3TlZJXo83q5vdxxkpgcuME,3064
15
- ecopipeline-0.9.2.dist-info/licenses/LICENSE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
- ecopipeline-0.9.2.dist-info/METADATA,sha256=TvfyD5HUMuKdbDYtQZqr4iTg0HSNNMswtLEVXF7AZ-I,2329
17
- ecopipeline-0.9.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
18
- ecopipeline-0.9.2.dist-info/top_level.txt,sha256=WOPFJH2LIgKqm4lk2OnFF5cgVkYibkaBxIxgvLgO7y0,12
19
- ecopipeline-0.9.2.dist-info/RECORD,,
15
+ ecopipeline-0.9.4.dist-info/licenses/LICENSE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
+ ecopipeline-0.9.4.dist-info/METADATA,sha256=W1-fbJlxCCnlkqlSV5KgSvQlKuQTLYYxFvCgtQY8XFM,2329
17
+ ecopipeline-0.9.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
18
+ ecopipeline-0.9.4.dist-info/top_level.txt,sha256=WOPFJH2LIgKqm4lk2OnFF5cgVkYibkaBxIxgvLgO7y0,12
19
+ ecopipeline-0.9.4.dist-info/RECORD,,