Beispiel #1
0
class IbneMaja(Model):
    id = IDField()
    hadith_number = NumberField()
    book_number = NumberField()
    book_name = MapField()
    chapter = MapField()
    text = MapField()
    is_sahih = BooleanField()
    uci = TextField(required=True)

    class Meta:
        collection_name = "ibne_maja"
Beispiel #2
0
class AbuDawud(Model):
    id = IDField()
    hadith_number = NumberField()
    book_number = NumberField()
    book_name = MapField()
    chapter = MapField()
    text = MapField()
    is_sahih = BooleanField()
    uci = TextField(required=True)

    class Meta:
        collection_name = "abu_dawud"
Beispiel #3
0
class Muslim(Model):
    id = IDField()
    hadith_number = NumberField()
    book_number = NumberField()
    international_number = NumberField()
    book_name = MapField()
    chapter = MapField()
    text = MapField()
    is_sahih = BooleanField()
    uci = TextField(required=True)

    class Meta:
        collection_name = "muslim"
Beispiel #4
0
class Mishkat(Model):
    id = IDField()
    hadith_number = NumberField()
    book_number = NumberField()
    book_name = MapField()
    chapter = MapField()
    text = MapField()
    is_muttafaqun_alayh = BooleanField()
    is_sahih = BooleanField()
    uci = TextField(required=True)

    class Meta:
        collection_name = "mishkat"
class User(Model):
    """User Class Model, extending from ```fireo.models.Model``` package.

    Attributes
    ----------
    id : str
        User unique id composed by subject id given by google auth.
    name : str
        User display name.
    contacts_statistics : dict
        dictionary containg the statistics about contacts, in other words,
        contacts per domain, contacts per City Adresss, contacts per organization

    """

    id = IDField()
    query_id = TextField()
    name = TextField()
    contacts_statistics = MapField()

    @staticmethod
    def statistics_to_chart(data):
        """Return a dictionary with label and data to plot statistics.
        
        Parameters
        ----------
        data : Dict
            Dictionary with contacts statistics in the following format:
            {
                'organization': {
                    'google': 25, 'facebook': 30
                },
                ...
            }
            
        Returns
        -------
        dict
            Dictionary in the following format:
            {
                'organization': {
                    'label': ["google", "facebook", ...],
                    'data': [25, 30, ...]
                }
            }
        """
        data = data['contacts_statistics']

        chart_data = {}

        for key, item in data.items():
            print(key, item)
            chart_data[key] = {"label": [], "data": []}

            for label, value in item.items():
                chart_data[key]["label"].append(label)
                chart_data[key]["data"].append(value)

        return chart_data
Beispiel #6
0
class LowercaseUser(Model):
    txt_name = TextField()
    dict_name = MapField()
    lst_name = ListField()
    base_name = Field()

    class Meta:
        to_lowercase = True
Beispiel #7
0
class Ayah(Model):
    id = IDField()
    number = NumberField()
    surah_number = NumberField()
    content = MapField()
    uci = TextField(required=True)

    class Meta:
        collection_name = "quran"
Beispiel #8
0
class CityEmptyField(Model):
    text = TextField()
    number = NumberField()
    date = DateTime()
    bool = BooleanField()
    geo_point = GeoPoint()
    list = ListField()
    map = MapField()
    nested = NestedModel(NModel)
    ref = ReferenceField(RModel)
Beispiel #9
0
 class Test(Model):
     name = TextField()
     score_data = MapField(default={'field1': 0, 'field2': 0})
Beispiel #10
0
class User5(Model):
    field = MapField()