Magnus Moar

13 papers A* 1B 1C 1Journal 4Unranked 4
YearRankTypeTitle / Venue / Authors
2017 conf
CHI PLAY (Companion)
Daniel P. O. Wiedemann, Peter J. Passmore, Magnus Moar
2014 ch.
Handbook of Human Centric Visualization
Liliya Korallo, Stephen Boyd Davis, Nigel Foreman, Magnus Moar
2014 ch.
Technologies of Inclusive Well-Being
Martin Knöll, Magnus Moar, Stephen Boyd Davis, Mike Saunders
2012 J jnl
Comput. Educ.
Liliya Korallo, Nigel Foreman, Stephen Boyd Davis, Magnus Moar, Mark Coulson
2012 J jnl
Comput. Educ.
Liliya Korallo, Nigel Foreman, Stephen Boyd Davis, Magnus Moar, Mark Coulson
2012 J jnl
Int. J. Comput. Sci. Sport
Martin Knöll, Magnus Moar
2011 conf
PervasiveHealth
Martin Knöll, Magnus Moar
2008 C conf
ICIDS
Nye Parry, Helen Bendon, Stephen Boyd Davis, Magnus Moar
2005 A* conf
ACM Multimedia
Stephen Boyd Davis, Magnus Moar, John Cox, Chris Riddoch, Karl Cooke, Rachel Jacobs, Matt Watkins, Richard Hull, Tom Melamed
2005 B conf
Creativity & Cognition
Stephen Boyd Davis, Magnus Moar
2003 J jnl
Comput. Graph.
Fiona Bailey, Magnus Moar
2002 conf
SIGGRAPH Abstracts and Applications
Fiona Bailey, Magnus Moar
2001 conf
Digital Content Creation
Magnus Moar, Fiona Bailey
redb/utils/push_to_elastic.py
← Index redb/utils/push_to_elastic.py python
import json
import os
#from redb.settings import elasticsearch as es
from elasticsearch import Elasticsearch
from dataclasses import asdict
from dotenv import load_dotenv

class Utils():
    """
    Utility class for pushing

    """
    @staticmethod
    def push_to_elastic(sample_dict):
        """
        Pushes the sample_dict to elastic search
        """
        load_dotenv()
        ELASTIC_ENDPOINT = os.getenv("ELASTIC_HOST")
        ELASTIC_ENFORCE_SSL = os.getenv("ELASTIC_ENFORCE_SSL", False) == "True"
        ELASTIC_USER = os.getenv("ELASTIC_USER")
        ELASTIC_PASSWORD = os.getenv("ELASTIC_PASSWORD")
        ELASTIC_BINARIES_COLLECTION = os.getenv(
            "ELASTIC_BINARIES_COLLECTION", "redb_test"
        )
        es = Elasticsearch(
            ELASTIC_ENDPOINT,
            verify_certs=ELASTIC_ENFORCE_SSL,
            basic_auth=(ELASTIC_USER, ELASTIC_PASSWORD),
            maxsize=20,
            retry_on_timeout=True,
            timeout=30,
        )

        try:
            dict_dump = json.dumps(sample_dict)
        except Exception as e:
            print(f"Error: {e}")
            return False
        elastic = es.index(index=ELASTIC_BINARIES_COLLECTION, body=dict_dump)
        return True
    
    def push_to_index(sample_dict, index_name):
        """
        Pushes the sample_dict to elastic search
        """
        load_dotenv()
        ELASTIC_ENDPOINT = os.getenv("ELASTIC_HOST")
        ELASTIC_ENFORCE_SSL = os.getenv("ELASTIC_ENFORCE_SSL", False) == "True"
        ELASTIC_USER = os.getenv("ELASTIC_USER")
        ELASTIC_PASSWORD = os.getenv("ELASTIC_PASSWORD")
        ELASTIC_BINARIES_COLLECTION = index_name
        
        es = Elasticsearch(
            ELASTIC_ENDPOINT,
            verify_certs=ELASTIC_ENFORCE_SSL,
            basic_auth=(ELASTIC_USER, ELASTIC_PASSWORD),
            maxsize=20,
            retry_on_timeout=True,
            timeout=30,
        )

        try:
            dict_dump = json.dumps(sample_dict)
        except Exception as e:
            print(f"Error: {e}")
            return False
        elastic = es.index(index=ELASTIC_BINARIES_COLLECTION, body=dict_dump)
        return True