Skip to content

Commit ba373c0

Browse files
committed
refactor(pems_streamlit): use pems_data service factory
1 parent 03ceaa6 commit ba373c0

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

pems_streamlit/src/pems_streamlit/apps/stations/app_stations.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
import pandas as pd
44
import streamlit as st
55

6-
from pems_data.sources.s3 import S3DataSource
7-
from pems_data.services.stations import StationsService
6+
from pems_data import ServiceFactory
87

9-
BUCKET = S3DataSource()
10-
STATIONS = StationsService(data_source=BUCKET)
8+
FACTORY = ServiceFactory()
9+
STATIONS = FACTORY.stations_service()
10+
S3 = FACTORY.s3_source
1111

1212

1313
@st.cache_data(ttl=3600) # Cache for 1 hour
@@ -28,7 +28,7 @@ def get_available_days() -> set:
2828
def match(m: re.Match):
2929
return int(m.group(1))
3030

31-
return BUCKET.get_prefixes(pattern, initial_prefix=STATIONS.imputation_detector_agg_5min, match_func=match)
31+
return S3.get_prefixes(pattern, initial_prefix=STATIONS.imputation_detector_agg_5min, match_func=match)
3232

3333

3434
@st.cache_data(ttl=300) # Cache for 5 minutes

0 commit comments

Comments
 (0)