<filename>databuilder/models/elasticsearch_document.py<gh_stars>0
import json
from abc import ABCMeta


class ElasticsearchDocument:
    """
    Base class for ElasticsearchDocument
    Each different resource ESDoc will be a subclass
    """
    __metaclass__ = ABCMeta

    def to_json(self):
        # type: () -> str
        """
        Convert object to json
        :return:
        """
        obj_dict = {k: v for k, v in sorted(self.__dict__.items())}
        data = json.dumps(obj_dict) + "\n"
        return data

<filename>databuilder/models/elasticsearch_document.py<gh_stars>0
import json
from abc import ABCMeta


class ElasticsearchDocument:
    """
    Base class for ElasticsearchDocument
    Each different resource ESDoc will be a subclass
    """
    __metaclass__ = ABCMeta

    def to_json(self):
        # type: () -> str
        """
        Convert object to json
        :return:
        """
        obj_dict = {k: v for k, v in sorted(self.__dict__.items())}
        data = json.dumps(obj_dict) + "\n"
        return data

Base class for ElasticsearchDocument     Each different resource ESDoc will be a subclass # type: () -> str Convert object to json         :return: