Beispiel #1
0
    def post(self, Date, Addr=None, NoOfTrans=None):

        most_active_entity = MostActiveEntity(date=Date,
                                              addr=Addr,
                                              no_of_trans=NoOfTrans)
        db_session.add(most_active_entity)
        try:
            db_session.commit()
            response = {
                "ResponseCode":
                ResponseCodes.Success.value,
                "ResponseDesc":
                ResponseCodes.Success.name,
                "MostActiveEntity":
                serialize_most_active_entity(most_active_entity)
            }
        except SQLAlchemyError as e:
            print(str(e))
            db_session.rollback()
            response = {
                "ResponseCode": ResponseCodes.InternalError.value,
                "ResponseDesc": ResponseCodes.InternalError.name,
                "ErrorMessage": ResponseDescriptions.ErrorFromDataBase.value
            }

        return response
    def post(self, Date, ReceiveOnlyPer=None, SendReceivePer=None):

        address_distribution = AddressDistribution(
            date=Date,
            receive_only_per=ReceiveOnlyPer,
            send_receive_per=SendReceivePer)
        db_session.add(address_distribution)
        try:
            db_session.commit()
            response = {
                "ResponseCode":
                ResponseCodes.Success.value,
                "ResponseDesc":
                ResponseCodes.Success.name,
                "AddressDistribution":
                serialize_address_distribution(address_distribution)
            }
        except SQLAlchemyError as e:
            print(str(e))
            db_session.rollback()
            response = {
                "ResponseCode": ResponseCodes.InternalError.value,
                "ResponseDesc": ResponseCodes.InternalError.name,
                "ErrorMessage": ResponseDescriptions.ErrorFromDataBase.value
            }

        return response
Beispiel #3
0
    def post(self, Date, WCC=None):

        weakly_connected_component = WeaklyConnectedComponent(date=Date,
                                                              wcc=WCC)
        db_session.add(weakly_connected_component)
        try:
            db_session.commit()
            response = {
                "ResponseCode":
                ResponseCodes.Success.value,
                "ResponseDesc":
                ResponseCodes.Success.name,
                "WeaklyConnectedComponent":
                serialize_weakly_connected_component(
                    weakly_connected_component)
            }
        except SQLAlchemyError as e:
            print(str(e))
            db_session.rollback()
            response = {
                "ResponseCode": ResponseCodes.InternalError.value,
                "ResponseDesc": ResponseCodes.InternalError.name,
                "ErrorMessage": ResponseDescriptions.ErrorFromDataBase.value
            }

        return response
    def post(self, Date, AssortCoeff=None):

        assortativity_coefficient = AssortativityCoefficient(
            date=Date, assort_coeff=AssortCoeff)
        db_session.add(assortativity_coefficient)
        try:
            db_session.commit()
            response = {
                "ResponseCode":
                ResponseCodes.Success.value,
                "ResponseDesc":
                ResponseCodes.Success.name,
                "AssortativityCoefficient":
                serialize_assortativity_coefficient(assortativity_coefficient)
            }
        except SQLAlchemyError as e:
            print(str(e))
            db_session.rollback()
            response = {
                "ResponseCode": ResponseCodes.InternalError.value,
                "ResponseDesc": ResponseCodes.InternalError.name,
                "ErrorMessage": ResponseDescriptions.ErrorFromDataBase.value
            }

        return response
    def post(self, Date, ClustCoeff=None):

        clustering_coefficient = ClusteringCoefficient(date=Date,
                                                       clust_coeff=ClustCoeff)
        db_session.add(clustering_coefficient)
        try:
            db_session.commit()
            response = {
                "ResponseCode":
                ResponseCodes.Success.value,
                "ResponseDesc":
                ResponseCodes.Success.name,
                "ClusteringCoefficient":
                serialize_clustering_coefficient(clustering_coefficient)
            }
        except SQLAlchemyError as e:
            print(str(e))
            db_session.rollback()
            response = {
                "ResponseCode": ResponseCodes.InternalError.value,
                "ResponseDesc": ResponseCodes.InternalError.name,
                "ErrorMessage": ResponseDescriptions.ErrorFromDataBase.value
            }

        return response
Beispiel #6
0
    def post(self, Date,
             BTCrecLT1=None,
             BTCrecLT10=None,
             BTCrecLT100=None,
             BTCrecLT1000=None,
             BTCrecLT10000=None,
             BTCrecLT50000=None,
             BTCrecGT50000=None):

        total_btc_received = TotalBtcReceived(date=Date,
                                              btcreclt1=BTCrecLT1,
                                              btcreclt10=BTCrecLT10,
                                              btcreclt100=BTCrecLT100,
                                              btcreclt1000=BTCrecLT1000,
                                              btcreclt10000=BTCrecLT10000,
                                              btcreclt50000=BTCrecLT50000,
                                              btcrecgt50000=BTCrecGT50000
                                              )
        db_session.add(total_btc_received)
        try:
            db_session.commit()
            response = {"ResponseCode": ResponseCodes.Success.value,
                        "ResponseDesc": ResponseCodes.Success.name,
                        "TotalBtcReceived": serialize_total_btc_received(total_btc_received)}
        except SQLAlchemyError as e:
            print(str(e))
            db_session.rollback()
            response = {"ResponseCode": ResponseCodes.InternalError.value,
                        "ResponseDesc": ResponseCodes.InternalError.name,
                        "ErrorMessage": ResponseDescriptions.ErrorFromDataBase.value}

        return response
Beispiel #7
0
    def post(self, Date, PearCoeff=None):

        pearson_coefficient = PearsonCoefficient(date=Date,
                                                 pearcoeff=PearCoeff)
        db_session.add(pearson_coefficient)
        try:
            db_session.commit()
            response = {
                "ResponseCode":
                ResponseCodes.Success.value,
                "ResponseDesc":
                ResponseCodes.Success.name,
                "PearsonCoefficient":
                serialize_pearson_coefficient(pearson_coefficient)
            }
        except SQLAlchemyError as e:
            print(str(e))
            db_session.rollback()
            response = {
                "ResponseCode": ResponseCodes.InternalError.value,
                "ResponseDesc": ResponseCodes.InternalError.name,
                "ErrorMessage": ResponseDescriptions.ErrorFromDataBase.value
            }

        return response
Beispiel #8
0
    def post(self,
             Date,
             Address,
             No_of_SCC=None,
             No_of_WCC=None,
             BTC_Received=None,
             BTC_Sent=None,
             Activity_Level=None,
             Clustering_Coeff=None,
             PearsonCC=None,
             Maximal_Balance=None,
             Current_Balance=None):
        address_feature = AddressFeature(date=Date,
                                         address=Address,
                                         no_of_scc=No_of_SCC,
                                         no_of_wcc=No_of_WCC,
                                         btc_received=BTC_Received,
                                         btc_sent=BTC_Sent,
                                         activity_level=Activity_Level,
                                         clustering_coeff=Clustering_Coeff,
                                         pearsoncc=PearsonCC,
                                         maximal_balance=Maximal_Balance,
                                         current_balance=Current_Balance)
        db_session.add(address_feature)
        try:
            db_session.commit()
            response = {
                "ResponseCode": ResponseCodes.Success.value,
                "ResponseDesc": ResponseCodes.Success.name,
                "AddressFeature": serialize_feature_address(address_feature)
            }
        except SQLAlchemyError as e:
            print(str(e))
            db_session.rollback()
            response = {
                "ResponseCode": ResponseCodes.InternalError.value,
                "ResponseDesc": ResponseCodes.InternalError.name,
                "ErrorMessage": ResponseDescriptions.ErrorFromDataBase.value
            }

        return response
Beispiel #9
0
    def post(self,
             Date,
             CurrBal1=None,
             CurrBal10=None,
             CurrBal100=None,
             CurrBal1000=None,
             CurrBal10000=None,
             CurrBal50000=None,
             CurrBalGT50000=None):

        current_balance = CurrentBalance(date=Date,
                                         currbal1=CurrBal1,
                                         currbal10=CurrBal10,
                                         currbal100=CurrBal100,
                                         currbal1000=CurrBal1000,
                                         currbal10000=CurrBal10000,
                                         currbal50000=CurrBal50000,
                                         currbalgt50000=CurrBalGT50000)
        db_session.add(current_balance)
        try:
            db_session.commit()
            response = {
                "ResponseCode": ResponseCodes.Success.value,
                "ResponseDesc": ResponseCodes.Success.name,
                "CurrentBalance": serialize_current_balance(current_balance)
            }
        except SQLAlchemyError as e:
            print(str(e))
            db_session.rollback()
            response = {
                "ResponseCode": ResponseCodes.InternalError.value,
                "ResponseDesc": ResponseCodes.InternalError.name,
                "ErrorMessage": ResponseDescriptions.ErrorFromDataBase.value
            }

        return response
Beispiel #10
0
    def post(self, Date,
             SplitChlt=None,
             MergeChlt=None,
             TransitionChlt=None):

        chainlets_occurance = ChainletsOccurance(date=Date,
                                                 split_chlt=SplitChlt,
                                                 merge_chlt=MergeChlt,
                                                 transition_chlt=TransitionChlt
                                                 )
        db_session.add(chainlets_occurance)
        try:
            db_session.commit()
            response = {"ResponseCode": ResponseCodes.Success.value,
                        "ResponseDesc": ResponseCodes.Success.name,
                        "ChainletsOccurance": serialize_chainlets_occurance(chainlets_occurance)}
        except SQLAlchemyError as e:
            print(str(e))
            db_session.rollback()
            response = {"ResponseCode": ResponseCodes.InternalError.value,
                        "ResponseDesc": ResponseCodes.InternalError.name,
                        "ErrorMessage": ResponseDescriptions.ErrorFromDataBase.value}

        return response
Beispiel #11
0
    def post(self,
             Date,
             LOALT2=None,
             LOALT5=None,
             LOALT10=None,
             LOALT100=None,
             LOALT1000=None,
             LOALT5000=None,
             LOAGT5000=None):

        activity_level = ActivityLevel(date=Date,
                                       loalt2=LOALT2,
                                       loalt5=LOALT5,
                                       loalt10=LOALT10,
                                       loalt100=LOALT100,
                                       loalt1000=LOALT1000,
                                       loalt5000=LOALT5000,
                                       loagt5000=LOAGT5000)
        db_session.add(activity_level)
        try:
            db_session.commit()
            response = {
                "ResponseCode": ResponseCodes.Success.value,
                "ResponseDesc": ResponseCodes.Success.name,
                "ActivityLevel": serialize_activity_level(activity_level)
            }
        except SQLAlchemyError as e:
            print(str(e))
            db_session.rollback()
            response = {
                "ResponseCode": ResponseCodes.InternalError.value,
                "ResponseDesc": ResponseCodes.InternalError.name,
                "ErrorMessage": ResponseDescriptions.ErrorFromDataBase.value
            }

        return response
Beispiel #12
0
    def post(self,
             Date,
             TransSizeLT1=None,
             TransSizeLT10=None,
             TransSizeLT100=None,
             TransSizeLT5000=None,
             TransSizeLT20000=None,
             TransSizeLT50000=None,
             TransSizeGT50000=None):

        transaction_size = TransactionSize(date=Date,
                                           trans_size_lt1=TransSizeLT1,
                                           trans_size_lt10=TransSizeLT10,
                                           trans_size_lt100=TransSizeLT100,
                                           trans_size_lt5000=TransSizeLT5000,
                                           trans_size_lt20000=TransSizeLT20000,
                                           trans_size_lt50000=TransSizeLT50000,
                                           trans_size_gt50000=TransSizeGT50000)
        db_session.add(transaction_size)
        try:
            db_session.commit()
            response = {
                "ResponseCode": ResponseCodes.Success.value,
                "ResponseDesc": ResponseCodes.Success.name,
                "TransactionSize": serialize_transaction_size(transaction_size)
            }
        except SQLAlchemyError as e:
            print(str(e))
            db_session.rollback()
            response = {
                "ResponseCode": ResponseCodes.InternalError.value,
                "ResponseDesc": ResponseCodes.InternalError.name,
                "ErrorMessage": ResponseDescriptions.ErrorFromDataBase.value
            }

        return response
Beispiel #13
0
    def post(self, Date,
             TotBTC=None,
             CircPercent=None,
             NotCircuPercent=None):

        bitcoin_circulation = BitcoinCirculation(date=Date,
                                                 tot_btc=TotBTC,
                                                 circ_percent=CircPercent,
                                                 not_circu_percent=NotCircuPercent)
        db_session.add(bitcoin_circulation)
        try:
            db_session.commit()
            response = {"ResponseCode": ResponseCodes.Success.value,
                        "ResponseDesc": ResponseCodes.Success.name,
                        "BitcoinCirculation": serialize_bitcoin_circulation(
                            bitcoin_circulation)}
        except SQLAlchemyError as e:
            print(str(e))
            db_session.rollback()
            response = {"ResponseCode": ResponseCodes.InternalError.value,
                        "ResponseDesc": ResponseCodes.InternalError.name,
                        "ErrorMessage": ResponseDescriptions.ErrorFromDataBase.value}

        return response