Skip to content
Snippets Groups Projects
Verified Commit 674763b5 authored by Daniel Hornung's avatar Daniel Hornung
Browse files

MAINT: Removed old development code lines.

parent c63b5ba6
No related branches found
No related tags found
2 merge requests!178FIX: #96 Better error output for crawl.py script.,!171sav/spss converter
Pipeline #52091 failed
...@@ -44,11 +44,6 @@ ORIGINAL_TYPES = { ...@@ -44,11 +44,6 @@ ORIGINAL_TYPES = {
class SPSSConverter(converters.TableConverter): class SPSSConverter(converters.TableConverter):
"""Converter for SAV files (stored by SPSS).""" """Converter for SAV files (stored by SPSS)."""
# def __init__(self, *args, **kwargs):
# super().__init__(*args, **kwargs)
# from IPython import embed
# embed()
def create_children(self, values: GeneralStore, element: StructureElement) -> list: def create_children(self, values: GeneralStore, element: StructureElement) -> list:
assert isinstance(element, File) assert isinstance(element, File)
# The default dtype backend "numpy_nullable" does not handle dates well. # The default dtype backend "numpy_nullable" does not handle dates well.
...@@ -56,12 +51,6 @@ class SPSSConverter(converters.TableConverter): ...@@ -56,12 +51,6 @@ class SPSSConverter(converters.TableConverter):
df = pd.io.spss.read_spss(element.path, dtype_backend="pyarrow") df = pd.io.spss.read_spss(element.path, dtype_backend="pyarrow")
dtypes = read_column_types(element.path) dtypes = read_column_types(element.path)
# if element.path.endswith(".sav"):
# sav_df, meta = pyreadstat.read_sav(element.path, metadataonly=True)
# from IPython import embed
# embed()
df.drop(range(15, len(df.index)), inplace=True)
# Fix datetime columns # Fix datetime columns
for name, dtype in dtypes.items(): for name, dtype in dtypes.items():
if dtype != "DATETIME": if dtype != "DATETIME":
...@@ -70,9 +59,6 @@ class SPSSConverter(converters.TableConverter): ...@@ -70,9 +59,6 @@ class SPSSConverter(converters.TableConverter):
col.fillna(np.nan, inplace=True) col.fillna(np.nan, inplace=True)
col.replace([np.nan], [None], inplace=True) col.replace([np.nan], [None], inplace=True)
# from IPython import embed
# embed()
return self._children_from_dataframe(df) return self._children_from_dataframe(df)
...@@ -216,21 +202,6 @@ directory: # corresponds to the directory given to the crawler ...@@ -216,21 +202,6 @@ directory: # corresponds to the directory given to the crawler
# python3 -m caosadvancedtools.models.parser datamodel.yaml --sync # python3 -m caosadvancedtools.models.parser datamodel.yaml --sync
""" """
# #
# # Code for creating enum records:
# #
# """
# for name, values in enums.items():
# for line in f"""
# cont = db.Container()
# for value in {repr(values)}:
# rec = db.Record(name=value).add_parent(name="{name}")
# cont.append(rec)
# cont.insert()
# """.splitlines(keepends=True):
# if line.strip():
# output += f"# {line}"
# output += "#\n"
# Actual datamodel # Actual datamodel
output += """ output += """
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment