-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreports.py
More file actions
2614 lines (2450 loc) · 115 KB
/
reports.py
File metadata and controls
2614 lines (2450 loc) · 115 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
import json,os,time,re,duckdb,uuid
from datetime import date
import pandas as pd
from glob import glob
from reportlab.pdfgen import canvas
from reportlab.lib.pagesizes import portrait,A4,A5
from reportlab.lib.units import inch
from reportlab.pdfbase.pdfmetrics import registerFont
from reportlab.pdfbase.ttfonts import TTFont
from dash import html,dcc,Input,Output,callback,register_page,State,ALL,ctx
from dash.exceptions import PreventUpdate
registerFont(TTFont("CenturySchoolBook-BoldItalic","assets/schlbkbi.ttf"))
big_break = [html.Br()] * 5
large_break = [html.Br()] * 10
small_break = [html.Br()] * 2
limits_style = dict(position="relative",left="550px",bottom="45px",fontSize=18)
input_style = dict(width="150px",height="25px",position="relative",left="360px",bottom="20px",fontSize=20)
text_style = dict(position="relative",left="80px",fontSize=20)
dtype_map = {
"S.No.": str, # Ensure "S.No." remains a string
"Date": str, # string in format "YYYY-MM-DD"
"Time": str, # string in format "HH:MM:SS AM/PM"
"Patient Name": str, # Patient Name as string
"Reference By": str, # string with options as given below
"Patient Age": "Float32", # Use Int16 for compactness and allow NaNs
"Age Group": str, # string with options as ["Y","M","D"]
"Gender": str, # string with options as ["Male","Female"]
"Amount": "Float64", # Amount as integer
"Method": str, # string with options as ["CASH","PHONE PAY"]
"Phone No": "Int64", # Phone number as integer
"Paid": str, # string with options ["PAID","NOT PAID","DUE"]
"Due": "Float64", # Due as integer as the due amount if due/not paid and full amount will be reflected as due if not paid
"Sample": str # string with options as ["SELF","RAJU","RAJESH","RAM"]
}
patients_dropdown = dcc.Dropdown(
placeholder="Select Serial Number..,",
id="patients-dropdown",
style=dict(height="50px")
)
all_options = [
"Hb",
"Total Count (TC)",
"Platelet Count",
"Differential Count (DC)",
"CRP",
"Blood Group",
"DENGUE",
"Widal",
"Full CBP",
"PCV(HCT)",
"ESR",
"Malaria",
"Total Bilirubin",
"Direct & Indirect Bilirubin",
"SGOT",
"SGPT",
"ALKP",
"Heamogram",
"HBA1C",
"Fasting Sugar",
"Random Sugar",
"Post Pandial Sugar",
"Urine Sugar(Fasting)",
"Urine Sugar(Random)",
"Stool Test",
"Blood Urea",
"Serum Creatinine",
"Uric Acid",
"Urine Analysis",
"Urine Pregnancy",
"Lipid Profile",
"Mantaoux",
"Heamogram",
"Blood for AEC Count",
"RA Factor",
"ASO Titre",
"BT",
"CT",
"PT APTT",
"Liver Function Test",
"Serum Amylase",
"Serum Lipase",
"Serum Protein",
"Serum Albumin",
"Serum Globulin",
"Serum A/G Ratio",
"Serum Sodium",
"Serum Potassium",
"Serum Chloride",
"Serum Calcium",
"Electrolytes",
"VDRL",
"HBsAg",
"HIV I & II Antibodies Test",
"HCV I & II Antibodies Test",
"Semen Analysis",
"XRAY Opinion",
"BILL"
]
reports_dropdown = dcc.Dropdown(
all_options,
id="reports-dropdown",
multi=True,
style=dict(height="100px",width="600px")
)
page_size_dropdown = dcc.Dropdown(
[
"SMALL/A5",
"BIG/A4"
],
"SMALL/A5",
id="page-size-dropdown"
)
templates_dropdown = dcc.Dropdown(
options = [
{"label":"SMALL RAMA KRISHNA HB, TC, PLATELET, DC","value":json.dumps(["Hb","Total Count (TC)","Platelet Count","Differential Count (DC)"])},
{"label":"SMALL RAMA KRISHNA HB, TC, PLATELET, DC, CRP","value":json.dumps(["Hb","Total Count (TC)","Platelet Count","Differential Count (DC)","CRP"])},
{"label":"SMALL RAMA KRISHNA HB, TC, DC","value":json.dumps(["Hb","Total Count (TC)","Differential Count (DC)"])},
{"label":"SMALL RAMA KRISHNA TOTAL BILIRUBIN, INDIRECT AND DIRECT BILIRUBIN","value":json.dumps(["Total Bilirubin","Direct & Indirect Bilirubin"])},
{"label":"SMALL RAMA KRISHNA BLOOD GROUP, CRP, TOTAL BILIRUBIN, DIRECT & INDIRECT BILIRUBIN","value":json.dumps(["Blood Group","CRP","Total Bilirubin","Direct & Indirect Bilirubin"])},
{"label":"SRI DEVI GARU CBP","value":json.dumps(["Full CBP","Blood Group","VDRL","HBsAg","HIV I & II Antibodies Test","HCV I & II Antibodies Test","Random Sugar","Serum Creatinine","Total Bilirubin","Urine Analysis"])},
{"label":"SRI DEVI GARU HIV HB URINE","value":json.dumps(["Blood Group","Hb","BT","CT","VDRL","HBsAg","HIV I & II Antibodies Test","HCV I & II Antibodies Test","Random Sugar","Serum Creatinine","Total Bilirubin","Urine Analysis"])},
{"label":"SRI DEVI GARU VDRL, HbsAg, HCV, HIV","value":json.dumps(["VDRL","HBsAg","HIV I & II Antibodies Test","HCV I & II Antibodies Test"])},
{"label":"HB, TC, PLATELET, DC, URINE","value":json.dumps(["Hb","Total Count (TC)","Platelet Count","Differential Count (DC)","Urine Analysis"])},
{"label":"HB, TC, PLATELET, DC, RBS","value":json.dumps(["Hb","Total Count (TC)","Platelet Count","Differential Count (DC)","Random Sugar"])},
{"label":"HB, TC, PLATELET, DC, WIDAL","value":json.dumps(["Hb","Total Count (TC)","Platelet Count","Differential Count (DC)","Widal"])},
{"label":"RATNA Full CBP","value":json.dumps(["Full CBP"])},
{"label":"SMALL SUGAR","value":json.dumps(["Fasting Sugar","Random Sugar"])},
{"label":"SMALL SUGAR with Urine Fasting","value":json.dumps(["Fasting Sugar","Random Sugar","Urine Sugar(Fasting)"])},
{"label":"SMALL SUGAR with Urine Random","value":json.dumps(["Fasting Sugar","Random Sugar","Urine Sugar(Random)"])},
{"label":"S PRASAD Full CBP, MALARIA, WIDAL CRP","value":json.dumps(["Full CBP","Malaria","Widal","CRP"])},
{"label":"S PRASAD Full CBP, WIDAL CRP","value":json.dumps(["Full CBP","Widal","CRP"])},
{"label":"PACK 1","value":json.dumps(["HBA1C","Fasting Sugar","Random Sugar"])},
{"label":"PACK 2","value":json.dumps(["Blood Urea","Serum Creatinine","Uric Acid","Lipid Profile"])},
{"label":"PACK 2 without Uric Acid","value":json.dumps(["Blood Urea","Serum Creatinine","Lipid Profile"])},
{"label":"Liver Function Test","value":json.dumps(["Total Bilirubin","Direct & Indirect Bilirubin","SGOT","SGPT","ALKP"])},
{"label":"RFT","value":json.dumps(["Blood Urea","Serum Creatinine","Uric Acid"])},
{"label":"Lipid Profile","value":json.dumps(["Lipid Profile"])},
{"label":"Full Electrolytes","value":json.dumps(["Serum Amylase","Serum Lipase","Serum Protein","Serum Albumin","Serum Globulin","Serum A/G Ratio","Electrolytes"])},
],
id="template-dropdown"
)
layout = html.Div(
[
html.Div(html.H1("Patients report",className="page-heading"),className="heading-divs"),
*big_break,
html.Div(patients_dropdown,style=dict(width="400px",fontSize=20,fontWeight=700,alignItems="center")),
dcc.DatePickerSingle(
id="date-pick-reports",
min_date_allowed=date(1995,8,5),
max_date_allowed=date.today(),
date=date.today(),
style=dict(positon="relative",left="500px",bottom="120px")
),
*large_break,
html.Div(reports_dropdown,style=dict(width="650px",fontWeight=700,alignItems="center")),
html.Div(page_size_dropdown,style=dict(width="200px",fontWeight=700,alignItems="center",position="relative",left="650px",bottom="50px")),
html.Div(templates_dropdown,style=dict(width="800px",fontWeight=700,alignItems="center",position="relative",left="900px",bottom="100px")),
*large_break,
html.Div(id="output-report",style=dict(border="2px solid rgba(0,255,255,0.7)",borderBottom=None,padding="20px",position="relative",left="100px",width="900px",fontSize=18)),
html.Hr(style=dict(position="relative",left="100px",width="900px",border="1px solid cyan")),
html.Div("Test Value Reference",style=dict(wordSpacing="300px",paddingTop="20px",paddingLeft="50px",border="2px solid rgba(0,255,255,0.7)",borderTop=None,borderBottom=None,width="900px",height="50px",position="relative",left="100px")),
html.Hr(style=dict(position="relative",left="100px",width="900px",border="1px solid cyan")),
html.Div(id="output-report-boxes",style=dict(border="2px solid rgba(0,255,255,0.7)",borderTop=None,padding="2px",position="relative",paddingTop="50px",alignItems="center",left="100px",width="900px",fontSize=18)),
html.Button("Submit".upper(),id="submit-report-button",style=dict(width="200px",height="100px",position="relative",backgroundColor="cyan",left="800px",fontSize=25,borderRadius="20px")),
html.Div(html.H1("report preview".upper(),className="page-heading"),className="heading-divs",style=dict(position="relative",top="50px")),
html.Div(["top space slider ".upper(),dcc.Slider(min=0,max=200,step=20,value=0,id="top-slider")],style=dict(left="50px",position="relative",width="550px",fontSize=15)),
html.Div(["between space slider ".upper(),dcc.Slider(min=10,max=80,step=5,value=24,id="slider")],style=dict(left="50px",position="relative",width="550px",top="20px",fontSize=15)),
html.Div("type report to preview".upper(),id="report-preview",style=dict(color="cyan",border="10px solid #4b70f5",padding="50px",position="relative",width="60%",height="1300px",top="100px"),className="wrap"),
],
className="subpage-content"
)
@callback(
[
Output("patients-dropdown","options"),
Output("tab-id-store","data")
],
Input("date-pick-reports","date")
)
def append_report_options(date:str):
path = f"assets/all_files/{date.replace("-","_")}.csv"
if os.path.exists(path):
df = pd.read_csv(path,dtype=dtype_map)
df = df.iloc[:-1,:]
return df["S.No."].to_list(),str(uuid.uuid4())
return [],str(uuid.uuid4())
hb_list = [
html.Div("Heamoglobin :",style=text_style),
dcc.Input(id={'type':'dynamic-input','name':'hb'},type="number",placeholder="Type Hb Value..",style=input_style),
html.Div("( 11.0 - 16.8 Grams%)",style=limits_style),
]
tc_list = [
html.Div("Total WBC Count :",style=text_style),
dcc.Input(id={'type':'dynamic-input','name':'tc_count'},type="number",placeholder="Type Tc value..",style=input_style),
html.Div("( 5,000 - 10,000 Cells/cumm )",style=limits_style),
]
plt_list = [
html.Div("Platelet Count :",style=text_style),
dcc.Input(id={'type':'dynamic-input','name':'plt_count'},type="number",placeholder="Type Plt Value..",style=input_style),
html.Div("( 1.5 - 4.0 Lakhs/cumm )",style=limits_style),
]
dc_list = [
html.Div("Differential Count :",style=text_style),
html.Br(),
html.Br(),
html.Div("Polymorphs :",style=dict(position="relative",left="200px",fontSize=18)),
dcc.Input(id={'type':'dynamic-input','name':'polymo'},type="number",placeholder="Type polymorphs..",style=dict(position="relative",width="170px",left="400px",bottom="20px",fontSize=20)),
html.Div("( 40 - 70 %) ",style=dict(position="relative",left="670px",bottom="40px",fontSize=18)),
html.Div("Lymphocytes :",style=dict(position="relative",left="200px",fontSize=18)),
dcc.Input(id={'type':'dynamic-input','name':'lympho'},type="number",placeholder="Type Lymphocytes..",style=dict(position="relative",width="170px",left="400px",bottom="20px",fontSize=20)),
html.Div("( 20 - 40 %)",style=dict(position="relative",left="670px",bottom="40px",fontSize=18)),
html.Div("Esinophils :",style=dict(position="relative",left="200px",fontSize=18)),
dcc.Input(id={'type':'dynamic-input','name':'esino'},type="number",placeholder="Type Esinophils..",style=dict(position="relative",width="170px",left="400px",bottom="20px",fontSize=20)),
html.Div("( 02 - 06 %)",style=dict(position="relative",left="670px",bottom="40px",fontSize=18)),
html.Div("Monocytes :",style=dict(position="relative",left="200px",fontSize=18)),
html.Div("----------------",style=dict(position="relative",left="400px",bottom="20px")),
html.Div("( 01 - 04 %)",style=dict(position="relative",left="670px",bottom="40px",fontSize=18)),
]
crp_list = [
html.Div("CRP : ",style=text_style),
dcc.Input(id={'type':'dynamic-input','name':'crp'},type="number",placeholder="Type CRP value..",style=input_style),
html.Div(" ( < 6 ) ",style=limits_style)
]
malaria_list = [
*small_break,
html.Div("Test For Malaria Parasite (M.P): ",style=text_style),
html.Div(dcc.Dropdown(["non-reactive".upper(),"reactive".upper()],"non-reactive".upper(),id={"type":"dynamic-input","name":"malaria-mp"}),style={**input_style,"left":"500px","width":"200px"}),
html.Div([dcc.Dropdown(["Long".upper(),"Short".upper()],"Short".upper(),id={'type':'dynamic-input','name':'malaria-test'})],style={**input_style,"left":"750px","bottom":"25px"}),
html.Div("PLasmodium Vivex: ",style=text_style),
html.Div(dcc.Dropdown(["non-reactive".upper(),"reactive".upper()],"non-reactive".upper(),id={"type":"dynamic-input","name":"malaria-vivex"}),style={**input_style,"left":"500px","width":"200px"}),
html.Br(),
html.Div("PLasmodium Falciparum: ",style=text_style),
html.Div(dcc.Dropdown(["non-reactive".upper(),"reactive".upper()],"non-reactive".upper(),id={"type":"dynamic-input","name":"malaria-falci"}),style={**input_style,"left":"500px","width":"200px"}),
*small_break
]
widal_list = [
html.Div("Blood for Widal : ",style=text_style),
html.Div([dcc.Dropdown(["NON-REACTIVE","REACTIVE"],"REACTIVE",id={'type':'dynamic-input','name':'widal'})],style={**input_style,"width":"200px"}),
html.Div([dcc.Dropdown(["SHORT","LONG"],"LONG",id={'type':'dynamic-input','name':'widal-form'})],style=dict(position="relative",left="600px",bottom="50px",width="150px",height="50px")),
html.Br(),
html.Div(["OT-1 :",html.Div(dcc.Dropdown([160,80,40],80,id={'type':'dynamic-input','name':'widal-ot-react'}),style=dict(width="100px")),"dilutions"],style=dict(display="flex",gap="40px",position="relative",left="450px")),
html.Br(),
html.Div(["HT-1 :",html.Div(dcc.Dropdown([160,80,40],80,id={'type':'dynamic-input','name':'widal-ht-react'}),style=dict(width="100px")),"dilutions"],style=dict(display="flex",gap="40px",position="relative",left="450px")),
html.Br(),
html.Div("AH-1 : 40 dilutions",style=dict(position="relative",left="450px")),
html.Br(),
html.Div("BH-1 : 40 dilutions",style=dict(position="relative",left="450px")),
*small_break
]
blood_group_list = [
html.Div("Blood Group: ",style=text_style),
html.Div(
dcc.Dropdown(
options = ["O POSITIVE","A POSITIVE","B POSITIVE","AB POSITIVE","O NEGATIVE","A NEGATIVE","B NEGATIVE","AB NEGATIVE"],
id={'type':'dynamic-input','name':'blood-group'}
),
style={**input_style,"width":"200px"}
),
]
total_bilirubin_list = [
html.Div("Total Bilirubin : ",style=text_style),
dcc.Input(id={'type':'dynamic-input','name':'total-bili'},type="number",placeholder="Enter Total Bilirubin",style=input_style),
html.Div(" ( 0.2 - 1.0 mg/dl)",style=limits_style),
]
direct_indirect_bilirubin_list = [
html.Div("Direct Bilirubin: ",style=text_style),
dcc.Input(id={'type':'dynamic-input','name':'direct-bili'},type="number",placeholder="Enter Direct Bilirubin",style=input_style),
html.Div(" ( 0.2 - 0.4 mg/dl ) ",style=limits_style),
html.Div("Indirect Bilirubin: ",style=text_style),
html.Div("-----------",style=limits_style),
html.Div(" ( 0.2 - 0.6 mg/dl )",style=limits_style),
]
sgot_list = [
html.Div("Aspirate Amino Transferase (SGOT): ",style=text_style),
dcc.Input(id={'type':'dynamic-input','name':'sgot'},type="number",placeholder="29 (normal)",style={**input_style,"left":"500px"}),
html.Div("( < 40 )",style={**limits_style,"left":"700px"}),
]
sgpt_list = [
html.Div("Alinine Amino Transferase (SGPT): ",style=text_style),
dcc.Input(id={'type':'dynamic-input','name':'sgpt'},type="number",placeholder="29 (normal)",style={**input_style,"left":"500px"}),
html.Div("( < 40 )",style={**limits_style,"left":"700px"}),
]
alkp_list = [
html.Div("Alkaline Phosphatase (ALKP): ",style=text_style),
dcc.Input(id={'type':'dynamic-input','name':'alkp'},type="number",placeholder="29 (normal)",style={**input_style,"left":"500px"}),
html.Div("( 37 - 147 )",style={**limits_style,"left":"700px"}),
]
x_ray_list = [
html.P("""Rest of lung fields are normal .
Both hila normal in density .
Cardiac shape are normal .
Both CP angles are clear .
Bony cage and soft tissues are normal .
Opinion : NORMAL
For clinical correlation .
""",id={'type':'dynamic-input','name':'x-ray-opinion'}),
]
esr_list = [
html.Div("E.S.R : ",style=text_style),
dcc.Input(id={'type':'dynamic-input','name':'esr'},type="number",placeholder="E.S.R..,",value=10,style=input_style),
html.Div(" (02 - 10 mm/1 hour) ",style=limits_style),
]
hct_list = [
html.Div("PCV (Haematocrit) : ",style=text_style),
dcc.Input(id={'type':'dynamic-input','name':'hct'},type="number",placeholder="HCT..",style=input_style),
html.Div(" (40% - 45%) ",style=limits_style),
]
dengue_list = [
*small_break,
html.Div("dengue test".upper(),style={**input_style,"text-decoration":"underline"}),
html.Div("IgM antibodies to Dengue Virus : ",style=text_style),
html.Div([dcc.Dropdown(["negative".upper(),"positive".upper()],"negative".upper(),id={'type':'dynamic-input','name':'dengue_igm'},style=input_style)]),
html.Div("IgG antibodies to Dengue Virus : ",style=text_style),
html.Div([dcc.Dropdown(["negative".upper(),"positive".upper()],"negative".upper(),id={'type':'dynamic-input','name':'dengue_igg'},style=input_style)]),
html.Div("NS1 antibodies to Dengue Virus : ",style=text_style),
html.Div([dcc.Dropdown(["negative".upper(),"positive".upper()],"positive".upper(),id={'type':'dynamic-input','name':'dengue_ns'},style=input_style)]),
]
full_cbp_list = [
*hb_list,
html.Div("Total RBC Count : ",style=text_style),
dcc.Input(id={'type':'dynamic-input','name':'rbc-count'},type="number",placeholder="Rbc Count..",style=input_style),
html.Div(" ( 4.0 - 5.0 milli/cumm ) ",style=limits_style),
*hct_list,
*tc_list,
*plt_list,
*esr_list,
*dc_list
]
heamogram_list = [
*small_break,
*hb_list,
html.Div("Total RBC Count : ",style=text_style),
dcc.Input(id={'type':'dynamic-input','name':'rbc-count'},type="number",placeholder="Rbc Count..",style=input_style),
html.Div(" ( 4.0 - 5.0 milli/cumm ) ",style=limits_style),
*hct_list,
*tc_list,
*plt_list,
html.Div("MCV : ",style=text_style),
dcc.Input(id={'type':'dynamic-input','name':'mcv'},type="number",placeholder="MCV..",style=input_style),
html.Div(" ( 78 - 94 fl) ",style=limits_style),
html.Div("MCH : ",style=text_style),
dcc.Input(id={'type':'dynamic-input','name':'mch'},type="number",placeholder="MCH..",style=input_style),
html.Div(" ( 27 - 32 pg ) ",style=limits_style),
html.Div("MCHC : ",style=text_style),
dcc.Input(id={'type':'dynamic-input','name':'mchc'},type="number",placeholder="MCHC..",style=input_style),
html.Div(" ( 32 - 36 g/dl ) ",style=limits_style),
*esr_list,
*dc_list,
html.Div("peripheral smear examination :".upper(),style={**text_style,"text-decoraton":"underline"}),
*small_break,
html.Div("RBC: ",style=text_style),
dcc.Input(id={'type':'dynamic-input','name':'heamo-rbc'},type="text",placeholder="Normocytic Normochromic",value="Normocytic Normochromic",style=input_style),
html.Div("WBC: will be same as Total opinion",style=text_style),
dcc.Input(id={'type':'dynamic-input','name':'blast-cells'},type="text",placeholder="No Blast cells are seen",value="No Blast cells are seen",style=text_style),
html.Div("Platelets : ",style=text_style),
dcc.Input(id={'type':'dynamic-input','name':'platelet-opinion'},type="text",placeholder="Adequate",value="Adequate",style=input_style),
html.Div("Hemoparasites : ",style=text_style),
dcc.Input(id={'type':'dynamic-input','name':'hemoparasites-opinion'},type="text",placeholder="Not Seen",value="Not Seen",style=input_style),
html.Div("Impression : ",style={**text_style,"text-decoration":"underline"}),
dcc.Input(id={'type':'dynamic-input','name':'total-opinion'},type="text",placeholder="Microcytic Hypochromic Anemia",value="Microcytic Hypochromic Anemia",style={**input_style,"width":"500px"})
]
hba1c_list = [
*small_break,
html.Div("Glycosylated Hb (HbA1c) Test: ",style=text_style),
dcc.Input(id={'type':'dynamic-input','name':'hba1c_first'},type="number",placeholder="Type Hba1c %..",style={**input_style,"left":"500px"}),
html.Div("%",style={**limits_style,"left":"700px"}),
html.Div("Esitmiated Average Glucose (eAG): ",style=text_style),
dcc.Input(id={'type':'dynamic-input','name':'hba1c_second'},type="number",placeholder="Type Hba1c mg/dl..",style={**input_style,"left":"500px"}),
html.Div("mg/dl",style={**limits_style,"left":"700px"}),
html.Div([dcc.Dropdown(["SMALL","LONG"],"LONG",id={'type':'dynamic-input','name':'hba1c_dropdown'})],style={**limits_style,"width":"150px","left":"800px","bottom":"75px"}),
]
blood_urea_list = [
*small_break,
html.Div("Blood Urea : ",style=text_style),
dcc.Input(id={'type':'dynamic-input','name':'blood-urea'},type="number",placeholder="Enter Urea",style=input_style),
html.Div(" ( 10 - 40 mg/dl )",style=limits_style),
]
serum_creatinine_list = [
*small_break,
html.Div("Serum creatinine : ",style=text_style),
dcc.Input(id={'type':'dynamic-input','name':'serum-creat'},type="number",placeholder="Enter creatinine",style=input_style),
html.Div("( 2.5 - 7.5 IU/L )",style=limits_style),
]
bt_list = [
*small_break,
html.Div("B.T : ",style=text_style),
html.Div(
[
dcc.Input(id={'type':'dynamic-input','name':'bt_min'},type="text",placeholder="1",value="1",style=dict(width="50px")),
" : ",
dcc.Input(id={'type':'dynamic-input','name':'bt_sec'},type="text",placeholder="35 sec.",value="35",style=dict(width="50px")),
" Sec."
],
style={**input_style,"text-align":"center","align-items":"center","display":"flex","flex-direction":"row"}
),
]
ct_list = [
*small_break,
html.Div("C.T : ",style=text_style),
html.Div(
[
dcc.Input(id={'type':'dynamic-input','name':'ct_min'},type="text",placeholder="3",value="3",style=dict(width="50px")),
" : ",
dcc.Input(id={'type':'dynamic-input','name':'ct_sec'},type="text",placeholder="05 sec.",value="05",style=dict(width="50px")),
" Sec."
],
style={**input_style,"text-align":"center","align-items":"center","display":"flex","flex-direction":"row"}
)
]
uric_acid_list = [
*small_break,
html.Div("Uric Acid : ",style=text_style),
dcc.Input(id={'type':'dynamic-input','name':'uric-acid'},type="number",placeholder="Enter Uric Acid",style=input_style),
html.Div(" ( 2.5 - 7.5 IU/L ) ",style=limits_style)
]
urine_analysis_list = [
*small_break,
html.Div("Urine analysis :",style=text_style),
*small_break,
html.Div(dcc.Dropdown(["short".upper(),"long".upper()],"long".upper(),id={'type':'dynamic-input','name':'urine-drop'}),style={**input_style,"bottom":"50px"}),
html.Div("Sugar : ",style=text_style),
html.Div([dcc.Dropdown(["NIL","+","++","+++"],"NIL",id={'type':'dynamic-input','name':'urine_sugar'})],style=input_style),
html.Div("Albumin : ",style=text_style),
html.Div([dcc.Dropdown(["NIL","TRACES","+","++","+++"],"TRACES",id={'type':'dynamic-input','name':'urine_albumin'})],style=input_style),
html.Div("Bile Salts: ",style=text_style),
html.Div([dcc.Dropdown(["negative".upper(),"positive".upper()],"negative".upper(),id={'type':'dynamic-input','name':'urine_bs'})],style=input_style),
html.Div("Bile Pigments: ",style=text_style),
html.Div([dcc.Dropdown(["negative".upper(),"positive".upper()],"negative".upper(),id={'type':'dynamic-input','name':'urine_bp'})],style=input_style),
html.Div("Micro : ",style=text_style),
html.Div([
dcc.Input(id={'type':'dynamic-input','name':'urine_first_pus'},type="number",value=1,style=dict(width="100px")),
"-",
dcc.Input(id={'type':'dynamic-input','name':'urine_second_pus'},type="number",value=3,style=dict(width="100px",marginRight="20px")),
"Pus Cells"
],style=dict(position="relative",left="300px",margin="10px",wordSpacing="10px",fontSize=20)),
html.Div([
dcc.Input(id={'type':'dynamic-input','name':'urine_first_rbc'},type="number",placeholder="No..",value=0,style=dict(width="100px")),
"-",
dcc.Input(id={'type':'dynamic-input','name':'urine_second_rbc'},type="number",placeholder="No..",value=0,style=dict(width="100px",marginRight="20px")),
"RBC *(leaving blank means No RBC)"
],style=dict(position="relative",left="300px",margin="10px",wordSpacing="10px",fontSize=20)),
html.Div([
dcc.Input(id={'type':'dynamic-input','name':'urine_first_casts'},type="number",placeholder="No..",value=0,style=dict(width="100px")),
"-",
dcc.Input(id={'type':'dynamic-input','name':'urine_second_casts'},type="number",placeholder="No..",value=0,style=dict(width="100px",marginRight="20px")),
"Casts *(leaving blank means No Casts)"
],style=dict(position="relative",left="300px",margin="10px",wordSpacing="10px",fontSize=20)),
html.Div([
dcc.Input(id={'type':'dynamic-input','name':'urine_first_crystals'},type="number",placeholder="No..",value=0,style=dict(width="100px")),
"-",
dcc.Input(id={'type':'dynamic-input','name':'urine_second_crystals'},type="number",placeholder="No..",value=0,style=dict(width="100px",marginRight="20px")),
"Crystals *(leaving blank means No Crystals)"
],style=dict(position="relative",left="300px",margin="10px",wordSpacing="10px",fontSize=20)),
html.Div([
dcc.Input(id={'type':'dynamic-input','name':'urine_first_ep'},type="number",value=2,style=dict(width="100px")),
"-",
dcc.Input(id={'type':'dynamic-input','name':'urine_second_ep'},type="number",value=4,style=dict(width="100px",marginRight="20px")),
"Epithelial Cells Present"
],style=dict(position="relative",left="300px",margin="10px",wordSpacing="10px",fontSize=20))
]
urine_pregnency_list = [
*small_break,
html.Div("Urine Test Report : ",style=text_style),
html.Div("Urine Pregnancy Test : ",style=text_style),
html.Div([dcc.Dropdown(["negative".upper(),"positive".upper()],"negative".upper(),id={'type':'dynamic-input','name':'preg_test'})],style=input_style)
]
pt_aptt_list = [
*small_break,
html.Div("Prothrombin Time Test",style={**text_style,"left":"400px","text-decoration":"underline"}),
*big_break,
html.Div("P.T Test:",style=text_style),
dcc.Input(id={'type':'dynamic-input','name':'pt_test'},type="number",placeholder="14.6 seconds",value=14.6,style=input_style),
html.Div("P.T. Control : ",style=text_style),
html.Div("13.4 seconds",style=input_style),
html.Div("INR : ",style=text_style),
dcc.Input(id={'type':'dynamic-input','name':'pt_inr'},type="number",placeholder="1.2",value=1.2,style=input_style),
*small_break,
html.Div("Activate Partial Thromboplastin Time",style={**text_style,"left":"400px","text-decoration":"underline"}),
*small_break,
html.Div("APTT Test :",style=text_style),
dcc.Input(id={'type':'dynamic-input','name':'aptt_test'},type="number",placeholder="33.6 seconds...",value=32.7,style=input_style),
html.Div(" ( Nor: 26 - 38 sec )",style=limits_style),
html.Div("APTT Control : ",style=text_style),
html.Div(" 33.6",style=input_style),
html.Div("( Nor 26 - 38 sec )",style=limits_style)
]
mantaoux_list = [
*small_break,
html.Div("mantoux test :".upper(),style=text_style),
html.Div([dcc.Dropdown(["positive".upper(),"negative".upper()],"negative".upper(),id={'type':'dynamic-input','name':'mantoux_test'})],style=input_style),
*small_break
]
sugar_random_list = [
*small_break,
html.Div("Blood Sugar (Random):",style=text_style),
dcc.Input(id={'type':'dynamic-input','name':'random_sugar'},type="number",placeholder="Type RBS..",style=input_style),
html.Div(" ( 70 - 140 mg/dl ) ",style=limits_style)
]
sugar_fasting_list = [
*small_break,
html.Div("Blood Sugar (Fasting):",style=text_style),
dcc.Input(id={'type':'dynamic-input','name':'fasting_sugar'},type="number",placeholder="Type FBS..",style=input_style),
html.Div(" ( 70 - 110 mg/dl ) ",style=limits_style)
]
post_pandial_list = [
*small_break,
html.Div("Blood Sugar (PP):",style=text_style),
dcc.Input(id={'type':'dynamic-input','name':'pp_sugar'},type="number",placeholder="Type PP Sugar..",style=input_style),
html.Div(" ( 70 - 180 mg/dl )",style=limits_style)
]
urine_sugar_random_list = [
*small_break,
html.Div("Urine Sugar (Random):",style=text_style),
dcc.Input(id={"type":"dynamic-input","name":"urine_random_sugar"},type="text",placeholder="Type Random Urine",value="NIL",style=input_style),
]
urine_sugar_fasting_list = [
*small_break,
html.Div("Urine Sugar (Fasting):",style=text_style),
dcc.Input(id={"type":"dynamic-input","name":"urine_fasting_sugar"},type="text",placeholder="Type Fasting Urine",value="NIL",style=input_style)
]
stool_test_list = [
*small_break,
html.Div("STOOL TEST",style=text_style),
html.Div("OVA : ",style=text_style),
dcc.Input(id={"type":"dynamic-input","name":"stool_ova"},type="text",value="NIL",style=input_style),
html.Div("CYSTS : ",style=text_style),
dcc.Input(id={"type":"dynamic-input","name":"stool_cysts"},type="text",value="NIL",style=input_style),
html.Div("Reducing Substances : ",style=text_style),
dcc.Input(id={"type":"dynamic-input","name":"stool_red"},type="text",value="Present (++)",style=input_style)
]
lipid_profile_list = [
*small_break,
html.Div("Total Cholesterol : ",style=text_style),
dcc.Input(id={'type':'dynamic-input','name':'lipid_tc'},type="number",placeholder="Type Tc..",style={**input_style,"left":"500px"}),
html.Div("Low Risk < 220.0 mg/dl",style={**limits_style,"left":"700px"}),
html.Div("Border Line - 220 - 239",style={**limits_style,"left":"700px"}),
html.Div("High Risk > 250",style={**limits_style,"left":"700px"}),
html.Div("High Density Lipoprotein ( HDL ) : ",style=text_style),
dcc.Input(id={'type':'dynamic-input','name':'lipid_hdl'},type="number",placeholder="Type HDL...",style={**input_style,"left":"500px"}),
html.Div("29.0 - 80 mg/dl",style={**limits_style,"left":"700px"}),
html.Div("Low Density Lipoprotein : ",style=text_style),
dcc.Input(id={'type':'dynamic-input','name':'lipid_ldl'},type="number",placeholder="Type LDL...",style={**input_style,"left":"500px"}),
html.Div("Desirable < 100",style={**limits_style,"left":"700px"}),
html.Div("Border Line 110 - 129",style={**limits_style,"left":"700px"}),
html.Div("High Risk > 130.0",style={**limits_style,"left":"700px"}),
html.Div("Very Low Density Lipoprotein : ",style=text_style),
dcc.Input(id={'type':'dynamic-input','name':'lipid_vldl'},type="number",placeholder="Type VLDL",style={**input_style,"left":"500px"}),
html.Div("7.0 - 35.0 mg/dl",style={**limits_style,"left":"700px"}),
html.Div("Triglyceride (F): ",style=text_style),
dcc.Input(id={'type':'dynamic-input','name':'lipid_tri'},type="number",placeholder="Type Triglyceride...",style={**input_style,"left":"500px"}),
html.Div("Normal < 170.0 mg/dl",style={**limits_style,"left":"700px"}),
html.Div("BorderLine 200 - 400",style={**limits_style,"left":"700px"}),
html.Div("High 400 - 1000",style={**limits_style,"left":"700px"}),
]
blood_for_aec_list = [
*small_break,
html.Div("Blood for AEC Count : ",style=text_style),
dcc.Input(id={'type':'dynamic-input','name':'aec-count'},type="number",placeholder="460",style=input_style),
html.Div(" (50 - 450 cells/cumm ) ",style=limits_style)
]
ra_factor_list = [
*small_break,
html.Div("ra-factor :".upper(),style=text_style),
html.Div(dcc.Dropdown(["positive".upper(),"negative".upper()],"negative".upper(),id={'type':'dynamic-input','name':'ra-factor'}),style=dict(position="relative",width="200px",left="300px",bottom="25px")),
html.Div(" ( 1 : ",style={**limits_style,"bottom":"50px"}),
dcc.Input(id={'type':'dynamic-input','name':'ra-dilutions'},type="number",placeholder="None",style={**limits_style,"bottom":"75px","left":"620px","width":"100px"}),
html.Div(" dilutions ) ",style={**limits_style,"left":"730px","bottom":"95px"})
]
aso_titre_list = [
*small_break,
html.Div("ASO TITRE : ",style=text_style),
html.Div(dcc.Dropdown(["POSITIVE","NEGATIVE"],"NEGATIVE",id={'type':'dynamic-input','name':'aso_titre'}),style=dict(position="relative",width="200px",left="300px",bottom="25px")),
html.Div("( 1 : ",style={**limits_style,"bottom":"50px"}),
dcc.Input(id={'type':'dynamic-input','name':'aso_titre_dilutions'},type="number",placeholder="None",style={**limits_style,"bottom":"75px","left":"620px","width":"100px"}),
html.Div(" dilutions ) ",style={**limits_style,"left":"730px","bottom":"95px"})
]
serum_amylase_list = [
*small_break,
html.Div("Serum Amylase : ", style=text_style),
dcc.Input(id={'type': 'dynamic-input', 'name': 'serum_amylase'}, type="number", placeholder="Type amylase", style=input_style),
html.Div(" (30 - 110 U/L) ", style=limits_style)
]
serum_lipase_list = [
*small_break,
html.Div("Serum Lipase : ", style=text_style),
dcc.Input(id={'type': 'dynamic-input', 'name': 'serum_lipase'}, type="number", placeholder="Type lipase", style=input_style),
html.Div(" (23 - 300 U/L) ", style=limits_style)
]
serum_protein_list = [
*small_break,
html.Div("Serum Protein : ", style=text_style),
dcc.Input(id={'type': 'dynamic-input', 'name': 'serum_protein'}, type="number", placeholder="Type protein", style=input_style),
html.Div(" (6.6 - 8.3 g/dl) ", style=limits_style)
]
serum_albumin_list = [
*small_break,
html.Div("Serum Albumin : ", style=text_style),
dcc.Input(id={'type': 'dynamic-input', 'name': 'serum_albumin'}, type="number", placeholder="Type albumin", style=input_style),
html.Div(" (3.5 - 5.0 g/dl) ", style=limits_style)
]
serum_globulin_list = [
*small_break,
html.Div("Serum Globulin : ", style=text_style),
dcc.Input(id={'type': 'dynamic-input', 'name': 'serum_globulin'}, type="number", placeholder="Type globulin", style=input_style),
html.Div(" (2.0 - 3.5 g/dl) ", style=limits_style)
]
serum_ag_ratio_list = [
html.Div("Serum A/G Ratio : ", style=text_style),
dcc.Input(id={'type': 'dynamic-input', 'name': 'serum_ag_ratio'}, type="number", placeholder="Type A/G ratio", style=input_style),
html.Div(" (0.9 - 2.0 g/dl) ", style=limits_style)
]
serum_sodium_list = [
html.Div("Serum Sodium : ", style=text_style),
dcc.Input(id={'type': 'dynamic-input', 'name': 'serum_sodium'}, type="number", placeholder="Type sodium", style=input_style),
html.Div(" (135 - 155 mmol/L) ", style=limits_style)
]
serum_potassium_list = [
html.Div("Serum Potassium : ", style=text_style),
dcc.Input(id={'type': 'dynamic-input', 'name': 'serum_potassium'}, type="number", placeholder="Type potassium", style=input_style),
html.Div(" (3.5 - 5.5 mmol/L) ", style=limits_style)
]
serum_chloride_list = [
html.Div("Serum Chloride : ", style=text_style),
dcc.Input(id={'type': 'dynamic-input', 'name': 'serum_chloride'}, type="number", placeholder="Type chloride", style=input_style),
html.Div(" (98 - 107 mmol/L) ", style=limits_style)
]
serum_calcium_list = [
html.Div("Serum Calcium : ", style=text_style),
dcc.Input(id={'type': 'dynamic-input', 'name': 'serum_calcium'}, type="number", placeholder="Type calcium", style=input_style),
html.Div(" (8.5 - 10.5 mmol/L) ", style=limits_style)
]
vdrl_list = [
*small_break,
html.Div("V.D.R.L : ",style=text_style),
html.Div([dcc.Dropdown(["reactive".upper(),"non-reactive".upper()],"non-reactive".upper(),id={'type':'dynamic-input','name':'vdrl'})],style={**input_style,"width":"300px"})
]
hbsag_list = [
*small_break,
html.Div("HBsAg : ",style=text_style),
html.Div([dcc.Dropdown(["reactive".upper(),"non-reactive".upper()],"non-reactive".upper(),id={'type':'dynamic-input','name':'hbsag'})],style={**input_style,"width":"300px"})
]
hiv_list = [
*small_break,
html.Div("HIV I & II Antibodies Test : ",text_style),
html.Div([dcc.Dropdown(["reactive".upper(),"non-reactive".upper()],"non-reactive".upper(),id={'type':'dynamic-input','name':'hiv_ant'})],style={**input_style,"width":"300px"})
]
hcv_list = [
*small_break,
html.Div("HCV I & II Antibodies Test : ",text_style),
html.Div([dcc.Dropdown(["reactive".upper(),"non-reactive".upper()],"non-reactive".upper(),id={'type':'dynamic-input','name':'hcv_ant'})],style={**input_style,"width":"300px"})
]
semen_list = [
*small_break,
html.Div("Volume : ",style=text_style),
dcc.Input(id={'type':'dynamic-input','name':'semen-volume'},type="number",placeholder="3.0 ml",value=3.0,style=input_style),
html.Div("( 1.5 - 5.0 ml )",style=limits_style),
html.Div("Liquefaction : ",style=text_style),
dcc.Input(id={'type':'dynamic-input','name':'semen-liq'},type="number",placeholder="5 mts",value=5,style=input_style),
html.Div(" with in 20 mts",style=limits_style),
html.Div("PH : ",style=text_style),
dcc.Input(id={'type':'dynamic-input','name':'semen-ph'},type="number",placeholder="8.0",value=8.0,style=input_style),
html.Div("Spermatozoa Count : ",style=limits_style),
dcc.Input(id={'type':'dynamic-input','name':'semen-count'},type="number",placeholder="78 millions",value=78,style=input_style),
html.Div("( 60 - 150 millions/ml )",style=limits_style),
html.Div("Sperm motility : ",style=text_style),
dcc.Input(id={'type':'dynamic-input','name':'semen-mot'},type="number",placeholder="70%",value=70,style=input_style),
html.Div(" > 60% motile forms",style=limits_style),
html.Div("Sperm mrophology : ",style=text_style),
dcc.Input(id={'type':'dynamic-input','name':'semen-morph'},type="number",placeholder="55%",value=55,style=input_style),
html.Div(" > 70% normal",style=limits_style),
html.Div("other finding : ".upper(),style=text_style),
*small_break,
html.Div("W.B.C/h.p.t : ",style=text_style),
html.Div(
[
dcc.Input(id={'type':'dynamic-input','name':'semen-wbc-first'},type="number",placeholder="1",value=1),
" - ",
dcc.Input(id={'type':'dynamic-input','name':'semen-wbc-second'},type="number",placeholder="2",value=2),
],
style={**input_style,"display":"flex"}
),
html.Div("R.B.C/h.p.t : ",style=text_style),
html.Div(
[
dcc.Input(id={'type':'dynamic-input','name':'semen-rbc-first'},type="number",placeholder="NIL",value=0),
" - ",
dcc.Input(id={'type':'dynamic-input','name':'semen-rbc-second'},type="number",placeholder="NIL",value=0),
],
style={**input_style,"display":"flex"}
),
html.Div("Comments : Suggestive of ",style=text_style),
*small_break,
dcc.Input(id={'type':'dynamic-input','name':'semen-comments'},type="text",placeholder="* normo seprmia *, oligozoo spermia",style={**input_style,"width":"500px"})
]
electrolytes_list = [
*serum_sodium_list,
*serum_potassium_list,
*serum_chloride_list,
*serum_calcium_list
]
liver_function_list = [
*total_bilirubin_list,
*direct_indirect_bilirubin_list,
*sgot_list,
*sgpt_list,
*alkp_list
]
bill_list = [
html.Button("ADD LINE",id="bill-add-line",style={**text_style,"width":"150px","height":"100px","borderRadius":"20px","backgroundColor":"cyan","font-weight":700}),
*big_break,
html.Div(id="bill-inputs")
]
reports_original_dict = {
"Hb": hb_list,
"Total Count (TC)": tc_list,
"Platelet Count": plt_list,
"Differential Count (DC)": dc_list,
"ESR": esr_list,
"CRP": crp_list,
"Widal": widal_list,
"Full CBP": full_cbp_list,
"Malaria":malaria_list,
"PCV(HCT)":hct_list,
"Blood Group": blood_group_list,
"Total Bilirubin": total_bilirubin_list,
"Direct & Indirect Bilirubin": direct_indirect_bilirubin_list,
"SGOT":sgot_list,
"SGPT":sgpt_list,
"ALKP":alkp_list,
"DENGUE":dengue_list,
"Heamogram": heamogram_list,
"HBA1C": hba1c_list,
"Blood Urea": blood_urea_list,
"Serum Creatinine": serum_creatinine_list,
"Uric Acid": uric_acid_list,
"Urine Analysis": urine_analysis_list,
"Urine Pregnancy": urine_pregnency_list,
"Mantaoux": mantaoux_list,
"Liver Function Test":liver_function_list,
"BT":bt_list,
"CT":ct_list,
"Random Sugar": sugar_random_list,
"Fasting Sugar": sugar_fasting_list,
"Post Pandial Sugar":post_pandial_list,
"Urine Sugar(Fasting)":urine_sugar_fasting_list,
"Urine Sugar(Random)":urine_sugar_random_list,
"Stool Test":stool_test_list,
"Blood for AEC Count": blood_for_aec_list,
"RA Factor": ra_factor_list,
"ASO Titre": aso_titre_list,
"PT APTT": pt_aptt_list,
"Lipid Profile": lipid_profile_list,
"Serum Amylase": serum_amylase_list,
"Serum Lipase": serum_lipase_list,
"Serum Protein": serum_protein_list,
"Serum Albumin": serum_albumin_list,
"Serum Globulin": serum_globulin_list,
"Serum A/G Ratio": serum_ag_ratio_list,
"Serum Sodium": serum_sodium_list,
"Serum Potassium": serum_potassium_list,
"Serum Chloride": serum_chloride_list,
"Serum Calcium": serum_calcium_list,
"Electrolytes":electrolytes_list,
"VDRL":vdrl_list,
"HBsAg":hbsag_list,
"HIV I & II Antibodies Test":hiv_list,
"HCV I & II Antibodies Test":hcv_list,
"Semen Analysis":semen_list,
"XRAY Opinion":x_ray_list,
"BILL":bill_list,
}
@callback(
Output("bill-inputs","children"),
Input("bill-add-line","n_clicks")
)
def add_bill_inputs(n_clicks):
if not n_clicks:
raise PreventUpdate
if ctx.triggered_id == "bill-add-line":
return [
html.Div(
[
f"{i+1}. ",
dcc.Input(id={"type":"dynamic-input","name":f"bill-{i}-name"},type="text",placeholder="Test Name..",style=dict(fontSize=25,height="50px")),
" - ",
dcc.Input(id={"type":"dynamic-input","name":f"bill-{i}-value"},type="number",placeholder="Price..",style=dict(fontSize=25,height="50px")),
" /- "
],
style=dict(fontSize=25,position="relative",left="100px")
)
for i in range(n_clicks)]
def get_df_item(p_sn:str,item_name:str,df:pd.DataFrame):
return df.loc[df.loc[:,"S.No."] == p_sn,item_name].item()
@callback(
[
Output("output-report","children"),
Output("output-report-boxes","children")
],
[
Input("patients-dropdown","value"),
Input("reports-dropdown","value"),
Input("template-dropdown","value")
],
[
State("date-pick-reports","date"),
State("tab-id-store","data")
],
prevent_initial_call=True
)
def preview_report_divs(patients_sno,reports_value,template_value,date,tab_id):
if patients_sno:
df = pd.read_csv(f"assets/all_files/{date.replace("-","_")}.csv",dtype=dtype_map)
df = df.iloc[:-1,:]
year,month,day = date.split("-")
os.makedirs(f"assets/{year}/{month}/{day}",exist_ok=True)
conn = duckdb.connect(f"assets/{year}/{month}/{day}/{date.replace("-","_")}.duckdb")
conn.execute(
"""
create table if not exists patients (
id text,
tab_id text,
tests text,
primary key (id,tab_id)
)
"""
)
patients_details = [
html.Div(f"Patient Name: {get_df_item(patients_sno,item_name='Patient Name',df=df)}"),
html.Br(),
html.Div(f"Age: {get_df_item(patients_sno,item_name='Patient Age',df=df)} {get_df_item(patients_sno,item_name='Age Group',df=df)}"),
html.Br(),
html.Div(f"Reference By: {get_df_item(patients_sno,item_name='Reference By',df=df)}"),
html.Br(),
html.Div(f"Date: {get_df_item(patients_sno,item_name="Date",df=df)} Collection Time: {get_df_item(patients_sno,item_name='Time',df=df)}")
]
all_opts = []
result_df = conn.query(f"select * from patients where id = '{patients_sno}' and tab_id = '{tab_id}'").df()
condition = (result_df.shape[0] == 0)
if condition:
tests_names = []
else:
tests_names = json.loads(result_df["tests"].item())
if reports_value:
for x in reports_value:
all_opts.append(x)
if x not in tests_names:
tests_names.append(x)
if template_value:
template_list = json.loads(template_value)
for x in template_list:
all_opts.append(x)
if x not in tests_names:
tests_names.append(x)
for x in tests_names:
if x not in all_opts:
tests_names.remove(x)
conn.execute(f"insert or replace into patients (id, tab_id, tests) values ('{patients_sno}','{tab_id}','{json.dumps(tests_names)}')")
conn.close()
report_details = []
for x in tests_names:
report_details += reports_original_dict[x]
if len(report_details) == 0:
return patients_details,"Select Test to Display"
else:
return patients_details,report_details
return "Select a Serial Number To Display","Select a Test wit Serial Number to Display"
small_left_extreme = 42
small_value_point = 182
small_right_extreme = 375
small_font_name = "Times-BoldItalic"
small_font_size = 13
small_limits_font_size = 11
big_left_extreme = 43
big_right_extreme = 540
big_value_point = 240
big_font_name = "CenturySchoolBook-BoldItalic"
big_font_size = 12
big_limits_font_size = 11
size_dict = {
"font_size":{
0:small_font_size,
1:big_font_size
},
"font_name":{
0:small_font_name,
1:big_font_name
},
"left_extreme":{
0:small_left_extreme,
1:big_left_extreme
},
"value_point":{
0:small_value_point,
1:big_value_point
},
"limits_font":{
0:small_limits_font_size,
1:big_limits_font_size
},
"right_extreme":{
0:small_right_extreme,
1:big_right_extreme
}
}
def cal_string_width(c:canvas.Canvas,total_string,font_name,font_size):
return c.stringWidth(total_string,font_name,font_size)
def patient_details_canvas(
c:canvas.Canvas,
font_name:str,
font_size:int,