Skip to content

Commit cec50c0

Browse files
Use basename for sqlite import.sh table names.
Nested paths like hosp/admissions.csv.gz became table hosp/admissions. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 5bdb9a0 commit cec50c0

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

mimic-iv/buildmimic/sqlite/import.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ fi
2424
for FILE in */**.csv*; do
2525
# skip loop if glob didn't match an actual file
2626
[ -f "$FILE" ] || continue
27-
# trim off extension and lowercase file stem (e.g., HELLO.csv -> hello)
28-
TABLE_NAME=$(echo "${FILE%%.*}" | tr "[:upper:]" "[:lower:]")
27+
# basename then stem: hosp/ADMISSIONS.csv.gz -> admissions (not hosp/admissions)
28+
BASENAME=$(basename "$FILE")
29+
TABLE_NAME=$(echo "${BASENAME%%.*}" | tr "[:upper:]" "[:lower:]")
2930
case "$FILE" in
3031
*csv)
3132
IMPORT_CMD=".import $FILE $TABLE_NAME"

0 commit comments

Comments
 (0)