<commit_before>//
//  PredictedBG.swift
//  RileyLink
//
//  Created by <NAME> on 8/8/16.
//  Copyright © 2016 <NAME>. All rights reserved.
//

import Foundation
import HealthKit

public struct PredictedBG {
    let values: [Double]
    let cob: [Double]?
    let iob: [Double]?

    public init(values: [HKQuantity], cob: [HKQuantity]? = nil, iob: [HKQuantity]? = nil) {
        // BG values in nightscout are in mg/dL.
        let unit = HKUnit.milligramsPerDeciliterUnit()
        self.values = values.map { $0.doubleValueForUnit(unit) }
        self.cob = cob?.map { $0.doubleValueForUnit(unit) }
        self.iob = iob?.map { $0.doubleValueForUnit(unit) }
    }

    public var dictionaryRepresentation: [String: AnyObject] {

        var rval = [String: AnyObject]()

        rval["values"] = values

        if let cob = cob {
            rval["cob"] = cob
        }

        if let iob = iob {
            rval["iob"] = iob
        }

        return rval
    }
}
<commit_msg>Fix case of carb and insulin effect attributes<commit_after>//
//  PredictedBG.swift
//  RileyLink
//
//  Created by <NAME> on 8/8/16.
//  Copyright © 2016 <NAME>. All rights reserved.
//

import Foundation
import HealthKit

public struct PredictedBG {
    let values: [Double]
    let cob: [Double]?
    let iob: [Double]?

    public init(values: [HKQuantity], cob: [HKQuantity]? = nil, iob: [HKQuantity]? = nil) {
        // BG values in nightscout are in mg/dL.
        let unit = HKUnit.milligramsPerDeciliterUnit()
        self.values = values.map { $0.doubleValueForUnit(unit) }
        self.cob = cob?.map { $0.doubleValueForUnit(unit) }
        self.iob = iob?.map { $0.doubleValueForUnit(unit) }
    }

    public var dictionaryRepresentation: [String: AnyObject] {

        var rval = [String: AnyObject]()

        rval["values"] = values

        if let cob = cob {
            rval["COB"] = cob
        }

        if let iob = iob {
            rval["IOB"] = iob
        }

        return rval
    }
}

{'fraction_non_alphanumeric': 0.13006503251625812, 'fraction_numerical': 0.011005502751375688, 'mean_word_length': 2.1446540880503147, 'pattern_counts': {'":': 0, '<': 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': '7052945', 'n_tokens_mistral': 707, 'n_tokens_neox': 657, 'n_words': 175}