· 4 years ago · Feb 18, 2021, 03:38 PM
1from kivy.network.urlrequest import UrlRequest
2from kivy.properties import ListProperty
3from kivy.event import EventDispatcher
4
5
6class News(EventDispatcher):
7 headlines = ListProperty([('Uninitialized', 'Uninitialized', 'No news is good news!')])
8
9 def get_news(self, *args):
10 url = ('http://newsapi.org/v2/top-headlines?'
11 'country=ph&category=health&'
12 'apiKey=0a2a06f5a843426ca8384f89111bfe99')
13 req = UrlRequest(url, self._got_news, on_failure=self.fail, on_error=self.fail)
14
15 def _got_news(self, req, news):
16 print(news)
17 self.headlines.clear()
18 for content in news['articles']:
19 self.headlines.append((content['title'], content['urlToImage'], content['description']))
20
21 def fail(self, instance, value):
22 print('you loose')
23 print(f'Error: {instance}, {value}')
24
25
26
27if __name__ == '__main__':
28 from kivymd.app import MDApp
29 from kivy.lang import Builder
30 from kivymd.uix.dialog import MDDialog
31 from kivymd.uix.button import MDFlatButton
32 from kivy.uix.screenmanager import Screen
33 from kivymd.uix.list import IRightBodyTouch, MDList
34 from kivymd.uix.boxlayout import MDBoxLayout
35 from kivy.properties import StringProperty
36 from kivymd.uix.expansionpanel import MDExpansionPanel, MDExpansionPanelTwoLine
37 from kivy.clock import Clock
38 from kivy.core.window import Window
39 from kivy.loader import Loader
40 import json
41 import sqlite3 as sql
42 import datetime
43 import time
44 import itertools
45 import pprint
46
47
48
49 class Content(MDList):
50 pass
51
52
53 class RecordLine(MDBoxLayout):
54 text = StringProperty()
55
56
57 class InformationDialog(MDDialog):
58 pass
59
60
61 class DemoApp(MDApp):
62 news = News()
63 class MainMenuScreen(Screen):
64 pass
65
66 class InputScreen(Screen):
67 pass
68
69 class RestingHeartRateScreen(Screen):
70 pass
71
72 class ResultObeseScreen(Screen):
73 pass
74
75 class ResultNormalScreen(Screen):
76 pass
77
78 class ResultOverweightScreen(Screen):
79 pass
80
81 class ResultUnderweightScreen(Screen):
82 pass
83
84 class LocationSearchScreen(Screen):
85 pass
86
87 class LocationResultScreen(Screen):
88 pass
89
90 class HistoryScreen(Screen):
91 pass
92
93 class NewsScreen(Screen):
94 headline = StringProperty('')
95 headline_image = StringProperty('')
96 description = StringProperty('')
97
98
99
100 # conn = sql.connect('USERINFO.db')
101 # cur = conn.cursor()
102 # cur.execute(""" CREATE TABLE IF NOT EXISTS results (
103 # UID INTEGER PRIMARY KEY AUTOINCREMENT,
104 # NAME VARCHAR(50),
105 # RESULT INT,
106 # DATE_TIME TEXT DEFAULT CURRENT_TIMESTAMP)
107 # """)
108 # cur.execute(""" CREATE TABLE IF NOT EXISTS information (
109 # id INTEGER PRIMARY KEY AUTOINCREMENT,
110 # fname VARCHAR(50),
111 # height INT,
112 # weight INT,
113 # age INT,
114 # heartrate INT)
115 # """)
116 # conn.commit()
117 # conn.close()
118
119 def __init__(self, **kwargs):
120 super().__init__(**kwargs)
121 self.app = DemoApp.get_running_app()
122 self.story = itertools.cycle(self.app.news.headlines)
123 Clock.schedule_once(self.initial_news, 5)
124 self.refresh = Clock.schedule_interval(self.news_next, 15)
125
126 def initial_news(self, *args):
127 self.headline = self.app.news.headlines[0][0]
128 self.headline_image = self.app.news.headlines[0][1]
129 self.description = self.app.news.headlines[0][2]
130
131 def news_next(self, *args):
132 n = next(self.story)
133 self.headline = n[0]
134 self.headline_image = n[1] if n[1] is not None else 'deep orange logo.png'
135 self.description = n[2]
136
137 self.list_items = [] # Dictionary where the items is stored
138 self.counter = 0
139 self.counting = {'Item counter': self.counter}
140 self.dialog = None
141 self.selected_category = None
142 self.selected_rec = None
143 self.card_file = \
144 [{'Category': 'Barangay ALABANG',
145 'Record': [
146 {'title': 'Alabang Medical Clinic ( MAIN )',
147 'Details': [
148 ' ADDRESS: \n 297 Montillano St, Alabang, Muntinlupa \n TELEPHONE NUMBER: \n (02) 8842 0680']},
149 {'title': 'Alabang Medical Center, Alabang Zapote road',
150 'Details': [
151 ' ADDRESS: \n Ayala Life-FGU Center, Zapote Road Corner Acacia Avenue Madrigal Business Park, Ayala Alabang, Muntinlupa \n TELEPHONE NUMBER: \n 0998 855 9221']},
152 {'title': 'Asian Hospital and Medical Center',
153 'Details': [
154 ' ADDRESS: \n 2205 Civic Dr, Alabang, Muntinlupa \n TELEPHONE NUMBER: \n (02) 8771 9000']},
155 {'title': 'Aventus Medical Care, Inc. - Alabang Clinic',
156 'Details': [
157 ' ADDRESS: \n 2/F Sycamore ARCS 1 Building Buencamino Street corner Alabang - Zapote Road Madrigal Business Park, Alabang, Muntinlupa \n TELEPHONE NUMBER: \n (02) 8556 3598']},
158 {'title': 'Healthway Medical Festival Mall',
159 'Details': [
160 ' ADDRESS: \n 2nd Floor, Pixie Forest Entrance, Filinvest Ave, Filinvest City, Muntinlupa \n TELEPHONE NUMBER: \n (02) 751 4929']},
161 {'title': 'Healthfirst clinic ALABANG',
162 'Details': [
163 ' ADDRESS: \n G/F, South Supermarket, Filinvest Ave., Filinvest Corporate City \n TELEPHONE NUMBER: \n (+632) 8 821 1423 | 0917 842 8214']},
164 {'title': 'Ospital ng Muntinlupa ( OSMUN )',
165 'Details': [
166 ' ADDRESS: \n Civic Dr, Alabang, Muntinlupa \n TELEPHONE NUMBER: \n (02) 8771 0457']},
167 {'title': 'St. Michaels Medical Center',
168 'Details': [
169 ' ADDRESS: \n Starmall Alabang, South Super Hwy, Alabang, Muntinlupa\n TELEPHONE NUMBER: \n 0921 624 4418']},
170 {'title': 'San Roque Medical Clinic',
171 'Details': [' ADDRESS: \n Alabang, Muntinlupa \n TELEPHONE NUMBER: \n (02) 8842 2950']},
172 {'title': 'Megason Diagnostic Clinic',
173 'Details': [' ADDRESS: \nAlabang, Muntinlupa \n TELEPHONE NUMBER: \n (02) 8809 9044']},
174 {'title': 'Tokyo Healthlink 東京ヘルスリンク - Alabang',
175 'Details': [
176 ' ADDRESS: \n Molito Complex, Madrigal Ave, Ayala Alabang, Muntinlupa \n TELEPHONE NUMBER: \n (02) 8772 2678']},
177 {'title': 'Research Institute for Tropical Medicine',
178 'Details': [
179 ' ADDRESS: \n Filinvest Corporate City, 9002 Research Dr, Alabang, Muntinlupa \n TELEPHONE NUMBER: \n (02) 8807 2631']},
180 ]},
181 {'Category': 'Barangay BAYANAN',
182 'Record': [
183 {'title': 'Silverio Medical Clinic',
184 'Details': [
185 ' ADDRESS: \n 233g National Road, Muntinlupa \n TELEPHONE NUMBER: \n (02) 8862 0223']},
186 {'title': 'Bayanan Health Center (Annex)',
187 'Details': [
188 ' ADDRESS: \n Block 2, Purok 1, 292 M Dolleton St, Muntinlupa \n TELEPHONE NUMBER: \n (02) 8862 0124']},
189 {'title': 'Bayanan Medical Clinic, X-Ray and Laboratory Services',
190 'Details': [
191 ' ADDRESS: \n 231 National Road, Bayanan, Muntinlupa \n TELEPHONE NUMBER: \n (02) 8861 5861']},
192 {'title': 'El Natividad Medical And Maternity Clinic',
193 'Details': [
194 ' ADDRESS: \n 214 National Road, Muntinlupa \n TELEPHONE NUMBER: \n 0923 701 5164']},
195 ]},
196 {'Category': 'Barangay CUPANG',
197 'Record': [
198 {'title': 'Hillside General Hospital',
199 'Details': [
200 ' ADDRESS: \n Km. 23, West Service Road, Cupang, Muntinlupa \n TELEPHONE NUMBER: \n (02) 8842 3958']},
201 {'title': 'Alabang Medical Center',
202 'Details': [
203 ' ADDRESS: \n 8 Corregidor, Cupang, Muntinlupa \n TELEPHONE NUMBER: \n (02) 8850 8719']},
204 {'title': 'Cupang Health Center',
205 'Details': [
206 ' ADDRESS: \n Barangay Hall, Beside Cupang, Manuel L. Quezon, Cupang, Muntinlupa \n TELEPHONE NUMBER: \n --']},
207 ]},
208 {'Category': 'Barangay POBLACION',
209 'Record': [
210 {'title': 'Albia Medical & Diagnostic Clinic',
211 'Details': [
212 ' ADDRESS: \n 93 Rizal St, Poblacion, Muntinlupa \n TELEPHONE NUMBER: \n (02)8461204']},
213 {'title': 'Babaran Echavez Medical And Psychiatric Clinic',
214 'Details': [
215 ' ADDRESS: \n 1125 Amparo Corner Sto Nino Street, Poblacion, Muntinlupa \n TELEPHONE NUMBER: \n (02) 8861 3066']},
216 {'title': 'MCC De La Merced Maternity And Childrens Clinic',
217 'Details': [
218 ' ADDRESS: \n 92 Rizal St, Poblacion, Muntinlupa \n TELEPHONE NUMBER: \n (02) 8861 3944']},
219 {'title': 'Mauricestela Medical Clinic',
220 'Details': [
221 ' ADDRESS: \n 212 Pedro Diaz St, Poblacion, Muntinlupa, 1776 Metro Manila \n TELEPHONE NUMBER: \n (02) 8862 2117']},
222 {'title': 'Poblacion Health Center Main',
223 'Details': [
224 ' ADDRESS: \n Poblacion, Muntinlupa \n TELEPHONE NUMBER: \n NONE']},
225 ]},
226 {'Category': 'Barangay PUTATAN',
227 'Record': [
228 {'title': 'Alabang Medical Clinic - Muntinlupa Branch',
229 'Details': [
230 ' ADDRESS: \n 1 National Highway, Putatan, Muntinlupa \n TELEPHONE NUMBER: \n (02) 8861 1779']},
231 {'title': 'IMS Wellth Care, Inc.',
232 'Details': [
233 ' ADDRESS: \n 49 National Road, Putatan, Muntinlupa \n TELEPHONE NUMBER: \n (02) 8861 1592']},
234 {'title': 'Medical Center Muntinlupa',
235 'Details': [
236 ' ADDRESS: \n National Road, Putatan, Muntinlupa \n TELEPHONE NUMBER: \n 8620162']},
237 {'title': 'Muntinlupa Doctors Clinic',
238 'Details': [
239 ' ADDRESS: \n 1 National Road, Putatan, Muntinlupa \n TELEPHONE NUMBER: \n (02) 8842 2718']},
240 {'title': 'Medcare Multi Specialty',
241 'Details': [
242 ' ADDRESS: \n 84-I, National Road, Barangay Putatan, Muntinlupa \n TELEPHONE NUMBER: \n 0922 857 4180']},
243 ]},
244 {'Category': 'Barangay SUCAT',
245 'Record': [
246 {'title': 'Sucat Health Center',
247 'Details': [
248 ' ADDRESS: \n 624 Dir. A. Bunye, Sucat, Muntinlupa \n TELEPHONE NUMBER: \n NONE']},
249 ]},
250 {'Category': 'Barangay TUNASAN',
251 'Record': [
252 {'title': 'Beato-Cauilan Hospital',
253 'Details': [
254 ' ADDRESS: \n Manila S Rd, Tunasan, Muntinlupa \n TELEPHONE NUMBER: \n +632 861-5284']},
255 ]}]
256
257 def on_start(self):
258 for category in self.card_file:
259 panel = MDExpansionPanel(icon="scr2.png", content=Content(),
260 panel_cls=MDExpansionPanelTwoLine(text=category['Category'],
261 secondary_text="Tap to view Hospitals"))
262 self.root.ids.scr_mngr.get_screen('locsearch').ids.rlist.add_widget(panel)
263 for rec in category['Record']:
264 rw = RecordLine(text=rec['title'])
265 print(rec['title'])
266 self.root.ids.scr_mngr.get_screen('locsearch').ids.rlist.children[0].content.add_widget(rw)
267 self.news.get_news()
268 Clock.schedule_once(self.print_news, 5) # wait for site..
269 print('waiting 5 seconds...')
270 def showinfo(self, cat, r):
271 close_button = MDFlatButton(text="Done", on_release=self.close_dialog)
272 ingredients = self.ingredients_list(cat, r)
273 ingredients_text = ''
274 for ingredient in ingredients:
275 ingredients_text += ingredient
276 self.dialog = InformationDialog(size_hint=(0.8, 0.8), text=ingredients_text, auto_dismiss=True,
277 buttons=[close_button])
278 self.dialog.open()
279
280 def ingredients_list(self, selected_cat, selected_r):
281 self.selected_rec = selected_r
282 self.selected_category = selected_cat
283 for category in self.card_file:
284 if category['Category'] == selected_cat:
285 for rec in category['Record']:
286 if rec['title'] == selected_r:
287 return rec['Details']
288
289 def on_stop(self): # Event handler that triggers when the application has finished running
290 # Creates a json file to saved the all the items in dictionary when closing the app
291 with open('saved_list.txt', 'w') as f:
292 json.dump(self.list_items, f)
293
294 class Container(IRightBodyTouch, MDBoxLayout): # This line position widget to the right.
295 adaptive_width = True
296
297 def save_data(self):
298 conn = sql.connect('USERINFO.db')
299 cur = conn.cursor()
300 cur.execute(""" INSERT INTO information (fname,height,weight,age,heartrate) VALUES (?,?,?,?,?)""",
301 (self.root.ids.scr_mngr.get_screen('input').ids.fname.text,
302 self.root.ids.scr_mngr.get_screen('input').ids.height.text,
303 self.root.ids.scr_mngr.get_screen('input').ids.weight.text,
304 self.root.ids.scr_mngr.get_screen('input').ids.age.text,
305 self.root.ids.scr_mngr.get_screen('input').ids.heartrate.text))
306 conn.commit()
307 conn.close()
308
309 def print_news(self, dt):
310 pp = pprint.PrettyPrinter(width=80, compact=True)
311 pp.pprint(self.news.headlines)
312
313 def result_condition(self):
314 n = int(10000)
315
316 h = int(self.root.ids.scr_mngr.get_screen('input').ids.height.text)
317
318 w = int(self.root.ids.scr_mngr.get_screen('input').ids.weight.text)
319
320 unix = time.time()
321 date = str(datetime.datetime.fromtimestamp(unix).strftime('%Y-%m-%d %H:%M:%S'))
322 answer = (w / h / h) * n
323 print(answer)
324
325 conn = sql.connect('USERINFO.db')
326 cur = conn.cursor()
327 cur.execute(""" INSERT INTO results (NAME,RESULT,DATE_TIME) VALUES (?,?,?)""",
328 (
329 self.root.ids.scr_mngr.get_screen('input').ids.fname.text,
330 answer,
331 date
332 ))
333 conn.commit()
334 conn.close()
335 if answer <= 18.5:
336 self.root.ids.scr_mngr.current = 'underweight'
337 elif 18.6 <= answer <= 24.9:
338 self.root.ids.scr_mngr.current = 'normal'
339 elif 25.0 <= answer <= 29.9:
340 self.root.ids.scr_mngr.current = 'overweight'
341 else:
342 self.root.ids.scr_mngr.current = 'obese'
343
344 def clear_inputs(self): # set each of the inputs to an empty string
345 self.root.ids.scr_mngr.get_screen('input').ids.fname.text = ""
346 self.root.ids.scr_mngr.get_screen('input').ids.heartrate.text = ""
347 self.root.ids.scr_mngr.get_screen('input').ids.age.text = ""
348 self.root.ids.scr_mngr.get_screen('input').ids.height.text = ""
349 self.root.ids.scr_mngr.get_screen('input').ids.weight.text = ""
350
351 def info1_dialog(self):
352 close_button = MDFlatButton(text="Okay", on_release=self.close_dialog)
353 self.dialog = MDDialog(title="Details",
354 text="Hospitals listed are still operating up-to-date",
355 size_hint=(1, 1),
356 buttons=[close_button])
357 self.dialog.open()
358
359 def show_database(self):
360 conn = sql.connect('USERINFO.db')
361 cur = conn.cursor()
362 cur.execute("""
363 SELECT fname, height, weight, heartrate, RESULT, DATE_TIME
364 FROM information INNER JOIN results
365 ON information.id = results.UID
366 """)
367 output = cur.fetchall()
368 for data in output:
369 print(data)
370
371 def build(self):
372 self.theme_cls.primary_palette = "Lime"
373 self.theme_cls.theme_style = "Light" # "Light"
374 screen = Builder.load_file("main.kv")
375 return screen
376
377 def back_screen6(self, obj):
378 self.root.ids.scr_mngr.current = 'menu'
379 self.root.ids.scr_mngr.transition.direction = "right"
380
381 def show_alert_dialog(self):
382 close_button = MDFlatButton(text="Okay",
383 on_release=self.okay)
384 more_button = MDFlatButton(text="Cancel", on_press=self.close_dialog)
385
386 self.dialog = MDDialog(title="Confirmation", text="Confirm Details?",
387 size_hint=(1, 1),
388 buttons=[close_button, more_button])
389 self.dialog.open()
390
391 def result_dialog(self):
392 close_button = MDFlatButton(text="Okay", on_release=self.close_dialog)
393 self.dialog = MDDialog(title="Where did we get the Results?",
394 text="Results are Determined based on the Details Given by the User",
395 size_hint=(1, 1),
396 buttons=[close_button])
397 self.dialog.open()
398
399 def hakdog(self):
400 close_button = MDFlatButton(text="Okay", on_release=self.close_dialog)
401 self.dialog = MDDialog(title="Instructions",
402 text="Manual Heartbeat check can be used to determine if you have a normal heart rate for your age. "
403 "If height = feet/inches, Convert to Centimeter (FEET× 30.48 +INCHES× 2.54) ",
404 size_hint=(1, 1),
405 buttons=[close_button])
406 self.dialog.open()
407
408 def show_data(self, *args):
409 if self.root.ids.scr_mngr.get_screen('input').ids.fname.text == "" \
410 or self.root.ids.scr_mngr.get_screen('input').ids.height.text == "" \
411 or self.root.ids.scr_mngr.get_screen('input').ids.weight.text == "" \
412 or self.root.ids.scr_mngr.get_screen('input').ids.heartrate.text == "" \
413 or self.root.ids.scr_mngr.get_screen('input').ids.age.text == "" \
414 or self.root.ids.scr_mngr.get_screen('input').ids.heartrate.text == "":
415 close_button = MDFlatButton(text="Okay", on_release=self.close_dialog)
416 self.dialog = MDDialog(title="Invalid", text="No item added",
417 size_hint=(1, 1), buttons=[close_button])
418 self.dialog.open()
419 else:
420 self.show_alert_dialog()
421
422 def okay(self, *args):
423 print(self.root.ids.scr_mngr.get_screen('input').ids.fname.text),
424 print(self.root.ids.scr_mngr.get_screen('input').ids.height.text),
425 print(self.root.ids.scr_mngr.get_screen('input').ids.weight.text),
426 print(self.root.ids.scr_mngr.get_screen('input').ids.age.text),
427 print(self.root.ids.scr_mngr.get_screen('input').ids.heartrate.text)
428 self.save_data()
429 self.result_condition()
430 self.clear_inputs()
431 self.dialog.dismiss()
432
433 def close_dialog(self, obj):
434 self.dialog.dismiss()
435
436 def history_screen(self, obj):
437 self.root.ids.scr_mngr.current = 'history'
438 self.root.ids.scr_mngr.transition.direction = "right"
439
440 def location_screen(self, obj):
441 self.root.ids.scr_mngr.current = 'locsearch'
442 self.root.ids.scr_mngr.transition.direction = "left"
443
444 def back_screen(self, obj):
445 self.root.ids.scr_mngr.current = 'menu'
446 self.root.ids.scr_mngr.transition.direction = "left"
447
448 def back2_screen(self, obj):
449 self.root.ids.scr_mngr.current = 'input'
450 self.root.ids.scr_mngr.transition.direction = "right"
451
452 def back3_screen(self, obj):
453 self.root.ids.scr_mngr.current = 'menu'
454 self.root.ids.scr_mngr.transition.direction = "right"
455
456 def back4_screen(self, obj):
457 self.root.ids.scr_mngr.current = 'locsearch'
458 self.root.ids.scr_mngr.transition.direction = "right"
459
460
461 DemoApp().run()
462-----------------------------------------------------------------------------
463Screen:
464 ScreenManager:
465 id:scr_mngr
466 MainMenuScreen:
467 name:"menu"
468 InputScreen:
469 name:"input"
470 RestingHeartRateScreen:
471 name:"heartrate"
472 ResultObeseScreen:
473 name:"obese"
474 ResultUnderweightScreen:
475 name:"underweight"
476 ResultOverweightScreen:
477 name:"overweight"
478 ResultNormalScreen:
479 name:"normal"
480 LocationSearchScreen:
481 name:"locsearch"
482 LocationResultScreen:
483 name:"locresult"
484 HistoryScreen:
485 name:"history"
486
487<MainMenuScreen>
488 MDNavigationLayout:
489 ScreenManager:
490 Screen:
491 BoxLayout:
492 orientation: 'vertical'
493 # canvas:
494 # Color:
495 # rgb: 1, 1, 1
496 # Rectangle:
497 # # source: 'background.png'
498 # size: self.size
499 # pos: self.pos
500 Label:
501 size_hint_y: .25
502 text: root.headline
503 text_size: self.size
504 valign: 'center'
505 halign: 'center'
506 shorten: True
507 shorten_from: 'right'
508 font_size: 30
509 padding: 20,20
510 bold: True
511 GridLayout:
512 cols: 2
513 padding: 20
514 AsyncImage:
515 source: root.headline_image
516 anim_delay: .03334 # 15fps, for gif videos
517 nocache: True
518 Label:
519 padding_x: 30
520 text: root.description
521 text_size: self.size
522 font_size: 25
523 valign: 'center'
524
525 BoxLayout: # This is the root widget
526 orientation: 'vertical'
527 ScreenManager:
528 id: sm
529 NewsScreen:
530 name: 'news'
531 next: 'weather'
532 duration: 30
533
534 MDToolbar:
535 title:' MD 24/7'
536 elevation:10
537 Widget:
538
539 MDBottomAppBar:
540 MDToolbar:
541 icon: "account"
542 type: "bottom"
543 on_action_button:
544 root.manager.current='input'
545 root.manager.transition.direction = "right"
546 left_action_items:[["history",lambda x: app.history_screen("history")]]
547 right_action_items:[["google-earth",lambda x: app.location_screen("locsearch")]]
548 MDFloatLayout:
549
550
551
552<InputScreen>
553 on_pre_enter: app.clear_inputs()
554 id:information
555 BoxLayout:
556 orientation: 'vertical'
557 MDToolbar:
558 title:'Input Details'
559 elevation:10
560 left_action_items:[["backspace",lambda x:app.back_screen("menu")]]
561 right_action_items:[["head-question",lambda x:app.hakdog()]]
562
563 Widget:
564 MDTextField:
565 id:fname
566 required: True
567 hint_text: "Full name"
568 icon_right:"account"
569 pos_hint: {'center_x': 0.5}
570 size_hint_x: None
571 width: '250dp'
572 helper_text:"Please enter your Registered Name"
573 helper_text_mode:"persistent"
574 Widget:
575 height: 35
576
577 MDTextField:
578 id:height
579 required: True
580 hint_text: "Height"
581 icon_right:"human-male-height"
582 pos_hint: {'center_x': 0.5}
583 size_hint_x: None
584 width: '250dp'
585 helper_text:"Must be in centimeters"
586 helper_text_mode:"persistent"
587 Widget:
588 height:35
589
590 MDTextField:
591 id:weight
592 required: True
593 hint_text: "Weight"
594 icon_right:"weight-kilogram"
595 pos_hint: {'center_x': 0.5}
596 size_hint_x: None
597 width: '250dp'
598 helper_text:"Must be in Kilogram"
599 helper_text_mode:"persistent"
600 Widget:
601 height:35
602
603 MDTextField:
604 id:age
605 hint_text: "Age"
606 required: True
607 icon_right:"cake"
608 pos_hint: {'center_x': 0.5}
609 size_hint_x: None
610 width: '250dp'
611 helper_text:"please enter your age"
612 helper_text_mode:"persistent"
613 Widget:
614 height: 35
615
616 MDTextField:
617 id:heartrate
618 required: True
619 hint_text: "Heartrate"
620 icon_right:"heart-pulse"
621 pos_hint: {'center_x': 0.5}
622 size_hint_x: None
623 width: '250dp'
624 helper_text:"Count the beat on your palm for 60 seconds"
625 helper_text_mode:"persistent"
626 Widget:
627 size_hint_y: None
628
629 MDScreen:
630 MDRectangleFlatButton:
631 mode: "rectangle"
632 text: 'Confirm'
633 pos_hint: {'center_x':0.5, 'center_y':0.8}
634 on_press :
635 app.show_data()
636
637 Widget:
638 size_hint_x: None
639
640<ResultObeseScreen>
641 BoxLayout:
642 orientation: 'vertical'
643 MDToolbar:
644 title:'Result: OBESE'
645 elevation:10
646 right_action_items:[["head-question",lambda x:app.result_dialog()]]
647 Widget:
648
649 MDLabel:
650 text: " People with obesity have increased risk of cardiovascular disease,type 2 diabetes, high blood pressure, and other health conditions. Waist-to-hip ratio, waist-to-height ratio, and body fat percentage measurements can provide a more complete picture of any health risks. A person should consult with their healthcare provider and consider making lifestyle changes through healthy eating and fitness to improve their health indicators. \n TIPS: \n *Change your diet. \n *Consider adding physical activity \n *Medication \n *Consume less “bad” fat and more “good” fat. \n *Consume less processed and sugary foods. \n *Eat more servings of vegetables and fruits \n *Eat plenty of dietary fiber. \n *limit your vices (drinking,smoking,etc)"
651 halign: "left"
652
653 Widget:
654
655 MDScreen:
656 MDRectangleFlatButton:
657 mode: "rectangle"
658 text: 'Go to Main Menu'
659 pos_hint: {'center_x':0.5, 'center_y':0.8}
660 on_press : root.manager.current='menu'
661
662<ResultNormalScreen>
663 BoxLayout:
664 orientation: 'vertical'
665 MDToolbar:
666 title:'Result: NORMAL WEIGHT'
667 elevation:10
668 right_action_items:[["head-question",lambda x:app.result_dialog()]]
669 Widget:
670
671 MDLabel:
672 text :" Maintaining a healthy weight may lower the risk of developing certain health conditions, including cardiovascular disease and type 2 diabetes. Waist-to-hip ratio, waist-to-height ratio, and body fat percentage measurements can provide a more complete picture of any health risks. \n TIPS: \n *Limit what you eat \n *exercise \n *sleep 7-8 hours a day \n *maintain a consistent sleeping routine \n *consider eating more healthy foods \n *limit your vices (drinking,smoking,etc)"
673 halign: "left"
674
675 Widget:
676
677 MDScreen:
678 MDRectangleFlatButton:
679 mode: "rectangle"
680 text: 'Go to Main Menu'
681 pos_hint: {'center_x':0.5, 'center_y':0.8}
682 on_press : root.manager.current='menu'
683
684<ResultOverweightScreen>
685 BoxLayout:
686 orientation: 'vertical'
687 MDToolbar:
688 title:'Result: OVERWEIGHT'
689 elevation:10
690 right_action_items:[["head-question",lambda x:app.result_dialog()]]
691 Widget:
692
693 MDLabel:
694 text: " Being overweight may increase the risk of certain health conditions, including cardiovascular disease, high blood pressure, and type 2 diabetes. Waist-to-hip ratio, waist-to-height ratio, and body fat percentage measurements can provide a more complete picture of any health risks. A person should consult with their healthcare provider and consider making lifestyle changes through healthy eating and fitness to improve their health indicators.Being overweight or fat is having more body fat than is optimally healthy \n TIPS: \n *Eat a high protein breakfast. \n *Avoid sugary drinks and fruit juice \n *Drink water before meals. \n *Choose weight-loss-friendly foods. \n *Eat soluble fiber. \n *Drink coffee or tea. \n *Base your diet on whole foods. \n *Eat slowly. \n *limit your vices (drinking,smoking,etc)"
695 halign: "left"
696
697 Widget:
698
699 MDScreen:
700 MDRectangleFlatButton:
701 mode: "rectangle"
702 text: 'Go to Main Menu'
703 pos_hint: {'center_x':0.5, 'center_y':0.8}
704 on_press : root.manager.current='menu'
705
706<ResultUnderweightScreen>
707 BoxLayout:
708 orientation: 'vertical'
709 MDToolbar:
710 title:'Result: UNDERWEIGHT'
711 elevation:10
712 right_action_items:[["head-question",lambda x:app.result_dialog()]]
713 Widget:
714
715 MDLabel:
716 text: " Being underweight may pose certain health risks, including nutrient deficiencies and hormonal changes. Waist-to-hip ratio, waist-to-height ratio, and body fat percentage measurements can provide a more complete picture of any health risks. A person should consult with their healthcare provider and consider making lifestyle changes through healthy eating and fitness to improve their health indicators.Being underweight can cause health problems. An underweight person is a person whose body weight is considered too low to be healthy /n TIPS: /n *eat more frequently /n *choose nutrient-rich foods /n *watch what you eat and drink /n *exercise /n *limit your vices (drinking,smoking,etc)"
717 halign: "left"
718
719 Widget:
720
721 MDScreen:
722 MDRectangleFlatButton:
723 mode: "rectangle"
724 text: 'Go to Main Menu'
725 pos_hint: {'center_x':0.5, 'center_y':0.8}
726 on_press : root.manager.current='menu'
727
728<LocationSearchScreen>
729 BoxLayout:
730 orientation: 'vertical'
731 MDToolbar:
732 title:'Hospital Searcher'
733 elevation:10
734 left_action_items:[["backspace",lambda x:app.back_screen6("menu")]]
735 right_action_items:[["head-question",lambda x:app.info1_dialog()]]
736
737 ScrollView:
738 MDList:
739 id: rlist
740<RecordLine>:
741 adaptive_height: True
742 OneLineListItem:
743 text: root.text
744 on_release: app.showinfo(root.parent.parent.panel_cls.text, self.text)
745
746<InformationDialog>:
747 title: "Details:"
748
749<OneLineAvatarIconListItem>: # The list widget
750 id: icnlst
751 IconLeftWidget:
752 icon: "clipboard"
753 RightCheckbox:
754 id: cb
755 Container:
756 MDIconButton:
757 icon:'close-circle-outline'
758 on_release: app.remove_one_item(root.text)
759
760<HistoryScreen>
761 MDFloatingActionButton:
762 icon: "magnify"
763 md_bg_color: app.theme_cls.primary_color
764 pos_hint: {"center_x": .8, "center_y": .1}
765 user_font_size: "25sp"
766 on_release:
767 app.show_database()
768
769 MDTextField:
770 id: inp
771 hint_text: 'Enter Full Name'
772 size_hint_x: None
773 pos_hint: {"center_x": .4, "center_y": .1}
774 width: '170dp'
775
776 MDCard:
777 size_hint: None, None
778 size: "280dp", "280dp"
779 pos_hint: {"center_x": .5, "center_y": .5}
780 orientation: "vertical"
781
782 ScrollView:
783 MDList:
784 id: list
785
786 MDToolbar:
787 id: toolbar
788 pos_hint: {"top": 1}
789 elevation: 6
790 title: "Check History"
791 left_action_items:[["backspace",lambda x:app.back_screen("menu")]]