Skip to content

Commit b6147b3

Browse files
committed
Improve CI: Update dependency versions, fix timestamp logic, and enhance test discovery
1 parent 490972e commit b6147b3

3 files changed

Lines changed: 18 additions & 17 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ jobs:
3131
3232
- name: Run tests
3333
run: |
34-
python -m unittest discover mapper/tests
34+
export PYTHONPATH=$PYTHONPATH:.
35+
python -m unittest discover -v mapper/tests
3536
3637
lint:
3738
runs-on: ubuntu-latest

mapper/process.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,20 +55,20 @@ def process_file(file_path: str, output_file: str, metrics: Optional[List[str]],
5555
# Original logic for timestamp construction
5656
# Assumes 'Timestamp' might be HH:MM:SS.mmm or similar
5757
ts_str = str(row['Timestamp'])
58-
try:
59-
# Basic attempt to see if it's already a full ISO string
60-
pd.to_datetime(ts_str)
61-
time_value = ts_str
62-
except (ValueError, TypeError):
63-
# Fallback to the prepending logic from original scripts
64-
# Extracts HH:MM:SS and .mmm if possible
58+
59+
# Check if it looks like just a time (e.g., HH:MM:SS.mmm)
60+
# A full ISO timestamp should have a date part (e.g., YYYY-MM-DD)
61+
if len(ts_str) < 15 or 'T' not in ts_str and ts_str.count('-') < 2:
62+
# Prepend the current date
6563
parts = ts_str.split()
6664
time_part = parts[-1] if parts else ts_str
6765
time_value = f"{date_prefix}T{time_part}"
6866
if '.' not in time_value:
69-
time_value += ".000Z"
70-
elif not time_value.endswith('Z'):
67+
time_value += ".000"
68+
if not time_value.endswith('Z'):
7169
time_value += 'Z'
70+
else:
71+
time_value = ts_str
7272

7373
event: Dict[str, Any] = {
7474
'sourceId': row['Sensor'],

pyproject.toml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ authors = [
1313
]
1414
license = { text = "MIT" }
1515
dependencies = [
16-
"numpy==1.23.4",
17-
"pandas==1.5.0",
18-
"pyarrow==9.0.0",
19-
"python-dateutil==2.8.2",
20-
"pytz==2022.5",
21-
"six==1.16.0",
22-
"toml==0.10.2",
16+
"numpy>=1.23.4,<2.0.0",
17+
"pandas>=1.5.0",
18+
"pyarrow>=9.0.0",
19+
"python-dateutil>=2.8.2",
20+
"pytz>=2022.5",
21+
"six>=1.16.0",
22+
"toml>=0.10.2",
2323
]
2424

2525
[project.optional-dependencies]

0 commit comments

Comments
 (0)