<commit_before>
  <script src="js/src/patient-view/clinical-timeline.js"></script>

  <style type="text/css">
    .axis path,
    .axis line {
      fill: none;
      stroke: black;
      shape-rendering: crispEdges;
    }

    .axis text {
      font-family: sans-serif;
      font-size: 10px;
    }

    .timeline-label {
      font-family: sans-serif;
      font-size: 12px;
    }
    
    #timeline .axis {
      transform: translate(0px,30px);
      -ms-transform: translate(0px,30px); /* IE 9 */
      -webkit-transform: translate(0px,30px); /* Safari and Chrome */
      -o-transform: translate(0px,30px); /* Opera */
      -moz-transform: translate(0px,30px); /* Firefox */
    }

    .coloredDiv {
      height:20px; width:20px; float:left;
    }
  </style>
  
  <script type="text/javascript">

    $(document).ready(function(){
        
        var params = {
            type:"diagnostic,treatment,lab_test",
            cancer_study_id:cancerStudyId,
            patient_id:patientId
        }
        
        $.post("clinical_timeline_data.json", 
            params,
            function(data){
                if (cbio.util.getObjectLength(data)===0) return;
                
                var timeData = prepareTimelineData(data);

                var width = $("#td-content").width() - 50;
                var timeline = clinicalTimeline().itemHeight(12).stack();
                var svg = d3.select("#timeline").append("svg").attr("width", width).datum(timeData).call(timeline);
                $("#timeline-container").show();
            }
            ,"json"
        );
            
        function prepareTimelineData(timelineData) {
            var ret = [];
            
            if ("diagnostic" in timelineData) {
                ret.push({
                    label:"Diagnostics",
                    display:"circle",
                    times:formatTimePoints(timelineData["diagnostic"])});
            }
            
            if ("lab_test" in timelineData) {
                ret.push({
                    label:"Lab Tests",
                    display:"circle",
                    times:formatTimePoints(timelineData["lab_test"])});
            }
            
            if ("treatment" in timelineData) {
                ret.push({
                    label:"Therapy",
                    display:"rect",
                    times:formatTimePoints(timelineData["treatment"])});
            }
            
            return ret;
//            return [
//                    {label:"Diagnostics", display:"circle", times: [{"starting_time": 0, "tooltip":"First diagonosis"},{"starting_time": 200}, {"starting_time": 500}]},
//                    {label:"Lab Tests", display:"circle", times: [{"starting_time": -10}, ]},
//                    {label:"Therapy", display:"rect", times: [{"starting_time": 140, "ending_time": 360, "tooltip":"Chemo"}]},
//                  ];
        }
        
        function formatTimePoints(timePointsData) {
            var times = [];
            timePointsData.forEach(function(timePointData){
                times.push(formatATimePoint(timePointData));
            });
            return times;
        }
        
        function formatATimePoint(timePointData) {
            var startDate, stopDate;
            if ("date" in timePointData) {
                startDate = timePointData["date"];
                stopDate = startDate;
            } else {
                startDate = timePointData["startDate"];
                stopDate = timePointData["stopDate"];
            }
            
            var tooltip = [];
            for (var key in timePointData) {
                if (key.match(/(diagnosticId)|(treatmentId)|(diagnosticId)|(cancerStudyId)|(patientId)/)) continue;
                var value = timePointData[key];
                if (value===null) continue;
                tooltip.push("<td>"+key+"</td><td>"+value+"</td>");
            }
            
            return {
                starting_time : startDate,
                ending_time : stopDate,<commit_msg>fixed typo<commit_after>
  <script src="js/src/patient-view/clinical-timeline.js"></script>

  <style type="text/css">
    .axis path,
    .axis line {
      fill: none;
      stroke: black;
      shape-rendering: crispEdges;
    }

    .axis text {
      font-family: sans-serif;
      font-size: 10px;
    }

    .timeline-label {
      font-family: sans-serif;
      font-size: 12px;
    }
    
    #timeline .axis {
      transform: translate(0px,30px);
      -ms-transform: translate(0px,30px); /* IE 9 */
      -webkit-transform: translate(0px,30px); /* Safari and Chrome */
      -o-transform: translate(0px,30px); /* Opera */
      -moz-transform: translate(0px,30px); /* Firefox */
    }

    .coloredDiv {
      height:20px; width:20px; float:left;
    }
  </style>
  
  <script type="text/javascript">

    $(document).ready(function(){
        
        var params = {
            type:"diagnostic,treatment,lab_test",
            cancer_study_id:cancerStudyId,
            patient_id:patientId
        }
        
        $.post("clinical_timeline_data.json", 
            params,
            function(data){
                if (cbio.util.getObjectLength(data)===0) return;
                
                var timeData = prepareTimelineData(data);

                var width = $("#td-content").width() - 50;
                var timeline = clinicalTimeline().itemHeight(12).stack();
                var svg = d3.select("#timeline").append("svg").attr("width", width).datum(timeData).call(timeline);
                $("#timeline-container").show();
            }
            ,"json"
        );
            
        function prepareTimelineData(timelineData) {
            var ret = [];
            
            if ("diagnostic" in timelineData) {
                ret.push({
                    label:"Diagnostics",
                    display:"circle",
                    times:formatTimePoints(timelineData["diagnostic"])});
            }
            
            if ("lab_test" in timelineData) {
                ret.push({
                    label:"Lab Tests",
                    display:"circle",
                    times:formatTimePoints(timelineData["lab_test"])});
            }
            
            if ("treatment" in timelineData) {
                ret.push({
                    label:"Therapy",
                    display:"rect",
                    times:formatTimePoints(timelineData["treatment"])});
            }
            
            return ret;
//            return [
//                    {label:"Diagnostics", display:"circle", times: [{"starting_time": 0, "tooltip":"First diagonosis"},{"starting_time": 200}, {"starting_time": 500}]},
//                    {label:"Lab Tests", display:"circle", times: [{"starting_time": -10}, ]},
//                    {label:"Therapy", display:"rect", times: [{"starting_time": 140, "ending_time": 360, "tooltip":"Chemo"}]},
//                  ];
        }
        
        function formatTimePoints(timePointsData) {
            var times = [];
            timePointsData.forEach(function(timePointData){
                times.push(formatATimePoint(timePointData));
            });
            return times;
        }
        
        function formatATimePoint(timePointData) {
            var startDate, stopDate;
            if ("date" in timePointData) {
                startDate = timePointData["date"];
                stopDate = startDate;
            } else {
                startDate = timePointData["startDate"];
                stopDate = timePointData["stopDate"];
            }
            
            var tooltip = [];
            for (var key in timePointData) {
                if (key.match(/(diagnosticId)|(treatmentId)|(labTestId)|(cancerStudyId)|(patientId)/)) continue;
                var value = timePointData[key];
                if (value===null) continue;
                tooltip.push("<td>"+key+"</td><td>"+value+"</td>");
            }
            
            return {
                starting_time : startDate,
                ending_time : stopDate,
{'fraction_non_alphanumeric': 0.13575996064928678, 'fraction_numerical': 0.011067388096409248, 'mean_word_length': 1.533644859813084, 'pattern_counts': {'":': 16, '<': 21, '<?xml version=': 0, '>': 21, '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': '5454620', 'n_tokens_mistral': 2335, 'n_tokens_neox': 2128, 'n_words': 368}