<commit_before># -*- coding: utf-8 -*-
##
##  model.py
##  streamflow_prediction_tool
##
##  Created by <NAME>.
##  Copyright © 2015-2016 <NAME>. All rights reserved.
##  License: BSD 3-Clause

from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Boolean, Column, Integer, String, ForeignKey
from sqlalchemy.orm import relationship


Base = declarative_base()


class DataStore(Base):
    '''
    DataStore SQLAlchemy DB Model
    '''
    __tablename__ = 'data_store'

    # Columns
    id = Column(Integer, primary_key=True)
    name = Column(String)
    owner_org = Column(String)
    data_store_type_id = Column(Integer,ForeignKey('data_store_type.id'))
    data_store_type = relationship("DataStoreType")
    api_endpoint = Column(String)
    api_key = Column(String)


class DataStoreType(Base):
    '''
    DataStoreType SQLAlchemy DB Model
    '''
    __tablename__ = 'data_store_type'

    # Columns
    id = Column(Integer, primary_key=True)
    code_name = Column(String)
    human_readable_name = Column(String)

    def __init__(self, code_name, human_readable_name):
        self.code_name = code_name
        self.human_readable_name = human_readable_name


class Geoserver(Base):
    '''
    Geoserver SQLAlchemy DB Model
    '''
    __tablename__ = 'geoserver'

    # Columns
    id = Column(Integer, primary_key=True)
    name = Column(String)
    url = Column(String)
    username = Column(String)
    password = Column(String)
    
    def __init__(self, name, url, username, password):
        self.name = name
        self.url = url
        self.username = username
        self.password = password


class GeoServerLayer(Base):
    '''
    Geoserver Layer SQLAlchemy DB Model
    '''
    __tablename__ = 'geoserver_layer'

    # Columns
    id = Column(Integer, primary_key=True)
    name = Column(String)
    uploaded = Column(Boolean)
    latlon_bbox = Column(String)
    projection = Column(String)
    attribute_list = Column(String)
    wfs_url = Column(String)
    
    def __init__(self, name, uploaded=False, latlon_bbox="", projection="",
                 attribute_list="", wfs_url=""):
        self.name = name
        self.uploaded = uploaded
        self.latlon_bbox = latlon_bbox
        self.projection = projection
        self.attribute_list = attribute_list
        self.wfs_url = wfs_url
    
class Watershed(Base):
    '''
    Watershed SQLAlchemy DB Model
    '''
    __tablename__ = 'watershed'

    # Columns
    id = Column(Integer, primary_key=True)
    data_store_id = Column(Integer, ForeignKey('data_store.id'))
    geoserver_id = Column(Integer, ForeignKey('geoserver.id'))
    geoserver_drainage_line_layer_id = Column(Integer, ForeignKey('geoserver_layer.id'))
    geoserver_boundary_layer_id = Column(Integer, ForeignKey('geoserver_layer.id'))
    geoserver_gage_layer_id = Column(Integer, ForeignKey('geoserver_layer.id'))
    geoserver_historical_flood_map_layer_id = Column(Integer, ForeignKey('geoserver_layer.id'))
    geoserver_ahps_station_layer_id = Column(Integer, ForeignKey('geoserver_layer.id'))
    watershed_name = Column(String)
    subbasin_name = Column(String)
    watershed_clean_name = Column(String)
    subbasin_clean_name = Column(String)
    data_store = relationship("DataStore")
    ecmwf_rapid_input_resource_id = Column(String)
    ecmwf_data_store_watershed_name = Column(String)
    ecmwf_data_store_subbasin_name = Column(String)
    wrf_hydro_data_store_watershed_name = Column(String)
    wrf_hydro_data_store_subbasin_name = Column(String)
    geoserver = relationship("Geoserver")
    geoserver_drainage_line_layer = relationship("GeoServerLayer", 
                                                 foreign_keys=[geoserver_drainage_line_layer_id],
                                                 single_parent=True,
                                                 cascade="save-update,merge,delete,delete-orphan")
    geoserver_boundary_layer = relationship("GeoServerLayer", 
                                            foreign_keys=[geoserver_boundary_layer_id],
                                            single_parent=True,
                                            cascade="save-update,merge,delete,delete-orphan")
    geoserver_gage_layer = relationship("GeoServerLayer", 
                                        foreign_keys=[geoserver_gage_layer_id],
                                        single_parent=True,
                                        cascade="save-update,merge,delete,delete-orphan")
    geoserver_historical_flood_map_layer = relationship("GeoServerLayer", 
                                                        foreign_keys=[geoserver_historical_flood_map_layer_id],
                                                        single_parent=True,
                                                        cascade="save-update,merge,delete,delete-orphan")
    geoserver_ahps_station_layer = relationship("GeoServerLayer", 
                                                foreign_keys=[geoserver_ahps_station_layer_id],
                                                single_parent=True,
                                                cascade="save-update,merge,delete,delete-orphan")
    watershed_groups = relationship("WatershedGroup",
                                    secondary='watershed_watershed_group_link')


class WatershedWatershedGroupLink(Base):
    '''
    SQLAlchemy many-to-many link between watershed and watershed_group
    '''
    __tablename__ = 'watershed_watershed_group_link'
    watershed_group_id = Column(Integer, ForeignKey('watershed_group.id'), primary_key=True)
    watershed_id = Column(Integer, ForeignKey('watershed.id'), primary_key=True)


class WatershedGroup(Base):
    '''
    WatershedGroup SQLAlchemy DB Model
    '''
    __tablename__ = 'watershed_group'

    # Columns
    id = Column(Integer, primary_key=True)
    name = Column(String)
    watersheds = relationship("Watershed", 
                              secondary='watershed_watershed_group_link')

    def __init__(self, name):
        self.name = name
        <commit_msg>remove __init__ and remove wrf parameters<commit_after># -*- coding: utf-8 -*-
##
##  model.py
##  streamflow_prediction_tool
##
##  Created by <NAME>.
##  Copyright © 2015-2016 <NAME>. All rights reserved.
##  License: BSD 3-Clause

from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Boolean, Column, Integer, String, ForeignKey
from sqlalchemy.orm import relationship


Base = declarative_base()


class DataStore(Base):
    """
    DataStore SQLAlchemy DB Model
    """
    __tablename__ = 'data_store'

    # Columns
    id = Column(Integer, primary_key=True)
    name = Column(String)
    owner_org = Column(String)
    data_store_type_id = Column(Integer,ForeignKey('data_store_type.id'))
    data_store_type = relationship("DataStoreType")
    api_endpoint = Column(String)
    api_key = Column(String)


class DataStoreType(Base):
    """
    DataStoreType SQLAlchemy DB Model
    """
    __tablename__ = 'data_store_type'

    # Columns
    id = Column(Integer, primary_key=True)
    code_name = Column(String)
    human_readable_name = Column(String)


class Geoserver(Base):
    """
    Geoserver SQLAlchemy DB Model
    """
    __tablename__ = 'geoserver'

    # Columns
    id = Column(Integer, primary_key=True)
    name = Column(String)
    url = Column(String)
    username = Column(String)
    password = Column(String)


class GeoServerLayer(Base):
    """
    Geoserver Layer SQLAlchemy DB Model
    """
    __tablename__ = 'geoserver_layer'

    # Columns
    id = Column(Integer, primary_key=True)
    name = Column(String)
    uploaded = Column(Boolean, default=False)
    latlon_bbox = Column(String, default="")
    projection = Column(String, default="")
    attribute_list = Column(String, default="")
    wfs_url = Column(String, default="")
    

class Watershed(Base):
    """
    Watershed SQLAlchemy DB Model
    """
    __tablename__ = 'watershed'

    # Columns
    id = Column(Integer, primary_key=True)
    data_store_id = Column(Integer, ForeignKey('data_store.id'))
    geoserver_id = Column(Integer, ForeignKey('geoserver.id'))
    geoserver_drainage_line_layer_id = Column(Integer, ForeignKey('geoserver_layer.id'))
    geoserver_boundary_layer_id = Column(Integer, ForeignKey('geoserver_layer.id'))
    geoserver_gage_layer_id = Column(Integer, ForeignKey('geoserver_layer.id'))
    geoserver_historical_flood_map_layer_id = Column(Integer, ForeignKey('geoserver_layer.id'))
    geoserver_ahps_station_layer_id = Column(Integer, ForeignKey('geoserver_layer.id'))
    watershed_name = Column(String)
    subbasin_name = Column(String)
    watershed_clean_name = Column(String)
    subbasin_clean_name = Column(String)
    data_store = relationship("DataStore")
    ecmwf_rapid_input_resource_id = Column(String)
    ecmwf_data_store_watershed_name = Column(String)
    ecmwf_data_store_subbasin_name = Column(String)
    geoserver = relationship("Geoserver")
    geoserver_drainage_line_layer = relationship("GeoServerLayer", 
                                                 foreign_keys=[geoserver_drainage_line_layer_id],
                                                 single_parent=True,
                                                 cascade="save-update,merge,delete,delete-orphan")
    geoserver_boundary_layer = relationship("GeoServerLayer", 
                                            foreign_keys=[geoserver_boundary_layer_id],
                                            single_parent=True,
                                            cascade="save-update,merge,delete,delete-orphan")
    geoserver_gage_layer = relationship("GeoServerLayer", 
                                        foreign_keys=[geoserver_gage_layer_id],
                                        single_parent=True,
                                        cascade="save-update,merge,delete,delete-orphan")
    geoserver_historical_flood_map_layer = relationship("GeoServerLayer", 
                                                        foreign_keys=[geoserver_historical_flood_map_layer_id],
                                                        single_parent=True,
                                                        cascade="save-update,merge,delete,delete-orphan")
    geoserver_ahps_station_layer = relationship("GeoServerLayer", 
                                                foreign_keys=[geoserver_ahps_station_layer_id],
                                                single_parent=True,
                                                cascade="save-update,merge,delete,delete-orphan")
    watershed_groups = relationship("WatershedGroup",
                                    secondary='watershed_watershed_group_link')


class WatershedWatershedGroupLink(Base):
    """
    SQLAlchemy many-to-many link between watershed and watershed_group
    """
    __tablename__ = 'watershed_watershed_group_link'
    watershed_group_id = Column(Integer, ForeignKey('watershed_group.id'), primary_key=True)
    watershed_id = Column(Integer, ForeignKey('watershed.id'), primary_key=True)


class WatershedGroup(Base):
    """
    WatershedGroup SQLAlchemy DB Model
    """
    __tablename__ = 'watershed_group'

    # Columns
    id = Column(Integer, primary_key=True)
    name = Column(String)
    watersheds = relationship("Watershed", 
                              secondary='watershed_watershed_group_link')

{'fraction_non_alphanumeric': 0.08929503916449086, 'fraction_numerical': 0.0017406440382941688, 'mean_word_length': 2.5097739767868052, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 56, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7650899', 'n_tokens_mistral': 3344, 'n_tokens_neox': 3179, 'n_words': 533}