<!--
-***********************************************************************
- * Title: PDosage
- * Description: Pediatric Dose Calculator
- * Author: Agnibho Mondal
- * Website: http://code.agnibho.com
- **********************************************************************
- Copyright (c) 2016 Agnibho Mondal
- All rights reserved
- **********************************************************************
- This file is part of PDosage.
-
- PDosage is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- PDosage is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with PDosage. If not, see <http://www.gnu.org/licenses/>.
-***********************************************************************
+ ***********************************************************************
+ * Title: PDosage
+ * Description: Pediatric Dose Calculator
+ * Author: Agnibho Mondal
+ * Website: http://code.agnibho.com
+ **********************************************************************
+ Copyright (c) 2016 Agnibho Mondal
+ All rights reserved
+ **********************************************************************
+ This file is part of PDosage.
+
+ PDosage is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ PDosage is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with PDosage. If not, see <http://www.gnu.org/licenses/>.
+ ***********************************************************************
-->
<!DOCTYPE html>
<html>
- <head>
- <title>PDosage</title>
- <link rel="icon" href="dist/logo.png">
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <script>
- var VERSION="0.0.1";
- </script>
- <style>
- .loader {
- position: absolute;
- left: 50%;
- top: 50%;
- border: 16px solid lavender;
- border-top: 16px solid #428bca;
- border-bottom: 16px solid #428bca;
- border-radius: 50%;
- width: 150px;
- height: 150px;
- margin: -75px 0 0 -75px;
- animation: spin 2s linear infinite;
- }
-
- @keyframes spin {
- 0% { transform: rotate(0deg); }
- 100% { transform: rotate(360deg); }
- }
- </style>
-
- </head>
- <body>
- <div class="loader"></div>
- <div class="container" style="display:none">
- <div id="notify" style="position:fixed;margin:10px;z-index:10;display:none">
- <div id="notify-alert" class="alert alert-info alert-dismissible">
- <button type="button" class="close" data-dismiss="alert"><span>×</span></button>
- <h4><span id="notify-text"></span> <a id="notify-link" href="#" class="btn btn-success btn-lg">Download</a></h4>
- </div>
- </div>
- <div class="text-primary">
- <div class="jumbotron">
- <h1>PDosage</h1>
- <h2>Drug Dose Calculator</h2>
- </div>
- </div>
- <div class="row" id="app">
- <data-input :patient="patient"></data-input>
- <div>
- <ul class="nav nav-tabs">
- <li class="active"><a href="#fav" data-toggle="tab">Favorites</a></li>
- <li><a href="#all" data-toggle="tab">All Drugs</a></li>
- <li><a href="#calc" data-toggle="tab">Calculator</a></li>
- <li><a href="#about" data-toggle="tab">About</a></li>
- </ul>
- <div class="tab-content">
- <div class="tab-pane active" id="fav">
- <quick-view :patient="patient" :dosage="dosage" :favs="favs"></quick-view>
- </div>
- <div class="tab-pane" id="all">
- <list-view :patient="patient" :dosage="dosage" :favs="favs"></list-all>
- </div>
- <div class="tab-pane" id="calc">
- <calculator-view></calculator-view>
- </div>
- <div class="tab-pane" id="about">
- <about-view></about-view>
- </div>
- </div>
- </div>
- </div>
- <div class="alert alert-info">
- <h3>Copyright © <span class="copyright" data-start="2016">2016</span> Agnibho Mondal</h3>
- <h4><a href="http://www.agnibho.com" style="text-decoration:none;color:inherit">www.agnibho.com</a></h4>
- </div>
- </div>
- <script src="dist/bundle.js"></script>
- </body>
+ <head>
+ <title>PDosage</title>
+ <link rel="icon" href="dist/logo.png">
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <script>
+var NAME="PDosage";
+var VERSION="0.0.1";
+var STORAGE="pdosage_date";
+var INFO_URL="https://code.agnibho.com/pdosage/info.json";
+var NOTIFY=true;
+ </script>
+ <style>
+.loader {
+ position: absolute;
+ left: 50%;
+ top: 50%;
+ border: 16px solid lavender;
+ border-top: 16px solid #428bca;
+ border-bottom: 16px solid #428bca;
+ border-radius: 50%;
+ width: 150px;
+ height: 150px;
+ margin: -75px 0 0 -75px;
+ animation: spin 2s linear infinite;
+}
+
+ @keyframes spin {
+ 0% { transform: rotate(0deg); }
+ 100% { transform: rotate(360deg); }
+ }
+ </style>
+
+ </head>
+ <body>
+ <div class="loader"></div>
+ <div class="container" style="display:none">
+ <div id="notify" style="position:fixed;margin:10px;z-index:10;display:none">
+ <div id="notify-alert" class="alert alert-info alert-dismissible">
+ <button type="button" class="close" data-dismiss="alert"><span>×</span></button>
+ <h4><span id="notify-text"></span> <a id="notify-link" href="#" class="btn btn-success btn-lg">Download</a></h4>
+ </div>
+ </div>
+ <div class="text-primary">
+ <div class="jumbotron">
+ <h1>PDosage</h1>
+ <h2>Drug Dose Calculator</h2>
+ </div>
+ </div>
+ <div class="row" id="app">
+ <data-input :patient="patient"></data-input>
+ <div>
+ <ul class="nav nav-tabs">
+ <li class="active"><a href="#fav" data-toggle="tab">Favorites</a></li>
+ <li><a href="#all" data-toggle="tab">All Drugs</a></li>
+ <li><a href="#calc" data-toggle="tab">Calculator</a></li>
+ <li><a href="#about" data-toggle="tab">About</a></li>
+ </ul>
+ <div class="tab-content">
+ <div class="tab-pane active" id="fav">
+ <quick-view :patient="patient" :dosage="dosage" :favs="favs"></quick-view>
+ </div>
+ <div class="tab-pane" id="all">
+ <list-view :patient="patient" :dosage="dosage" :favs="favs"></list-all>
+ </div>
+ <div class="tab-pane" id="calc">
+ <calculator-view></calculator-view>
+ </div>
+ <div class="tab-pane" id="about">
+ <about-view></about-view>
+ </div>
+ </div>
+ </div>
+ </div>
+ <div class="alert alert-info">
+ <h3>Copyright © <span class="copyright" data-start="2016">2016</span> Agnibho Mondal</h3>
+ <h4><a href="http://www.agnibho.com" style="text-decoration:none;color:inherit">www.agnibho.com</a></h4>
+ </div>
+ </div>
+ <script src="dist/bundle.js"></script>
+ </body>
</html>
var fs=require("fs");
var bigData={id:"com.agnibho.com.pdosage.data", timestamp: Date.now(), version: 0};
+bigData.version=parseInt(new Date().toISOString().slice(0,10).replace(/-/g, ""))+0.1;
if(process.argv[2]=="watch"){
fs.watch(DATA_SRC, jsonCat);
--- /dev/null
+{
+ "name": "Amlodipine",
+ "form": [
+ {
+ "mode": "Oral",
+ "gen": true,
+ "dose":
+ {
+ "perKg": [
+ 0.05,
+ 0.5
+ ],
+ "adult": [
+ 5,
+ 10
+ ],
+ "unit": "mg",
+ "txt": "OD"
+ }
+ },
+ {
+ "mode": "Oral",
+ "content": "2.5mg",
+ "dose":
+ {
+ "approx": [
+ 2.5,
+ "0.05*bw",
+ "0.5*bw"
+ ],
+ "adult": [
+ 2,
+ 4
+ ],
+ "unit": "tab",
+ "txt": "OD"
+ }
+ },
+ {
+ "mode": "Oral",
+ "content": "5mg",
+ "dose":
+ {
+ "approx": [
+ 5,
+ "0.05*bw",
+ "0.5*bw"
+ ],
+ "adult": [
+ 1,
+ 2
+ ],
+ "unit": "tab",
+ "txt": "OD"
+ }
+ },
+ {
+ "mode": "Oral",
+ "content": "10mg",
+ "dose":
+ {
+ "approx": [
+ 10,
+ "0.05*bw",
+ "0.5*bw"
+ ],
+ "adult": [
+ 0.5,
+ 1
+ ],
+ "unit": "tab",
+ "txt": "OD"
+ }
+ }
+ ]
+}
--- /dev/null
+{
+ "name": "Azithromycin",
+ "form": [
+ {
+ "mode": "Oral",
+ "gen": true,
+ "range": [
+ {
+ "min": "6m",
+ "max": "12y",
+ "dose": [
+ {
+ "perKg": 10,
+ "unit": "mg",
+ "txt": "per day on day 1"
+ },
+ {
+ "perKg": 5,
+ "unit": "mg",
+ "txt": "per day on next 4 days"
+ },
+ {
+ "perKg": 30,
+ "unit": "mg",
+ "txt": "single dose"
+ },
+ {
+ "perKg": 20,
+ "unit": "mg",
+ "txt": "per day x 7-14 days for enteric fever"
+ },
+ {
+ "perKg": 20,
+ "unit": "mg",
+ "txt": "single dose for cholera"
+ }
+ ]
+ },
+ {
+ "min": "12y",
+ "dose": [
+ {
+ "val": 500,
+ "unit": "mg",
+ "txt": "OD x 3 days"
+ },
+ {
+ "val": 500,
+ "unit": "mg",
+ "txt": "on day 1"
+ },
+ {
+ "val": 250,
+ "unit": "mg",
+ "txt": "on day 2-5",
+ "comment": "total dose 1.5 gm"
+ },
+ {
+ "val": 1000,
+ "unit": "mg",
+ "txt": "single dose"
+ }
+ ]
+ }
+ ]
+ }
+ ],
+ "comment": "Available forms- Tab 100mg,250mg,500mg; Syr 100mg/5ml,200mg/5ml"
+}
--- /dev/null
+{
+ "name": "Metronidazole",
+ "form": [
+ {
+ "mode": "Oral",
+ "gen": true,
+ "dose": {
+ "perKg": [
+ 15,
+ 20
+ ],
+ "adult": [
+ 200,
+ 400
+ ],
+ "unit": "mg",
+ "txt": "q 8 hr x 5-7 days for giardiasis"
+ }
+ },
+ {
+ "mode": "Oral",
+ "gen": true,
+ "dose": {
+ "perKg": [
+ 35,
+ 50
+ ],
+ "adult": [
+ 200,
+ 400
+ ],
+ "unit": "mg",
+ "txt": "q 8 hr x 10 days for amebiasis"
+ }
+ },
+ {
+ "mode": "Oral",
+ "gen": true,
+ "dose": {
+ "perKg": 20,
+ "adult": [
+ 200,
+ 400
+ ],
+ "unit": "mg",
+ "txt": "q 8 hr x 7-10 days for antibiotic associated diarrhea"
+ }
+ },
+ {
+ "mode": "Oral",
+ "gen": true,
+ "dose": {
+ "perKg": 20,
+ "adult": [
+ 200,
+ 400
+ ],
+ "unit": "mg",
+ "txt": "q 6 hr for anerobic infections"
+ }
+ },
+ {
+ "mode": "IV",
+ "gen": true,
+ "dose": {
+ "perKg": 20,
+ "adult": [
+ 200,
+ 400
+ ],
+ "unit": "mg",
+ "txt": "q 6 hr for anerobic infections"
+ }
+ }
+ ],
+ "comment": "Available forms- Tab 200mg,400mg; Susp 200mg/5ml,100mg/5ml; Inj 500mg/100ml."
+}
--- /dev/null
+{
+ "name": "Piperacillin / Tazobactum",
+ "form": [
+ {
+ "mode": "IV",
+ "gen": true,
+ "dose": {
+ "perKg": [
+ 0.3,
+ 0.4
+ ],
+ "adult": [
+ 12,
+ 15
+ ],
+ "unit": "gm",
+ "txt": "per day q 8 hr"
+ }
+ },
+ {
+ "mode": "IV",
+ "content": "4gm/500mg",
+ "dose": {
+ "approx": [
+ 4,
+ "0.3*bw",
+ "0.4*bw"
+ ],
+ "adult": [
+ 3,
+ 3.75
+ ],
+ "unit": "vial",
+ "txt": "per day q 8 hr"
+ }
+ }
+ ]
+}
All rights reserved
**********************************************************************
This file is part of PDosage.
-
+
PDosage is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
-
+
PDosage is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
along with PDosage. If not, see <http://www.gnu.org/licenses/>.
**********************************************************************/
//Start app
new Vue({
- el: "#app",
- components: {
- "data-input": DataInput,
- "quick-view": QuickView,
- "list-view": ListView,
- "calculator-view": CalculatorView,
- "about-view": AboutView
- },
- data: {
- patient: {age: {y:30, m:null, d:null}, wt:50},
- dosage: "",
- favs: "[]"
- },
- created:function(){
- try{
- this.favs=JSON.parse(localStorage.getItem("pdosage_favs"));
- }
- finally{
- if(this.favs==null){
- this.favs=["Paracetamol", "Levosalbutamol", "Domperidone", "Drotaverine", "Ranitidine"];
- }
- }
- try{
- var loc=JSON.parse(localStorage.getItem("pdosage_data"));
- if(loc.version>data.version){
- this.dosage=new Dosage(loc.dosage);
- }
- else{
- localStorage.setItem("pdosage_data", JSON.stringify(data));
- }
- }
- catch(e){
- if(!this.dosage){
- this.dosage=new Dosage(data.dosage);
- localStorage.setItem("pdosage_data", JSON.stringify(data));
- }
- }
+ el: "#app",
+ components: {
+ "data-input": DataInput,
+ "quick-view": QuickView,
+ "list-view": ListView,
+ "calculator-view": CalculatorView,
+ "about-view": AboutView
+ },
+ data: {
+ patient: {age: {y:30, m:null, d:null}, wt:50},
+ dosage: "",
+ favs: "[]"
+ },
+ created:function(){
+ try{
+ this.favs=JSON.parse(localStorage.getItem("pdosage_favs"));
+ }
+ finally{
+ if(this.favs==null){
+ this.favs=["Paracetamol", "Levosalbutamol", "Domperidone", "Drotaverine", "Ranitidine"];
+ }
+ }
+ try{
+ var loc=JSON.parse(localStorage.getItem(STORAGE));
+ if(loc.version>data.version){
+ this.dosage=new Dosage(loc.dosage);
+ }
+ else{
+ this.dosage=new Dosage(data.dosage);
+ localStorage.setItem(STORAGE, JSON.stringify(data));
+ }
+ }
+ catch(e){
+ if(!this.dosage){
+ this.dosage=new Dosage(data.dosage);
+ localStorage.setItem(STORAGE, JSON.stringify(data));
+ }
}
+ }
});
//Routine jobs
/**********************************************************************
- * Title: PDosage
- * Description: Pediatric Calculator
+ * Title: DietSurvey
+ * Description: Nutritional Assessment App
* Author: Agnibho Mondal
* Website: http://code.agnibho.com
**********************************************************************
Copyright (c) 2016 Agnibho Mondal
All rights reserved
**********************************************************************
- This file is part of PDosage.
-
- PDosage is free software: you can redistribute it and/or modify
+ This file is part of DietSurvey.
+
+ DietSurvey is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
-
- PDosage is distributed in the hope that it will be useful,
+
+ DietSurvey is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
- along with PDosage. If not, see <http://www.gnu.org/licenses/>.
+ along with DietSurvey. If not, see <http://www.gnu.org/licenses/>.
**********************************************************************/
+$.ajaxSetup({cache:false});
+
$(document).ready(function(){
- //Disable cache
- $.ajaxSetup({"cache": false});
- //Remove loader
- $(".loader").remove();
- $(".container").fadeIn();
+ //Remove loader
+ $(".loader").remove();
+ $(".container").fadeIn();
- //Insert version code
- $(".version").text(VERSION);
- $(".data-ver").text(JSON.parse(localStorage.getItem("pdosage_data")).version);
+ //Insert version code
+ $(".version").text(VERSION);
+ try{
+ $(".data-ver").text(JSON.parse(localStorage.getItem(STORAGE)).version);
+ } catch(e){}
- //Update copyright
- $(".copyright").each(function(){
- if(new Date().getFullYear()>$(this).data("start")){
- $(this).text($(this).data("start")+"-"+new Date().getFullYear());
- }
- else{
- $(this).text(new Date().getFullYear());
- }
- });
+ //Update copyright
+ $(".copyright").each(function(){
+ if(new Date().getFullYear()>$(this).data("start")){
+ $(this).text($(this).data("start")+"-"+new Date().getFullYear());
+ }
+ else{
+ $(this).text(new Date().getFullYear());
+ }
+ });
- //Emit input on form reset
- $("input[type='reset']").on("click", function(e){
- this.form.reset();
- $(this.form).find("input, select, textarea").each(function(){
- this.dispatchEvent(new Event("input"));
- });
+ //Emit input on form reset
+ $("input[type='reset']").on("click", function(e){
+ this.form.reset();
+ $(this.form).find("input, select, textarea").each(function(){
+ this.dispatchEvent(new Event("input"));
});
+ });
- //Notifications
- $(window).resize(function(){
- $("#notify").width($(".container").width()-20);
- });
- $(window).scroll(function(){
- $("#notify").width($(".container").width()-20);
- });
+ //Change focus after number input
+ $(".jump-focus").on("input", function(){
+ if($(this).val().length == $(this).prop("maxlength")){
+ var all=$("input").toArray();
+ var i=all.indexOf(this)+1;
+ $(all[i]).focus().select();
+ }
+ });
+
+ //Defocus after input finished
+ $(".stop-focus").on("input", function(){
+ if($(this).val().length == $(this).prop("maxlength")){
+ $(this).blur();
+ var target=$($(this).data("ref"));
+ console.log($(target).offset());
+ $("html, body").animate({
+ scrollTop: $(target).offset().top
+ }, 1000);
+ }
+ });
- //Parse app info from server
- $.get("https://code.agnibho.com/pdosage/info.json", function(data){
- var vCurr=VERSION.split(".").map(Number);
- var vLtst=data.latest.split(".").map(Number);
-
- if(isBiggerThan(data.latest, VERSION)){
- $("#notify").slideDown();
- $("#notify").width($(".container").width()-20);
- $("#notify-text").text("A new version of PDosage is available.");
- if(document.URL.indexOf("http://")==-1 && document.URL.indexOf("https://")==-1){
- if(/(android)/i.test(navigator.userAgent)){
- $("#notify-link").attr("href", data.apk);
- $("#notify-link").text("Download");
- }
- else{
- $("#notify-link").attr("href", data.url);
- $("#notify-link").text("Load");
- }
- }
- else{
- $("#notify-link").attr("href", data.url);
- $("#notify-link").text("Load");
- }
- }
-
- try{
- if(data.data.latest>JSON.parse(localStorage.getItem("pdosage_data")).version){
- $.get(data.data.src, function(d){
- localStorage.setItem("pdosage_data", JSON.stringify(d));
- });
- }
- }
- catch(e){}
+ //Use custom datepicker if Firefox
+ if($(".datepicker").length && navigator.userAgent.indexOf("Firefox")!=-1){
+ $(".datepicker").datepicker({
+ format:"yyyy-mm-dd",
+ autoclose:true
+ }).on("changeDate", function(){
+ this.dispatchEvent(new Event("input"));
});
+ }
- //Compare versions
+ //Notifications
+ $(window).resize(function(){
+ $("#notify").width($(".container").width()-20);
+ });
+ $(window).scroll(function(){
+ $("#notify").width($(".container").width()-20);
+ });
+ //Get data from server
+ $.get(INFO_URL, function(data){
+ var vCurr=VERSION.split(".").map(Number);
+ var vLtst=data.latest.split(".").map(Number);
+ //Define version comparator
function isBiggerThan(v1, v2){
- while(v1.length<v2.length){
- v1.push(0);
- }
- while(v2.length<v1.length){
- v2.push(0);
- }
- for(var i=0; i<v1.length; i++){
- if(v1[i]>v2[i]){
- return true;
- }
- }
- return false;
+ while(v1.length<v2.length){
+ v1.push(0);
+ }
+ while(v2.length<v1.length){
+ v2.push(0);
+ }
+ for(var i=0; i<v1.length; i++){
+ if(v1[i]>v2[i]){
+ return true;
+ }
+ }
+ return false;
+ }
+ //Compare versions
+ if(NOTIFY && isBiggerThan(data.latest, VERSION)){
+ $("#notify").slideDown();
+ $("#notify").width($(".container").width()-20);
+ $("#notify-text").text("A new version of "+NAME+" is available.");
+ if(document.URL.indexOf("http://")==-1 && document.URL.indexOf("https://")==-1){
+ if(/(android)/i.test(navigator.userAgent)){
+ $("#notify-link").attr("href", data.apk);
+ $("#notify-link").text("Download");
+ }
+ else{
+ $("#notify-link").attr("href", data.url);
+ $("#notify-link").text("Load");
+ }
+ }
+ else{
+ $("#notify-link").attr("href", data.url);
+ $("#notify-link").text("Load");
+ }
+ }
+ //Update app data
+ try{
+ if(data.data.latest>JSON.parse(localStorage.getItem(STORAGE)).version){
+ $.get(data.data.src, function(d){
+ localStorage.setItem(STORAGE, JSON.stringify(d));
+ });
+ }
}
+ catch(e){}
+ });
});