File tree Expand file tree Collapse file tree
mimic-iii/buildmimic/sqlite
mimic-iv/buildmimic/sqlite Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66jobs :
77 lint-mimic-iv :
88 runs-on : ubuntu-latest
9- permissions :
10- contents : read
11- checks : write
129 steps :
1310 - name : checkout
1411 uses : actions/checkout@v7
3835 shell : bash
3936 run : sqlfluff lint --format github-annotation --annotation-level failure --nofail ${{ steps.get_files_to_lint.outputs.lintees }} > annotations.json
4037 - name : Annotate
41- if : steps.get_files_to_lint.outputs.lintees != ''
4238 uses : yuzutech/annotations-action@v0.6.0
4339 with :
4440 repo-token : " ${{ secrets.GITHUB_TOKEN }}"
4541 title : " SQLFluff Lint"
46- input : " ./annotations.json"
47- ignore-unauthorized-error : true
42+ input : " ./annotations.json"
Original file line number Diff line number Diff line change @@ -26,16 +26,9 @@ def _table_name_from_csv(filename: str) -> str:
2626 print (msg )
2727 sys .exit ()
2828
29- # Prefer .csv.gz when both exist for the same table; also load plain .csv
30- # (import.sh already accepts both).
31- files_by_table = {}
32- for f in glob ("*.csv" ):
33- files_by_table [_table_name_from_csv (f )] = f
3429for f in glob ("*.csv.gz" ):
35- files_by_table [_table_name_from_csv (f )] = f
36-
37- for table , f in sorted (files_by_table .items ()):
3830 print ("Starting processing {}" .format (f ))
31+ table = _table_name_from_csv (f )
3932 if os .path .getsize (f ) < THRESHOLD_SIZE :
4033 df = pd .read_csv (f , index_col = "ROW_ID" )
4134 df .to_sql (table , CONNECTION_STRING )
Original file line number Diff line number Diff line change @@ -28,19 +28,19 @@ for FILE in *; do
2828 TABLE_NAME=$( echo " ${FILE%% .* } " | tr " [:upper:]" " [:lower:]" )
2929 case " $FILE " in
3030 * csv)
31- IMPORT_CMD=" .import \" $FILE \" $TABLE_NAME "
31+ IMPORT_CMD=" .import $FILE $TABLE_NAME "
3232 ;;
3333 # need to decompress csv before load
3434 * csv.gz)
35- IMPORT_CMD=" .import \" |gzip -dc \\\" $FILE \\\" \" $TABLE_NAME "
35+ IMPORT_CMD=" .import \" |gzip -dc $FILE \" $TABLE_NAME "
3636 ;;
3737 # not a data file so skip
3838 * )
3939 continue
4040 ;;
4141 esac
4242 echo " Loading $FILE ."
43- sqlite3 " $OUTFILE " << EOF
43+ sqlite3 $OUTFILE << EOF
4444.headers on
4545.mode csv
4646$IMPORT_CMD
Original file line number Diff line number Diff line change @@ -110,7 +110,7 @@ def main():
110110 if args .limit > 0 :
111111 for f in data_files :
112112 if 'patients' in f .name :
113- pt = pd .read_csv (f , low_memory = False )
113+ pt = pd .read_csv (f )
114114 break
115115 if pt is None :
116116 raise FileNotFoundError ('Unable to find a patients file in current folder.' )
@@ -158,7 +158,7 @@ def main():
158158 tablename = tablenames [i ]
159159 print ("Starting processing {}" .format (tablename ), end = '.. ' )
160160 if os .path .getsize (f ) < THRESHOLD_SIZE :
161- df = pd .read_csv (f , dtype = mimic_dtypes , low_memory = False )
161+ df = pd .read_csv (f , dtype = mimic_dtypes )
162162 df = process_dataframe (df , subjects = subjects )
163163 df .to_sql (tablename , connection , index = False )
164164 row_counts [tablename ] += len (df )
Original file line number Diff line number Diff line change @@ -29,19 +29,19 @@ for FILE in */**.csv*; do
2929 TABLE_NAME=$( echo " ${BASENAME%% .* } " | tr " [:upper:]" " [:lower:]" )
3030 case " $FILE " in
3131 * csv)
32- IMPORT_CMD=" .import \" $FILE \" $TABLE_NAME "
32+ IMPORT_CMD=" .import $FILE $TABLE_NAME "
3333 ;;
3434 # need to decompress csv before load
3535 * csv.gz)
36- IMPORT_CMD=" .import \" |gzip -dc \\\" $FILE \\\" \" $TABLE_NAME "
36+ IMPORT_CMD=" .import \" |gzip -dc $FILE \" $TABLE_NAME "
3737 ;;
3838 # not a data file so skip
3939 * )
4040 continue
4141 ;;
4242 esac
4343 echo " Loading $FILE ."
44- sqlite3 " $OUTFILE " << EOF
44+ sqlite3 $OUTFILE << EOF
4545.headers on
4646.mode csv
4747$IMPORT_CMD
You can’t perform that action at this time.
0 commit comments