class_docstr: .. attention::
  
      This source is mainly implemeted as a proof-of-concept for integrating data
      pulled from an SQL-database. Not much thought has been put into tokenization and
      data cleaning. We should probably also pull the data from a more thouroughly
      documented table.
  
  Tokens from the national student register.
class_docstr_tok: ["..","attention",":",":","This","source","is","mainly","implemeted","as","a","proof-of-concept","for","integrating","data","pulled","from","an","SQL-database",".","Not","much","thought","has","been","put","into","tokenization","and","data","cleaning",".","We","should","probably","also","pull","the","data","from","a","more","thouroughly","documented","table",".","Tokens","from","the","national","student","register","."]
docstr: Loads the data from the oracle database.
  We need to the data by PERSON_ID in the SQL-statement, aswell as specify it with
  index_col in the read_sql call otherwise the index breaks.
docstr_tok: ["Loads","the","data","from","the","oracle","database",".","We","need","to","the","data","by","PERSON_ID","in","the","SQL-statement",",","aswell","as","specify","it","with","index_col","in","the","read_sql","call","otherwise","the","index","breaks","."]
code: def indexed(self) -> dd.DataFrame:
      """
      Loads the data from the oracle database.
      We need to the data by PERSON_ID in the SQL-statement, aswell as specify it with
      index_col in the read_sql call otherwise the index breaks.
      """
      stmt = (
          select(
              [
                  student_register.c.PERSON_ID,
                  student_register.c.ELEV3_VFRA,
                  student_register.c.ELEV3_VTIL,
                  student_register.c.INSTNR,
                  student_register.c.UDD,
                  student_register.c.UDEL,
                  education_details.c.UDD_UDDANNELSESNIVEAU,
              ]
          )
          .select_from(student_register.outerjoin(education_details))
          .where(
              and_(
                  extract("year", student_register.c.REFERENCETID)
                  == self.reference_year,
                  student_register.c.ELEV3_VTIL
                  - student_register.c.ELEV3_VFRA
                  > self.minimum_days_attended,
                  extract("year", student_register.c.ELEV3_VFRA)
                  <= self.end_year,
                  extract("year", student_register.c.ELEV3_VTIL)
                  >= self.start_year,
              )
          )
          .order_by(student_register.c.PERSON_ID)
      )
  
      ddf = dd.read_sql(
          sql=stmt,
          con="oracle://@statprod",
          index_col="PERSON_ID",
          bytes_per_chunk="256MB",
      )
  
      assert ddf.index.name == "PERSON_ID"
  
      if self.downsample:
          ddf = self.downsample_persons(ddf)
  
      ddf = ddf.assign(
          ELEV3_VFRA=lambda x: dd.to_datetime(x.ELEV3_VFRA),
          ELEV3_VTIL=lambda x: dd.to_datetime(
              x.ELEV3_VTIL, errors="coerce"
          ).fillna(pd.Timestamp.max),
          INSTNR=lambda x: x.INSTNR.astype("string"),
          UDD=lambda x: x.UDD.astype("string"),
          UDD_UDDANNELSESNIVEAU=lambda x: x.UDD_UDDANNELSESNIVEAU.astype(
              "string"
          ),
          UDEL=lambda x: x.UDEL.astype("string"),
      )
  
      ddf = ddf.rename(
          columns={
              "ELEV3_VFRA": "START",
              "ELEV3_VTIL": "END",
              "INSTNR": "INST",
              "UDD_UDDANNELSESNIVEAU": "LEVEL",
          }
      )
  
      assert isinstance(ddf, dd.DataFrame)
      return ddf
  
file_path: life2vec/src/data_new/sources/education.py
imports: from dataclasses import dataclass, field
  from typing import List
  import dask.dataframe
  import pandas
  from sqlalchemy import Column, Date, ForeignKey, Integer, MetaData, Table, Text, and_, extract, select
  from ..decorators import save_parquet
  from ..serialize import DATA_ROOT
  from .base import FIELD_TYPE, TokenSource
label_desc: Use image node_id 2 for calling the EducationTokens obj's underlying member method code with example usage: obj.indexed() and returns: ddf