Skip to content

Commit 81ab4ad

Browse files
authored
Merge pull request #9 from lycosystem/release-0.3.3
Release 0.3.3
2 parents 411657c + 8598520 commit 81ab4ad

5 files changed

Lines changed: 21 additions & 10 deletions

File tree

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,17 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## [0.3.3] - 2025-07-22
6+
7+
### 🚀 Features
8+
9+
- Add simple utility to detect if dataset uses old 2nd level headers.
10+
11+
### 💼 Other
12+
13+
- Make `use_github=True` default everywhere
14+
- Simplify `Q`'s query execution a bit
15+
516
## [0.3.2] - 2025-07-22
617

718
### 🚀 Features

src/lydata/accessor.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,6 @@ def __init__(
162162
self.colname = column
163163
self.operator = operator
164164
self.value = value
165-
self._column_map = get_default_column_map_old()
166165

167166
def __repr__(self) -> str:
168167
"""Return a string representation of the query."""
@@ -183,12 +182,7 @@ def execute(self, df: pd.DataFrame) -> pd.Series:
183182
2 True
184183
Name: col2, dtype: bool
185184
"""
186-
try:
187-
colname = self._column_map.from_short[self.colname].long
188-
except KeyError:
189-
colname = self.colname
190-
191-
column = df[colname]
185+
column = df.ly[self.colname]
192186

193187
if callable(self.value):
194188
return self.value(column)

src/lydata/loader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def get_content_file(
143143

144144
def get_dataframe(
145145
self,
146-
use_github: bool = False,
146+
use_github: bool = True,
147147
token: str | None = None,
148148
user: str | None = None,
149149
password: str | None = None,

src/lydata/utils.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ def get_default_column_map_old() -> _ColumnMap:
164164

165165

166166
def _new_from_old(long_name: tuple[str, str, str]) -> tuple[str, str, str]:
167-
"""Convert an old long name to a new long name.
167+
"""Convert an old long key name to a new long key name.
168168
169169
>>> _new_from_old(("patient", "#", "neck_dissection"))
170170
('patient', 'info', 'neck_dissection')
@@ -179,6 +179,12 @@ def _new_from_old(long_name: tuple[str, str, str]) -> tuple[str, str, str]:
179179
return (start, middle, end)
180180

181181

182+
def is_old(dataset: pd.DataFrame) -> bool:
183+
"""Check if the dataset uses the old column names."""
184+
second_lvl_headers = dataset.columns.get_level_values(1)
185+
return "#" in second_lvl_headers or "1" in second_lvl_headers
186+
187+
182188
def get_default_column_map_new() -> _ColumnMap:
183189
"""Get the old default column map.
184190

src/lydata/validator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def validate_datasets(
116116
year: int | str = "*",
117117
institution: str = "*",
118118
subsite: str = "*",
119-
use_github: bool = False,
119+
use_github: bool = True,
120120
repo: str = "lycosystem/lydata",
121121
ref: str = "main",
122122
**kwargs,

0 commit comments

Comments
 (0)