<commit_before>"""
Created on 20 Oct 2016

@author: <NAME> (<EMAIL>)

example document:
{"tag": "scs-be2-2",
 "rec": "2017-09-24T07:51:21.510+00:00",
 "val": {
  "NO2": {"weV": 0.312317, "aeV": 0.31038, "weC": -0.001, "cnc": 14.8},
  "CO": {"weV": 0.325005, "aeV": 0.254254, "weC": 0.077239, "cnc": 323.2},
  "SO2": {"weV": 0.277942, "aeV": 0.267754, "weC": 0.004136, "cnc": 27.6},
  "H2S": {"weV": 0.221816, "aeV": 0.269817, "weC": -0.006301, "cnc": 29.6},
  "pt1": {"v": 0.321411, "tmp": 21.9},
  "sht": {"hmd": 73.0, "tmp": 21.4}}}
"""

from collections import OrderedDict

from scs_core.sample.sample import Sample


# TODO: get src from AFE data interpretation

# --------------------------------------------------------------------------------------------------------------------

class GasesSample(Sample):
    """
    classdocs
    """

    # ----------------------------------------------------------------------------------------------------------------

    def __init__(self, tag, rec, ndir_datum, afe_datum, sht_datum):
        """
        Constructor
        """
        jdict = OrderedDict()

        if ndir_datum is not None:
            jdict['CO2'] = ndir_datum

        if afe_datum is not None:
            for key in afe_datum.sns.items():
                jdict[key] = afe_datum.sns[key]

            if afe_datum.pt1000 is not None:
                jdict['pt1'] = afe_datum.pt1000

        if sht_datum is not None:
            jdict['sht'] = sht_datum

        super().__init__(tag, None, rec, jdict)<commit_msg>Fixed a bug in GasesSample.<commit_after>"""
Created on 20 Oct 2016

@author: <NAME> (<EMAIL>)

example document:
{"tag": "scs-be2-2",
 "rec": "2017-09-24T07:51:21.510+00:00",
 "val": {
  "NO2": {"weV": 0.312317, "aeV": 0.31038, "weC": -0.001, "cnc": 14.8},
  "CO": {"weV": 0.325005, "aeV": 0.254254, "weC": 0.077239, "cnc": 323.2},
  "SO2": {"weV": 0.277942, "aeV": 0.267754, "weC": 0.004136, "cnc": 27.6},
  "H2S": {"weV": 0.221816, "aeV": 0.269817, "weC": -0.006301, "cnc": 29.6},
  "pt1": {"v": 0.321411, "tmp": 21.9},
  "sht": {"hmd": 73.0, "tmp": 21.4}}}
"""

from collections import OrderedDict

from scs_core.sample.sample import Sample


# TODO: get src from AFE data interpretation?

# --------------------------------------------------------------------------------------------------------------------

class GasesSample(Sample):
    """
    classdocs
    """

    # ----------------------------------------------------------------------------------------------------------------

    def __init__(self, tag, rec, ndir_datum, afe_datum, sht_datum):
        """
        Constructor
        """
        jdict = OrderedDict()

        if ndir_datum is not None:
            jdict['CO2'] = ndir_datum

        if afe_datum is not None:
            for key, value in afe_datum.sns.items():
                jdict[key] = value

            if afe_datum.pt1000 is not None:
                jdict['pt1'] = afe_datum.pt1000

        if sht_datum is not None:
            jdict['sht'] = sht_datum

        super().__init__(tag, None, rec, jdict)
{'fraction_non_alphanumeric': 0.30963972736124634, 'fraction_numerical': 0.09866926322622525, 'mean_word_length': 1.5683333333333334, 'pattern_counts': {'":': 58, '<': 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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2870138', 'n_tokens_mistral': 1296, 'n_tokens_neox': 1084, 'n_words': 256}