<commit_before><!DOCTYPE html>
<html lang="en">
  <title> </title>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="vendor/tachyons.css">
  <body>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/ramda/0.23.0/ramda.min.js"></script>
        <script src="https://unpkg.com/mithril/mithril.js"></script>
        <script src="https://unpkg.com/mithril-stream"></script>
         <script src="vendor/paths.js"></script>
         <script src="https://cdnjs.cloudflare.com/ajax/libs/chroma-js/1.3.3/chroma.min.js"></script>
        <script src="https://www.gstatic.com/firebasejs/3.7.1/firebase-app.js"></script>
        <script src="https://www.gstatic.com/firebasejs/3.7.1/firebase-auth.js"></script>
        <script src="https://www.gstatic.com/firebasejs/3.7.1/firebase-database.js"></script>
        <script src="https://www.gstatic.com/firebasejs/3.7.1/firebase-messaging.js"></script>
        <script src="vendor/papa.js"></script>


        <script>


        
            /// Firebase and Variable Calculation
             var config = {
                    apiKey: "AIzaSyD_UYUYEG2DIfdw18YTrMsda0GhImCsMN4",
                    authDomain: "odisha-dash.firebaseapp.com",
                    databaseURL: "https://odisha-dash.firebaseio.com",
                    storageBucket: "odisha-dash.appspot.com",
                    messagingSenderId: "534292583836"
                };
            firebase.initializeApp(config);

            //stub for selecting district
            var selectedDistrict = stream("kandhamal")
            var selectedTahasil = stream("washington")
           

            //all data - use listRevenueData for further transformations
            var rawRevenueData = stream();
            var listRevenueData = rawRevenueData.map(function(value){
                return R.values(value)
            });

            //helpers
            var isInDistrict = R.propEq('district')
            var isInTahasil = R.propEq('tahasil')
            var isInCircle = R.propEq('circle')

            var defaultToZero = R.defaultTo(0)

            var takeHouseholds = R.compose(defaultToZero, R.prop('households identified'))
            var sumHouseholds = R.compose(R.sum, R.map(takeHouseholds))
            var takePattas = R.compose(defaultToZero,R.prop('pattas distributed'))
            var sumPattas = R.compose(R.sum, R.map(takePattas))
            var takeWomenPattas = R.compose(defaultToZero, R.prop('pattas with women'))
            var sumWomenPattas = R.compose(R.sum, R.map(takeWomenPattas))

            function classSafe(string){
                return string.replace(".","*").replace(" ","-")
            }

            function classUnsafe(string){
                return string.replace("*",".").replace("-"," ")
            }
            
            var firebaseSafe = function(string){
               return string.replace(".","~")
            }

           

            //District Helpers
            var allInDistrict = stream([]);
            allInDistrict = stream.combine(function(data, selected){
                var isInSelected = isInDistrict(selected());
                return R.filter(isInSelected, data());
            },[listRevenueData, selectedDistrict]);

            
           var totalHouseholds = allInDistrict.map(function(value){
               return sumHouseholds(value)
           })

           var totalPattas = allInDistrict.map(function(value){
               return sumPattas(value)
           })

           var totalWomenPattas = allInDistrict.map(function(value){
               return sumWomenPattas(value)
           })

            //State Helpers
            var stateData = listRevenueData.map(function(value){
                return {
                    "households": sumHouseholds(value),
                    "pattas": sumPattas(value),
                    "women": sumWomenPattas(value)
               }
            })

            var allDistricts = listRevenueData.map(function(value){
               var takeDistricts = R.map(R.prop('district'))
               var defaultToList = R.defaultTo([])
               var uniqueDistricts = R.compose(R.uniq, takeDistricts)
               List["districts"].items = uniqueDistricts(value)
               return uniqueDistricts(value)
           })

            var districtData = function(district){
               var all = listRevenueData()
               var isInSelected = isInDistrict(district)
               var filtered = R.filter(isInSelected, all)
               return {
                    "district": district,
                    "households": sumHouseholds(filtered),
                    "pattas": sumPattas(filtered),
                    "women": sumWomenPattas(filtered)
               }
           }
        
           //TahasilHelpers
           var tahasilsInDistrict = allInDistrict.map(function(value){
               var takeTahasils = R.map(R.prop('tahasil'))
               var defaultToList = R.defaultTo([])
               var uniqueTahasils = R.compose(R.uniq, takeTahasils)
               List["tahasils"].items = uniqueTahasils(value)
               return uniqueTahasils(value)
           })

           var tahasilData = function(tahasil){
               var district = allInDistrict()
               var isInSelected = isInTahasil(tahasil)
               var filtered = R.filter(isInSelected, district)
               return {
                    "tahasil": tahasil,
                    "households": sumHouseholds(filtered),
                    "pattas": sumPattas(filtered),
                    "women": sumWomenPattas(filtered)
               }
           }
        
            var allInTahasil = stream([]);
            allInTahasil = stream.combine(function(data, tahasil){
                var isInSelected = isInTahasil(tahasil())
                var filtered = R.filter(isInSelected, tahasil())
                return R.filter(isInSelected, data());
           },[allInDistrict, selectedTahasil]);

           var circlesInTahasil = allInTahasil.map(function(value){
               var takeCircles = R.map(R.prop('circle'))
               var defaultToList = R.defaultTo([])
               var uniqueCircles = R.compose(R.uniq, takeCircles)
               List["circles"].items = uniqueCircles(value)
               return uniqueCircles(value)
           })
           
            var circleData = function(circle){
               var tahasil = allInTahasil()
               var selected = R.find(isInCircle(circle), tahasil)
               return {
                   circle: circle,
                   households: selected["households identified"],
                   pattas: selected["pattas distributed"],
                   women: selected["pattas with women"]
               }
           }

           function titleCase(str) {
            return str.toLowerCase().split(' ').map(function(word) {
                return word.replace(word[0], word[0].toUpperCase());
            }).join(' ');
            }

           var byteEncode = function(text){
            encoder = new TextEncoder()
            return encoder.encode(text)
            }
              var cleanup = function(data){
                var cleaned = data.map(function(item){
                    return {                    
                        "District": titleCase(item.district),
                        "Tahasil": titleCase(item.tahasil),
                        "Circle": titleCase(item.circle),
                        "Households Identified": item["households identified"],
                        "Pattas Distributed": item["pattas distributed"],
                        "Women-Inclusive Pattas": item["pattas with women"]
                    }
                })
                return cleaned;
            }
            var makeCsv = function(data){<commit_msg>remove titlecase feature<commit_after><!DOCTYPE html>
<html lang="en">
  <title> </title>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="vendor/tachyons.css">
  <body>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/ramda/0.23.0/ramda.min.js"></script>
        <script src="https://unpkg.com/mithril/mithril.js"></script>
        <script src="https://unpkg.com/mithril-stream"></script>
         <script src="vendor/paths.js"></script>
         <script src="https://cdnjs.cloudflare.com/ajax/libs/chroma-js/1.3.3/chroma.min.js"></script>
        <script src="https://www.gstatic.com/firebasejs/3.7.1/firebase-app.js"></script>
        <script src="https://www.gstatic.com/firebasejs/3.7.1/firebase-auth.js"></script>
        <script src="https://www.gstatic.com/firebasejs/3.7.1/firebase-database.js"></script>
        <script src="https://www.gstatic.com/firebasejs/3.7.1/firebase-messaging.js"></script>
        <script src="vendor/papa.js"></script>


        <script>


        
            /// Firebase and Variable Calculation
             var config = {
                    apiKey: "AIzaSyD_UYUYEG2DIfdw18YTrMsda0GhImCsMN4",
                    authDomain: "odisha-dash.firebaseapp.com",
                    databaseURL: "https://odisha-dash.firebaseio.com",
                    storageBucket: "odisha-dash.appspot.com",
                    messagingSenderId: "534292583836"
                };
            firebase.initializeApp(config);

            //stub for selecting district
            var selectedDistrict = stream("kandhamal")
            var selectedTahasil = stream("washington")
           

            //all data - use listRevenueData for further transformations
            var rawRevenueData = stream();
            var listRevenueData = rawRevenueData.map(function(value){
                return R.values(value)
            });

            //helpers
            var isInDistrict = R.propEq('district')
            var isInTahasil = R.propEq('tahasil')
            var isInCircle = R.propEq('circle')

            var defaultToZero = R.defaultTo(0)

            var takeHouseholds = R.compose(defaultToZero, R.prop('households identified'))
            var sumHouseholds = R.compose(R.sum, R.map(takeHouseholds))
            var takePattas = R.compose(defaultToZero,R.prop('pattas distributed'))
            var sumPattas = R.compose(R.sum, R.map(takePattas))
            var takeWomenPattas = R.compose(defaultToZero, R.prop('pattas with women'))
            var sumWomenPattas = R.compose(R.sum, R.map(takeWomenPattas))

            function classSafe(string){
                return string.replace(".","*").replace(" ","-")
            }

            function classUnsafe(string){
                return string.replace("*",".").replace("-"," ")
            }
            
            var firebaseSafe = function(string){
               return string.replace(".","~")
            }

           

            //District Helpers
            var allInDistrict = stream([]);
            allInDistrict = stream.combine(function(data, selected){
                var isInSelected = isInDistrict(selected());
                return R.filter(isInSelected, data());
            },[listRevenueData, selectedDistrict]);

            
           var totalHouseholds = allInDistrict.map(function(value){
               return sumHouseholds(value)
           })

           var totalPattas = allInDistrict.map(function(value){
               return sumPattas(value)
           })

           var totalWomenPattas = allInDistrict.map(function(value){
               return sumWomenPattas(value)
           })

            //State Helpers
            var stateData = listRevenueData.map(function(value){
                return {
                    "households": sumHouseholds(value),
                    "pattas": sumPattas(value),
                    "women": sumWomenPattas(value)
               }
            })

            var allDistricts = listRevenueData.map(function(value){
               var takeDistricts = R.map(R.prop('district'))
               var defaultToList = R.defaultTo([])
               var uniqueDistricts = R.compose(R.uniq, takeDistricts)
               List["districts"].items = uniqueDistricts(value)
               return uniqueDistricts(value)
           })

            var districtData = function(district){
               var all = listRevenueData()
               var isInSelected = isInDistrict(district)
               var filtered = R.filter(isInSelected, all)
               return {
                    "district": district,
                    "households": sumHouseholds(filtered),
                    "pattas": sumPattas(filtered),
                    "women": sumWomenPattas(filtered)
               }
           }
        
           //TahasilHelpers
           var tahasilsInDistrict = allInDistrict.map(function(value){
               var takeTahasils = R.map(R.prop('tahasil'))
               var defaultToList = R.defaultTo([])
               var uniqueTahasils = R.compose(R.uniq, takeTahasils)
               List["tahasils"].items = uniqueTahasils(value)
               return uniqueTahasils(value)
           })

           var tahasilData = function(tahasil){
               var district = allInDistrict()
               var isInSelected = isInTahasil(tahasil)
               var filtered = R.filter(isInSelected, district)
               return {
                    "tahasil": tahasil,
                    "households": sumHouseholds(filtered),
                    "pattas": sumPattas(filtered),
                    "women": sumWomenPattas(filtered)
               }
           }
        
            var allInTahasil = stream([]);
            allInTahasil = stream.combine(function(data, tahasil){
                var isInSelected = isInTahasil(tahasil())
                var filtered = R.filter(isInSelected, tahasil())
                return R.filter(isInSelected, data());
           },[allInDistrict, selectedTahasil]);

           var circlesInTahasil = allInTahasil.map(function(value){
               var takeCircles = R.map(R.prop('circle'))
               var defaultToList = R.defaultTo([])
               var uniqueCircles = R.compose(R.uniq, takeCircles)
               List["circles"].items = uniqueCircles(value)
               return uniqueCircles(value)
           })
           
            var circleData = function(circle){
               var tahasil = allInTahasil()
               var selected = R.find(isInCircle(circle), tahasil)
               return {
                   circle: circle,
                   households: selected["households identified"],
                   pattas: selected["pattas distributed"],
                   women: selected["pattas with women"]
               }
           }

           function titleCase(str) {
            return str.toLowerCase().split(' ').map(function(word) {
                return word.replace(word[0], word[0].toUpperCase());
            }).join(' ');
            }

           var byteEncode = function(text){
            encoder = new TextEncoder()
            return encoder.encode(text)
            }
              var cleanup = function(data){
                var cleaned = data.map(function(item){
                    return {                    
                        "District": item.district,
                        "Tahasil": item.tahasil,
                        "Circle": item.circle,
                        "Households Identified": item["households identified"],
                        "Pattas Distributed": item["pattas distributed"],
                        "Women-Inclusive Pattas": item["pattas with women"]
                    }
                })
                return cleaned;
            }
            var makeCsv = function(data){
{'fraction_non_alphanumeric': 0.11528694768918232, 'fraction_numerical': 0.005078720162519045, 'mean_word_length': 1.6338404949005183, 'pattern_counts': {'":': 34, '<': 59, '<?xml version=': 0, '>': 59, 'https://': 18, 'lorem ipsum': 0, 'www.': 8, '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': '1655867', 'n_tokens_mistral': 4525, 'n_tokens_neox': 4192, 'n_words': 717}