LibreHealth Planet

July 23, 2021

Bhavesh Shamra

Seventh Week of Coding 19th July - 23 July


 Hello Guys. This blog is to reflect the light on the work done in 7th week of gsoc-21.😀

Tested 3–4 Issues

I had go through almost all the issues of the tracker and trainer app. I had tested issues 4 issues marked with testing label and prepared their solution. I will be discussing my approaches for these issues with my mentor and fixed them in next week.


Fixed mhbs Logo Issue Issue #4

In the tracker app some of the screens have the dhis-2 logo. It is now fixed to mhbs logo.

Fixed Issue #4 

Related MR : Mhbs logo fixed


Updated Trainer App Readme.md

Since we had added media page, offline support, app usage tracker in trainer app we want a small documentation details to be added to the readme for further reference. I had done it -

Committed here ( 718f8756 ).


Fixed Bug in GitLab CI

There is a bug in GitLab CI code of trainer app. Gradle is building the apk correctly but it is not assembling the artifact correctly. It is my mistake what I had made earlier. I had corrected it.

Committed f01c6cf9.


Work Done this Week

  • Fixed logo Issue. 
  • Updated Trainer App Readme.md.
  • Fixed Bug in GitLab CI.
  • Tested 3–4 Issues & prepared their solution. After discussing with mentor need to implement them.

Planning of next Week

by noreply@blogger.com (Bhavesh Sharma) at July 23, 2021 06:22 PM

Shivaditya Shivganesh

Google Summer of Code: Week 7

The video object detection pipeline is designed using openCV. The videos are loaded and a frame rate of 25FPS is assumed. Using the frames the tf.session is initiated and TF Object detection API model is run. The resulting bounding boxes are drawn using openCV.

Resulting images with bounding boxes are written to video with 1FPS using openCV videowriter. After that the generated video can be served using data or blob url depending upon the video so generated.

The segmentation model is not working properly for most of the cases. The obvious solution for it would be to retrain the entire model. The segmentation model has to be implemented in the same way as the Object detection using openCV.

At present the entire video generation pipeline takes less than 40 seconds. This excludes the uploading time and downloading time. The server on which it was tested has a RTX 3060 GPU peak GPU memory utilisation reached upto 11GB

That's all for today!!!

Hope you had a great week

Annyeong

by Shivaditya Shivganesh at July 23, 2021 04:20 PM

Mahavir Singh

Week 7 Coding period GSOC 2021 LibreHealth

  

 Week 7 Coding period GSOC 2021 LibreHealth-



Hey, Reader's we are in the 17th week of the coding period.

The 7th week started on 16th July. This week I was working on web application nearby hospital feature.

What progress have you made this week-

In the 7th week of the coding period, I have done the following thing with the cost of care web application.

1-Added Nearby Hospital to the Home screen of web app using the overpass api.

2- UI change of Home Screen.

3- added search by address and name filter to hospital.

4- sent 1 MR.


link - https://gitlab.com/librehealth/toolkit/cost-of-care/lh-toolkit-cost-of-care-explorer/-/merge_requests/12






My plan for next week- I have planned to do the following task for week 8

1-UI build for compare hospital with star rating.
2-Add compare Hospital Screen flutter app.



I enjoyed working on this feature and I am excited about next week's task.

See you next week.






by noreply@blogger.com (Unknown) at July 23, 2021 12:44 PM

Darshpreet Singh

Coding Period: Week 7 July 19 To July 23

Week 7 Of coding period is completed, I worked on adding on call doctors viewing feature, I completed notifcation showing functionality on risk assessments and monitoring alerts

Added On-Call Doctors Viewing Functionality in App with Unit tests

  • Fetching events from on call doctors program
  • displaying on call doctors
  • displaying images with cache
  • saving the list to local storage
Unit tests
  • yield OnCallDoctorLoaded on successful fetching of data
  • yields OnCallDoctorLoaded on unsuccessful fetching of data by getting from hive
  • returns response with 200 code on successful fetching of on call doctors
  • throws fetch data exception on no internet connection

GIF Showing on Call Doctors slider

Completed Notification screen (Risk Assessment, Monitoring Alerts Tab) with Unit tests

  • Created notification screen bloc
  • Created repository with methods to get risk assessments and monitoring alerts
  • on tap of the list item the child assessments are opened

Unit tests

  • Flutter Notifcation BloC test
  • Test Cases
  • yield NotificationLoaded on Fetch Nofitication Of Babies
  • Flutter Notifcation Repository test
  • Test Cases
  • Risk Assessments Test cases
  • status changed normal to danger
  • status changed problem to danger
  • status changed normal to problem
  • status changed danger to problem
  • Monitoring Alerts Test cases
  • stage-4 assessments next

Unit tests Phase 4

AssessmentsRepository Test Cases
  • Throws exception if assesments are done before 180 mins from birth
  • Throws exception if assessments are incomplete
  • Marks phase-4 as complete if everything is correctly filled
  • Adds stage-4 assessments if list is empty
AssessmentsBloc Test Cases
  • yields AssessmentsAdded on successful adding of phase 4
  • yields AssessmentsError when assessments are incomplete while adding of phase 4 assessments

Phase 3 Assessments Unit testing

Test Cases

  • Throws exception if Stage3 Normal assessments are incomplete
  • Throws exception if Stage3 Problem assessments are incomplete
  • Throws exception if Stage3 Danger assessments are incomplete
  • Marks Stage3 Normal as complete if everything is correctly filled
  • Marks Stage3 Problem as complete if everything is correctly filled
  • Marks Stage3 Danger as complete if everything is correctly filled
  • Adds Stage3 Normal assessments if list size is 2 and classification is normal
  • Adds Stage3 Problem assessments if list size is 2 and classification is problem
  • Adds Stage3 Danger assessments if list size is 2 and classification is danger
Bloc Test
  • yields AssessmentsAdded on successful adding of phase 3
  • yields AssessmentsError when assessments are incomplete while adding of phase 3 assessments

What progress have you made this week?

  • Added On-Call Doctors Viewing Functionality in App
  • Completed Notification screen (Risk Assessment, Monitoring Alerts Tab)
  • Phase - 3,4 Unit testing

What do I plan to do next week?

  1. Fetching & displaying doctor’s schedule in App with unit tests
  2. Making messaging/Notifications viewing functionality in App with unit tests
  3. Creating share App report bug features
  4. Creating Stage 5 (Discharge) Stage with unit tests
Week 7 Of coding period is completed, I worked on adding on call doctors viewing feature, I completed notifcation showing functionality on risk assessments and monitoring alerts

July 23, 2021 05:00 AM

July 19, 2021

Shashwat

Week6

LibreHealth

PROGRESS MADE THIS WEEK:

Hi, According to the proposal timeline, week 6 was to be based on:

  • finishing pending work.
  • fixing bugs.
  • starting week7 tasks.

Fortunately, there was no pending work, hence the focus was mainly on the remaining points.

The tasks of week7 are to:

  • implement the visit-nurse and visit-provider workflow in the react application.

As most of the components required for implementing the visit-nurse workflow are already present in the web-component library, I started working on it.

DETAILED DESCRIPTION:

The visit-nurse workflow consists of many screens and multiple components.

  • First screen contains a find-patient component to select a patient.
  • After the patient is selected a redux action is triggered which updates redux state and stores the selected patient Id.
  • Another redux action updates the active screen and changes it to that of patient encounters, it also updates redux state and stores the current encounter Id.
  • The patient encounter screens contains all the patient appointments, encounters and a component to create an encounter for the undergoing visit.
  • On creating the encounter a redux action updates active page to dashboard.
  • the dashboard page contains 4 tab: home, vitals, allergies, medication.
  • the home tab is the default active tab and contains already exisiting vitals, allergies and medications of the patient.
  • the other tabs are used to create specific resource entry.
  • the user can log out and select a different patient to repeat the above points.

Some of the required components are not merged in the main repo yet, hence respective tab is unimplemented.

Each worklow in the application is a different page with a unique url. Hence the use of redux in immense in the project.
Each workflow also has a dedicated reducer which handles all the operations related to a specific workflow without editing any other state.

Inside the project’s src directory, the workflow directory contains all the code distributed into separate directories for different workflows. This makes it very simple to create / edit or even delete a workflow without affecting other parts of the application!

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
import React from 'react'
import { Navbar } from '../../components/navbar'
import { Home } from '../../pages/home'
import { activePageName } from '../../reducers/visit/visitNurseSlice'
import { CreateEncounter } from './pages/createEncounter'
import { SelectPatient } from './pages/selectPatient'
import { Dashboard } from './pages/dashboard'
import { useSelector } from 'react-redux'

export const VisitNurse = () => {
const activePage = useSelector(activePageName)
let components
switch (activePage) {
case 'SelectPatient':
components = [Home, SelectPatient]
break
case 'CreateEncounter':
components = [Home, CreateEncounter]
break
case 'Dashboard':
components = [Home, Dashboard]
break
}
return (
<Navbar labels={['HOME', 'VISIT']} component={components} />
)
}

This is the main component that is exported. Based on different redux state values different screens are displayed.

All the implemented screens and the workflow can be seen here:

https://gitlab.com/librehealth/toolkit/lh-toolkit-webcomponents/uploads/a9e04307d1199767e3b2c400de785370/screen-capture__2_.webm

NEXT WEEK’s PLAN:

  • Complete the visit-nurse workflow (the parts which are not implemented yet.)
  • Complete the visit-provider workflow.
  • Start working on the e-prescription workflow.

For the visit-nurse workflow, the medication statement and the vitals tabs are left to be implemented, these must be completed within the next week.

There are also some additions to be made in the webcomponents : some fields like encounter and subject (patient) are required to be added to the allergy and medication statement components.

The visit-provider workflow has similarities to the visit-nurse workflow, some of the screen are similar for both, hence the provider workflow should be completed faster than the nurse workflow.

these are the implementation points for the visit-provider workflow:

  • First screen contains a find-patient component to select a patient.
  • After the patient is selected a redux action is triggered which updates redux state and stores the selected patient Id.
  • Another redux action updates the active screen and changes it to that of patient encounters.
  • The patient encounter screens contains all the patient encounters which are fetched using the stored patient Id.
  • On clicking an encounter a redux action updates active page to dashboard.
  • the dashboard page contains 2 tab: physical exams, order.
  • the physical exams tab shows the observations of the patient and contains a component to create any observation.
  • the orders tab will be used to create orders using service request component.
  • the user can log out and select a different patient to repeat the above points.

see you next week 😄.

LibreHealth

July 19, 2021 03:18 PM

Week5

WEEK5

LibreHealth

PROGRESS MADE THIS WEEK:

Hi! We have a small change in the implementation plan. As per the proposal this week => week 5 was meant for implementing the visit workflow in the react / EHR application. The implementation required some new components, which were created last week as per the plan, but the Merge Requests are not merged yet. As there can be multiple changes and modifications required after the MRs are reviewed, It would be better to wait till the components are merged after modifications if required.

Therefore this week was based on doing the tasks of the 7th Week as Week6 is planned for improvements and bug fixing.

Primarily this week was spent creating the last set of components that will be required for the workflows planned.

The following components were created -

  • MedicationRequest
  • dosage

These components will be used for e-prescription workflow, although the dosage backbone element can be used for other Medication workflow based resources as well.

The pattern used for creating these components is same as the one used for other components.

Here is the screenshot:

medicationrequest


next week:

  • find and fix bugs in the react app.
  • start implementing visit workflows in the react application.

see you next week 😄.

WEEK5

July 19, 2021 02:10 PM

July 18, 2021

Shivaditya Shivganesh

Google Summer of Code: Week 6

The main focus for this week was correcting the errors in the bounding box drawn. The bounding boxes differed from the ground truth. That was because of issue regarding the canvas context drawing setting and not related to the actual model.

After the correcting the drawing steps in the canvas context. The bounding box are drawn somewhat similar to the ground truth.

Second goal for this week was development of a remote server based object detection video api. I successfully mad it work for single image but beyond it the server started to hang-up.

The video encoding and decoding process are particularly stressful for the CPU. Throughout the development time the CPU was under 96~97% utilisation running at maximum clock speed. This was the case for a single instance, but if multiple instances are launched the server crashes instantaneously. For running the frozen inference model GPU was used. Under single gpu setup the gpu was under 100% memory utilisation.

Apart from this network latency spikes up during the encoding and decoding process.

That's all for today!!!!

Hope you had a great week

Adios

by Shivaditya Shivganesh at July 18, 2021 02:06 PM

Darshpreet Singh

Coding Period: Week 6 July 12 To July 18

Settings drawer to toggle settings with unit test

  • Created end drawer to toggle settings
  • User can toggle notifications, notifications sound, dark mode
  • The settings done by user are saved instantly in storage and changes are made according to it
  • Wrote unit test for settings bloc with test cases 1. yields SettingsState on toggle of dark mode 2. yields SettingsState on change of notifications sound 3. yields SettingsState on toggle of notifications

Stage 3 Assessments Capture functionality

  • Stage 3 has 3 types (normal, problem, danger)
  • If a baby is classified as any type then that type of stage 3 assessments get added in app

Video GIF showing stage - 2 with classification functionality

  • background turns red on danger
  • background turns yellow on problem
  • background turns green on normal
Classifying as Danger after stage 2 assessments Classifying as Problem after stage 2 assessments

Stage 2 Unit testing

Test Cases for stage-2

  • Throws exception if assesments are done before 60 mins from birth
  • Throws exception if wardname is empty
  • Throws exception if assessments are incomplete
  • Marks phase-2 as complete if everything is correctly filled
  • Adds stage-2 assessments if list is empty

Test Cases for Classification Repository

  • if temperature < 95.5 or > 99.5 then classifies as danger
  • if severe jaundice or fast breathing then classifies as danger
  • if weight < 2000 & poor feeding then classifies as problem
  • if everything is normal then classifies as normal

Showing summary of 24 hours in home screen

To show summary of 24 hours, We need to use lastUpdatedDuration=1d (1 day) as parameter in API to fetch all the events happened within 24 hours.

This has 3 types

  • Admitted Count - Check Status = ACTIVE & Enrollment Date yesterday
  • Discharged - Check Status = COMPLETE
  • High Risk - For each TEI (Baby) this needs to be counted by parameter classification

What progress have you made this week?

  • Phase - 3, 4 assessments capturing functionality
  • Showing summary in Home Screen
  • Developing settings screen of app
  • Unit Testing phase - 2

What do I plan to do next week?

  • Adding On-Call Doctors Viewing Functionality in App
  • Completing Notification screen (Risk Assessment, Monitoring Alerts Tab)
  • Phase - 3,4 Unit testing
Settings drawer to toggle settings with unit test

July 18, 2021 05:00 AM

July 16, 2021

Bhavesh Shamra

Sixth Week of Coding 12th July — 16th July



Hey Everyone, I am back with my weekly blog. Let’s have a look at work done in the 6th week of this amazing journey.


Reimplemented and Completed App Usage Tracking System

Guys actually as stated in the last blog I had completed the app usage tracking system but on discussing with the mentor We come up with a better approach and reimplemented the completed system. There are not very huge changes we just did some changes in the dhis2 storage part. Let’s have a look at how we are tracking the trainer app usage now -

  • App usage is now stored in the user’s data store instead of the tracker program.
  • For each page, a unique id is assigned with which the page usage is tracked in datastore and in local DB as well.
  • There is a local DB support that will store the page usage and when the page usage exceeds the threshold limit for each usage then data will be sent to the dhis2 in the user’s datastore.
  • When local app usage storage get synced with the dhis2 user’s data store then local DB will get resettled to store new data.

Related MR: Added System to track app usage (!196) · Merge requests

Resolved Issues: #36 #120

Passed Pipeline:  #338127000 


Modified mhbs-tracker app to send login credentials

Since we want the user to enter credentials only once for both the apps and trainer app to be launched from the tracker app. Therefore the idea is, tracker app will share the login credentials with the trainer app on each launch. I had saved the login credentials of the user in secured Shared Prefs and on launching intent of trainer app passed these credentials so that trainer app to process further.

Related MR: Passed user credentials to trainer app for login & Fixed Some Warnings · Merge requests

Resolved Issues: #16

Passed Pipeline:  #338443846


Removed Fabric usages

The fabric plugin is depreciated and we need to remove its instances from the app.

Committed here.


Other Works

  • Added commits to the previously sent MR as asked by the mentor to make them able to merge. As for testing purposes, I had used the hardcoded credentials, Now I had removed them and fetched the password from secure storage.
  • I am not clear with the login procedure of the trainer app. I had studied the codebase and understand it well and made changes in the trainer app accordingly to make the user able to get logged in to the trainer app from the tracker app.

Work Done this Week

  1. Implemented New Idea suggested by the mentor and Completed the system to get trainer app usage over dhis2. 
  2. Removed Fabric usages from the app as it is depreciated.
  3. Modified mhbs-tracker app to send login credentials to trainer app for login.
  4. Added commits to the last MR’s to make them able to merge as suggested by the mentor.
  5. Completely understand the secure storage and login flow of the trainer app.

Planning of next Week

  1. Completed all pending work so can focus on new issues. Will be solving more bugs.
  2. Working on “Need to create a new program stage in dhis2” issue of tracker app.
  3. Working on #4 issue.

I am not clear with these issue so will try to discuss these issue in the weekend so that can start work from Monday.

Important Links

  1. Added System to track app usage (!196) · Merge requests
  2. Resolved Issues: #36 #120
  3. Passed Pipeline:  #338127000 
  4. Passed user credentials to trainer app for login & Fixed Some Warnings · Merge requests 
  5. Resolved Issues: #16
  6. Passed Pipeline:  #338443846

by noreply@blogger.com (Bhavesh Sharma) at July 16, 2021 05:41 PM

Mahavir Singh

Week 6 Coding period GSOC 2021 LibreHealth

  

 Week 6 Coding period GSOC 2021 LibreHealth-



Hey, Reader's we are in the 6th week of the coding period.

The 6th week started on 9th July. This week I started working on the Cost of care web application. 

What progress have you made this week-

In the 6th week of the coding period, I have done the following thing with the cost of care web application.

1-added overpass API.

2- Display overpass API result like hospital name, distance, and no of beds available same as flutter application.

This week I was busy with college work. That's why I did less work as compared to the previous week.





My plan for next week- I have planned to do the following task for week 7

1-Improve Home screen UI.
2-I will send 1 merge request to cost of care web app project. 




I started working with the cost of care web react application  I am enjoying working with this project.

see you next week. 




by noreply@blogger.com (Unknown) at July 16, 2021 03:04 PM

July 15, 2021

Mahavir Singh

Find Minimum in Rotated Sorted Array II

 Find Minimum in Rotated Sorted Array II-

Suppose an array of length n sorted in ascending order is rotated between 1 and n times. For example, the array nums = [0,1,4,4,5,6,7] might become:

  • [4,5,6,7,0,1,4] if it was rotated 4 times.
  • [0,1,4,4,5,6,7] if it was rotated 7 times.

Notice that rotating an array [a[0], a[1], a[2], ..., a[n-1]] 1 time results in the array [a[n-1], a[0], a[1], a[2], ..., a[n-2]].

Given the sorted rotated array nums that may contain duplicates, return the minimum element of this array.

You must decrease the overall operation steps as much as possible.

 

Example 1:

Input: nums = [1,3,5]
Output: 1

Example 2:

Input: nums = [2,2,2,0,1]
Output: 0

 

Constraints:

  • n == nums.length
  • 1 <= n <= 5000
  • -5000 <= nums[i] <= 5000
  • nums is sorted and rotated between 1 and n times.

 

Follow up: This problem is similar to Find Minimum in Rotated Sorted Array, but nums may contain duplicates. Would this affect the runtime complexity? How and why?

 

question link -https://leetcode.com/problems/find-minimum-in-rotated-sorted-array-ii/




Solution-

To solve this problem we will use the binary search with some modifications. We observe that the minimum element is less than its left and right element.
we start searching start to end if start < mid element it mean our minimum element belong to another half.
code-



by noreply@blogger.com (Unknown) at July 15, 2021 04:07 AM

July 12, 2021

Bhavesh Shamra

Fifth Week of Coding 5th July - 9th July

 


Hello Everyone, sorry for getting delayed in writing this blog. Last week's work is as follows: 

Worked on App Usage Tracking System of Trainer App 

To track the app usage I had followed these steps-

  1. Created “mHBS Trainer Usage Tracker” Tracker Program
  • Created Tracked Entity Attributes to store [ total page visits, total time spent on a page, page visits per user, time spent on a page by per user].
  • Created “Page Usage Tracker” Tracked Entity with the above attributes.
  • Created a tracker program i.e. “mHBS Trainer Usage Tracker” to track the tei created above (Page Usage Tracker).
  • There are more than 40 pages in Trainer app. Enrolled tei for each page in “mHBS Trainer Usage Tracker” program.

Now we can send data for each and every page to dhis2 in the Tracker program.

2. Created Local SQL- DB table to store app usage

  • Users cannot remain online every time but we want the full usage of our app to track therefore we need some local storage to store app usage in offline mode and update this data to dhis2 whenever the user comes online.
  • Therefore created “app_usage” SQL table in the trainer app with the — [page_id (stores tei id of the page with which it is created at dhis2), page_name, page_visits, time spent on page ]
  • Whenever a user visits any of the pages ( get to know from routes ) then we update its visits in local DB. 
  • And similar to time spent on any page, it will be calculated with the help of “beforePageIn” & “beforePageOut” Events with simple subtraction of time in invoking this event.
  • Then update this data to dhis2

3. Idea of Threshold Limit for app usage

  • I thought that instead of hitting the API continuously to update dhis2 with current usage we can make a threshold limit like 50-page visits means whenever any page visits crossed the number 50 only in that cases we will hit the API to update dhis2 and in other cases, we just update the usage in local DB.
  • This will help us to save a lot of users data.

All of the above-discussed flows are integrated and set up. But recently we come up with a better approach suggested by the mentor, so I will try to implement that one and send the MR instead of this approach.

Works Done in the Fourth Week

  • Created “Page Usage Tracker” Tracked Entity & “mHBS Trainer Usage Tracker” Tracker Program
  • There are approx 40 pages in the trainer app, made tei instance for every page in “mHBS Trainer Usage Tracker” program to keep its usage track.
  • Stored page visits and time spent on each page by the user in local SQL-DB as well as updated this to dhis2 program. 

What do I plan to do next week?

  • Complete Pending Tasks, reimplement this solution with a better approach suggested by the mentor.
  • Try to fix some more bugs.

Have you had any blockers or issues that are impeding your project?

  • Not yet


by noreply@blogger.com (Bhavesh Sharma) at July 12, 2021 12:13 PM

July 11, 2021

Shivaditya Shivganesh

Google Summer of Code: Week 5

The main target for this week was POC development. I was successful able to develop a POC with help of HTML5 Canvas and WebXR. The total inference time is about 25 seconds on a Snapdragon 870.

The previous week's model had inherent Frozen-Graph Operations issue because of which is did not perform well when used with a larger dataset.So, I had to re-train the model. The newer performed well.

For Bounding Box generation, I have HTML5 canvas where in I draw the rectangle with the help of context2d. Total time for bounding box drawing and model inference is about 25 seconds for 3 min clip.

The video clip tested contains the images which are part of the segmented images obtained from the kavsir dataset. For joining the images I have used a software called as clideo.

The POC works well on Android phones without any major performance issues.

That's all for today!!!

Hope you had a great week

Au Revoir

References

Clideo

by Shivaditya Shivganesh at July 11, 2021 11:33 AM

Darshpreet Singh

Coding Period: Week 5 July 5 To July 11

Stage 2 Assessments Capture with Classification

  • Created stage-2 assessments capture with clasifying baby’s health using program rules
  • Health is classified in three categories (Normal, Problem, Danger)
  • App takes all data entered by user in stage 2 & then evaluate program rules for classifying health
  • After classifying health the color of assessments screen changes according to the category

Stage 2 Notifications showing feature

  • Used awesome_notifications package for displaying notification
  • Displaying scheduled notifications reminder if user has not completed assessments
  • Displaying notification on stage assessments opening
  • Created Offline Notification showing functionality
    1. Showing notification when baby is registered to complete phase -1 assessments
    2. If user forgets to do phase 1 assessment then reminding by notification again after 60 minutes
    3. Notification feature works offline using scheduled notification featur
    4. Package used for showing notification https://pub.dev/packages/awesome_notifications

Screenshots of notifications

Unit testing assessments bloc, client, repository, phase-1

Test Cases

  • Flutter Assessment BloC test
    • Test Cases
    • yield AssessmentsInitial on successful fetching of data
    • yields AssessmentsError on unsuccessful fetching of data
    • yields AssessmentsAdded on successful adding of phase 1
    • yields AssessmentsError when ward name is empty while adding of phase 1 assessments
    • yields AssessmentsError when assessments are not completed while adding of phase 1 assessments
  • AssessmentsRepository testing
    • Test Cases
    • Throws exception if wardname is empty
    • Throws exception if assessments are incomplete
    • Marks phase-1 as complete if everything is correctly filled
    • Adds stage-1 assessments if list is empty
  • Assessment Client Test
    • Test Cases
    • returns response with 200 code on successful fetching of assessments
    • throws fetch data exception on no internet connection

Searching & sorting functionality on list of babies screen

Sort List of babies by

  • Time (Birth Time)
  • Status ( Classificiation - Normal, Problem, Danger ) (Danger & Problem have high priority)
  • Location ( Ward Name)
By Birth Time By Status By Location

Search List of babies by mother’s name

Search Oni Search test

What progress have you made this week?

  • Adding Search, Sort Functionality in List Of Babies screen
  • Unit Testing Assessments Bloc, Client, Repository, Phase 1
  • Created Phase-1 Notifications showing functionality
  • Created Phase-2 Assessments Capture with notifications

What do I plan to do next week?

  • Phase - 3, 4 assessments capturing functionality
  • Showing summary in Home Screen
  • Developing settings screen of app
  • Unit Testing phase - 2 , 3 , 4
Stage 2 Assessments Capture with Classification

July 11, 2021 05:00 AM

July 08, 2021

Mahavir Singh

Week 5 Coding period GSOC 2021 LibreHealth

 

 Week 5 Coding period GSOC 2021 LibreHealth-



Hey, Reader's we are in the 5th week of the coding period.

The 5th week started on 2nd July. This week was exciting and I enjoyed this week's task very well.

What progress have you made this week-

In the 5th week of the coding period, I have done the following thing with the cost of care flutter application.

1-Added address field To download CDM screen.

2- search by address and hospital name to download CDM screen.

3- added text when no bookmarked item left.

4-UI modification.






I sent 1 merge request to the development branch including all changes.



My plan for next week- I have planned to do the following task for week 6

1-I will start working on cost of care react web application. 
2-I will read the codebase of the web app.
3- I will display nearby hospitals overpass API.



I really enjoyed the 5th week of the coding period and I gained a lot of knowledge from it.

Now we are going to enter in  First evaluation period  (12-16 July ). 
see you next week. 




by noreply@blogger.com (Unknown) at July 08, 2021 11:46 AM

July 04, 2021

Darshpreet Singh

Coding Period: Week 4 June 28 To July 4

Stage 1 Assessments Capture Functionality

  • Fetching & Capturing Stage - 1 Assessments , with this feature user is able to view the captured assessments & also capture the assessments and push the data to DHIS2.
  • This works offline also, data is sent to server when user refreshes on having internet next time
  • Created a BLoC to handle assessments
  • Created Stage - 1 model class which parses and converts to JSON format for parsing and converting data
  • added required ID’s in static variables in dhis2_config.dart file
  • created a client to send data, created a repository to handle data from client

Fetching list of babies enrolled in program

  • Created a BLoC for fetching list of babies enrolled in a program
  • Creating a client & repository class for fetching & saving data locally
  • Sorting the list by time to categorize recently & past registered babies
  • On Tap of baby list item the app opens assessments screen & start fetching assessments
  • List item color changes with classification of baby - Danger (Red), Problem (Yellow), Normal (Green)

Merge Request Link

User Profile Screen Functionality

  • Fetching list of users notification from dhis2
  • saving data in hive storage after fetching item
  • fetching & displaying the notification date & time for each notification

Merge Request Link

Localized strings in assessments phases UI

  • All strings used in assessments phases UI are now localized
  • localized strings are saved in app_en.arb file

Merge Request Link

What progress have you made this week?

  • Implemented User Profile Screen functionality
  • Implemented fetching list of babies from dhis2 & displaying in screen
  • Cache the data after fetching from dhis2
  • localized strings in assessments phase
  • Phase 1 assessments capturing functionality

What do I plan to do next week?

  • Phase - 2, 3, 4 assessments capturing functionality
  • Adding Search, Sort Functionality in List Of Babies screen
  • Adding sort functionality , settings UI, activity logs in profile screen
  • Update functionality in profile screen
Stage 1 Assessments Capture Functionality

July 04, 2021 05:00 AM

Shashwat

Week4

WEEK4

LibreHealth

PROGRESS MADE THIS WEEK:

Advancing into the 4th week, everything is going as per the plan. By the end of this week, most of the components planned are already created.

This week (4th week) was utilised creating components for the visit workflow.

The visit workflow primarily involves the nurse and the provider along with the patient, the nurse checks the arrival of the patient, takes the vitals, verifies and creates medications and allergies.

Provider then checks the patient and performs exams and orders lab tests if necessary.

FHIR does not have a visit resource so every operation related to a visit event is handled by the modified encounter resource.

In FHIR, Appointment is used for establishing a date for the encounter,

When the patient arrives and the visit is about to start, then the appointment will be marked as fulfilled, and linked to the newly created encounter.

The following components were created for this: (other components which will be required apart from the following mentioned components are already created)

  • Encounter
  • Service Request
  • Medication Statement
  • Quantity datatype component
  • Allergy intolerance
  • Observation

The web component repo already had components for allergy and observation, but their utility was limited, moreover for every property there was a components which was actually not required as using created datatype components all the properties of any resource could be included in a single component.

A definte pattern is used for creating these components. The pattern is demonstrated below:

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
/*imports required*/
import { LitElement, html, css } from 'lit-element';

class MyCustomElement extends LitElement {

//all the properties are defined here
static get properties() {
return {
value: { type: Object, reflect: true },
}
}

constructor() {
super();
this.value = {};
}

// handle the change in input
setDisplayValue(e) {
this.value.display = e.target.value;
}

// templates to render the component
displayTemplate() {
this.value.display = this.value.display || "";
return html`<div>HELLO!</div>`
}

// render al the templates created
render() {
return html`
${this.displayTemplate()}
`
}
}

customElements.define('my-custom-element', MyCustomElement);

Here are the screenshots:

observation


servicereq


medicationstatement

allergy

encounter


next week:

  • create the remaining component.
  • implement visit workflows in the react application.

see you next week 😄.

WEEK4

July 04, 2021 04:15 AM

July 03, 2021

Shivaditya Shivganesh

Google Summer of Code: Week 4

This week was an eventful one. I started the week with TF Object Detection model development. I trained two models one was Faster RCNN and another one was MobileNet SSD. I plan to train YOLO models too and convert them into ONNX format for JS inference.

For VR the bounding boxes posed a lot of problems . For rendering the bounding boxes I used HTML5 Canvas and WebGL for designing and rendering the bounding box. The Dataset for Segmentation has only one class so class labels are not rendered on top of the bounding box. The model inference is still slow and in some cases fails to render the bounding boxes.

POC for Object detection is not working properly at this juncture. It still requires few more corrections for improving the model performance.

That's all for today!!!

Hope you had a great week

Vale

by Shivaditya Shivganesh at July 03, 2021 04:28 PM

July 02, 2021

Bhavesh Shamra

Fourth Week of Coding : 26 June - 2 July



Hello everyone, do you want to know what is the progress of our project?😏

Obviously, I am here to share that with you. So let’s have a look at the work done in the fourth week of this amazing journey🧐-

This week I had set up Gitlab CI for our trainer app, Completed the offline support for the trainer app using SQLite database, added syncing UI in the app to differentiate the downloaded content, testing 2–3 issues that were mentioned in the last blog that they are resolved or not. Wait guys let’s discuss all this in detail😀-


Set up CI/CD Pipeline to automatically build apk/artefact

Without CI/CD it difficult to check whether the particular code will build properly or not and we have to think about a local clone of the project or any other option to get its latest apk. To solve this I had set up the CI/CD Pipeline as well with the MR sent last week and in the one sent this week also.

Resolved Issues: #112

committed here - ce83405a 

Last run Pipeline: #327895681

CI is also added to offline-support MR.


Completed offline support

Initially, in the last MR documents on the media page and every media file get downloaded and then played there is not any support for storing any type of data locally to the device to make it available offline.

Therefore I had added an SQL database to the trainer app to store data. This week I had completed my pending work related to this which was just started last week.

Now the updated list of documents get saved to the local database whenever a user visits the media page with an active internet connection and if a user visits this page in offline mode even in that case he is able to use the application in the same manner as it is in online mode, in this case, it is fetching data from a local database.

When a user clicks on any media file if it does not download it takes some time to get downloaded the first time and show a progress UI. Let’s suppose if it is already downloaded in that case it gets played instantly without waiting for a newer version but every time when user clicks on the media either it is already downloaded or not, it hits the API to update the media file. In offline mode, nothing update happens and it played the last cached version stored in the device and in online mode, it instantly plays the last cached version and hit the API to listen for any updates on this file.

SQL Database Schema & Logic

  1. When the application launches it creates a media table with 4 columns-
  • id- stores the id of the document with which it is stored on dhis2
  • name- stores display Name of the document
  • fileuri- will be not null only when the document is downloaded and saved on the device, it stores the local location of the document on the device and in other cases its value is null
  • mimeType- it stores the content Type or media type of the document like application/pdf, video/mp4, etc. to play the media using the fileopener2 plugin

2. Logic for storing a list of documents of media page-

  • when a user visits this page new list will be fetched from dhis2 and now we need to take care of 3 cases : 

(1) DELETE : Document ids not present in the new list but present in our local DB. These documents are deleted from dhis2 and need to be deleted from local DB as well.

(2) UPDATE : After completing the first step, local DB is left only with those ids which need an update. We just update the particular row of their ids of local DB with whatever new corresponding data we received.

(3) CREATE : Now those document ids of a new list that are not passed through step 2 are one of those of newly added documents. We just need to create a new document with their data in our local DB.

These steps will take care of all cases for making a list of documents available offline.

committed here: e8b93759

3. Logic for offline support of media files-

  • Whenever the user clicks on the media file it gets downloaded and saved to the device local storage and its corresponding file location and mimeType gets updated to the fileuri and mimeType key of local DB for that document. And on the next time, a user doesn’t need to wait for it to get downloaded it gets played from the last saved location.
  • I had used PERSISTENT storage and cordova-file-plugin to save the file to the device.

committed here: 65ddad02

Resolved Issues: #69

Corresponding MR: !195

Pipeline: #329574660


Added Sync Based UI

I had added 3 types of sync symbols ( Pending, Completed, Error ) in the media page list.

I had also added a progress bar that shows the ongoing sync state.

committed here: bf49a629


Testing of Issues

There are some issues whose testing I have to do last week. Let’s discuss them one by one-

  1. Track app usage data ( #36 )
  • We want to track the usage of our app and gets its report on dhis2 or tracker app.
  • For that, the page visit is set up for all pages means whenever the user visits any page then it gets recorded on local device storage as a counter of visits to that page.
  • Now the need is to shift this data to dhis2 via Web API in an App Usage Tracker Program. This part is not done.

2. Role-based restricted access for viewing tracked entities ( #44 )

  • We want that the TEI should be visible only to the person who had created it other person visibility to this should be restricted.
  • This part is not working and since we had updated the mHBS app from dhis2 after 3 years it has a lot of changes and the new codebase is completely in Kotlin and well architectured and segregated.
  • Therefore this part need rework. This is not working in the new app. You can have a look at the latest mHBS tracker app codebase from here.

3. Need to create a new program stage in dhis2 ( #10 )

  • This issue is also cannot be closed for now.
  • There is no commit in the latest code that can solve this for now.
  • Needs rework.


Works Done in the Fourth Week

  1. Set up CI/CD to automatically build the apk and check for errors.
  2. Added full offline support for the media page for both media files and a list of documents.
  3. Added file synced based UI for each media file.
  4. Tested 3 Issues.

Important Links

  1. Merge Request: Having code related to full offline support & SQL implementation of media page.
  2. Solved Issue: #69 #112
  3. Gitlab Pipeline : #329574660 #327895681
  4. Tested Issues : #36 #44 #10

Work to be done in the next week

  1. Working on Issue #36 
  • Shifting all app usage data from local storage to dhis2

      2. Working on Issue #44

  • Restricting the access of other users for viewing tracked entities

      3. Working on Issue #10

  • create a new program stage in dhis2

by noreply@blogger.com (Bhavesh Sharma) at July 02, 2021 05:51 PM

July 01, 2021

Mahavir Singh

Week 4 Coding period GSOC 2021 LibreHealth

 Week 4 Coding period GSOC 2021 LibreHealth-



Hey, Reader's we are in the 4th week of the coding period.

The 4thweek started on25th June. Till now I am really enjoying this coding period and I am improving my development skill.

What progress have you made this week-

In the 4th week of the coding period, I have done the following thing with the cost of care flutter application.

1- Added Search bar to compare hospital screen.

2-Compare Hospital Screen UI modified. 






I sent 1 merge request to the development branch including all changes.



My plan for next week- I have planned to do the following task for week 5 

1-I will add the Search by address feature to the download CDM screen.
2-I will add a new address field in download CDM  list.
3- I will discuss UI regarding the new address field with mentors.



The 4th-week tasks were quite easy. During the 4th  week, I sent a Merge request to the development branch as I told you earlier. 

This is all about 4th week of the coding period. I really enjoyed it.

See you next week.




by noreply@blogger.com (Unknown) at July 01, 2021 05:15 AM

June 26, 2021

Shashwat

Week3

WEEK 3:

LibreHealth

PROGRESS MADE THIS WEEK

Hello everyone. As dicussed in the previous blog, this week was to be utilised for creating the Appointment workflow in the React application.
Surpisingly, the task hardly took 24hrs for completion, henceforth by the end of Tuesday I was done with this week`s work 😄.
Anyways there were a few bugs in test files that were to be fixed, so I utilised my weeks fixing some web-component tests.

here are the screenshots of the workflow:

Appointment workflows

upcoming days:

  • start working on the task of the coming weeks.

next week:

  • complete the components for the visit workflow.

see you next week 😄

WEEK 3:

June 26, 2021 01:36 PM

Week1

WEEK 1:

Finally the community bonding priod is over and the coding period began. In this blog I have loads of content and code to cover!

LibreHealth (@LibreHealthIO) | Twitter


ANALYSIS OF COMMUNITY BONDING PERIOD
In the community bonding period there were mainly 2 objectives we had set :

  • SETUP THE REACT APPLICATION WITH CI/CD.
  • DESIGN THE APPLICATIONS WITH THE ENDPOINTS.

Most of my community bonding period was spend on the CI/CD part. The major cause of this was
cross-browser cross-platform testing integration with React, the tool which was planned to be used was saucelabs and unfortunately for me :(, there was no proper content regarding saucelabs integration with react to be found anywhere, I tried to make things work on my own and nearly succeeded testing on jest with snowpack and react, but snowpack could not resolve the dependencies inside the lh-toolkit-webcomponent monorepo when it was caching the files.

Snowpack serves the application unbundled during development. Each file needs to be -built only once and then is cached forever. When a file changes, Snowpack rebuilds that single file

As mainly we will be covering unit and integration testing, saucelabs will not be a neccessity as suggested by the saucelabs community. So I went on to setup the react app

  • testing : using react-testing-library with jest,
  • deployment : gitlab pages
  • some eslint integration and git hooks.

Design part was smooth sailing and offered many insights that I might have not noticed until later, upon the suggestion of my mentor I have also documented the api endpoints. I will drop the file with the designs and the endpoints here : https://geforce6t.github.io/blog/categories/EHR/

PROGRESS MADE IN THE WEEK

the plan for the first coding week is to do the following:

  • setup the application
  • create home, login pages
  • implement the checkin workflow

monday: I started coding 🎉️ , and completed the first part of the plan.


tuesday: I started working on the project layout and accomplished the following :

  • organize project into different directories including pages, components, redux store, redux slices etc
  • added MUI with theme
  • created login and auth pages with support for other workflows in mind.
  • created redux auth workflow

wednesday: looked for ways to style the lit-components………, lit components uses shadow dom and the style encaptulation feature make it a little tricky to style custom components from the outside, I made some hacks to do the same using callback refs inside the react component where the lit component resides,but this approach would not be optimal.

Probably some minimal styles could be applied inside the lit components and would do great, anyhow I was able to style the material components using the global material css variables.

One of the things that I need to look into is to add some style to the lit-components as a whole : “margin, broder shadow and stuff”, this will not be a big issue as I have a lot of other components to create so mainly the style will be global and can be done anytime.

So here is how the create-patient component has changed visually:

After

compared to above, this is what we have as default:

Before


thursday: created the general search component.

the general serach component is something that I would like to talk about. The general search component was actually little difficult thing to do, for different cases the search params, columns, query parameter may differ so to create a general purpose search component all of this features must be added as an attribute which was done in the implementation,

pssing params to the search component

the functions used in the seach component are

  • one for search, based on fetching and storing the result after filtering the result to only include results for the columns using the query.
  • another for storing pagination contexts: next page and previous page url,

the most difficult part about the implementation was filtering results to form column enteries, the values that we may want can be nested one/many levels so it is very important to provide a query string to execute this filtering, it is not possible to pass this query string via props as it is inside a map method, so I created a function with switch case for different workflows that we will implement.

filtering data to display in the columns

finally the components looks like this :

serach component

friday: wrote the edit and show patient code to complete the layout of the checkin worklfow 🎉️, but there was one issue that came across while creating the put request, for some of the fhir components the values are not changing even after visually their value is changed, this might be an issue in the react app or the wc repo. I will take a look and solve this issue in the coming days!

UPCOMING DAYS

  • add event handlers for the create patient page.
  • debug the value not changing issue while making a put request.
  • add css for element (not compulsary for now)

thanks for reading till the end ❤️ , see you next week 😄

WEEK 1:

Finally the community bonding priod is over and the coding period began. In this blog I have loads of

June 26, 2021 01:30 PM

Week2

WEEK 2:

Hello folks! Another week done and another batch of code written and merged !! In the coming sections I will be explaining the details of the work done this week.

LibreHealth (@LibreHealthIO) | Twitter

PROGRESS MADE THIS WEEK

In the previous week, I had implemented the checkin workflow in the react application. According to my plan in the proposal, this week was to be used to create components for the resources that will be used in the Appointment workflow.

the resources are:

  • Slot
  • Schedule
  • Appointment

In the beginning of the week, I started looking into the lit project: upon which the components are based. I read the documentation and decided how to create the components so that they can be utilised for different CRUD operations.

I also noticed a few bugs in the components while implementing the checkin workflow, for this I created a MR and fixed them.

By wednesday I started creating the components. Most of the components that will be created have a reference or codeable-concept property datatype, hence creation of components that can be used in different contexts to implement the mentioned datatypes will help a lot.

By the end of wednesday I had created these datatype components. Once these components were created, the resource components were not difficult to develop.

By thursday I had created Slot-Schedule and by friday Appointment.

During this period my mentor noticed a few bugs in the project:

  • inconsistent label case use
  • unavailable demo files (build issue)

So along with the development of the components, I made a couple of commits for these issues as well.

Template used for component creation:

As a component will be used for CREATE / GET / PUT request , I made it compatible with everything.

For the create part, inside the constructor an initial empty skeleton value was provided. This value property would be overwritten if the component contains the value attribute. Hence this supports both the cases of create and get operations as a user can avoid the value attribute if the intention is to use the component for creating entries and provide a value after fetching a specific endpoint if the intent is to show entries.

Moreover even if a value property is provided and some of the keys are missing, the component will still remain the same as I have done a check for individual property existence and default value allocation as well, this feature will be helpful for the edit operation.

here is the default value property set inside the Appointment component constructor. Similar structure is used in the other 2 components.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
{
identifier: [{}],
status: '',
serviceCategory: [{coding: [{ system: "", code: "", display: ""}],text: ""}],
serviceType: [{coding: [{ system: "", code: "", display: ""}],text: ""}],
specialty: [{coding: [{ system: "", code: "", display: ""}],text: ""}],
appointmentType: {coding: [{ system: "", code: "", display: ""}],text: ""},
slot: [{reference: "", display: "", type: ""}],
comment: '',
start: moment().format('YYYY-MM-DDThh:mm:ss[Z]'),
end: moment().format('YYYY-MM-DDThh:mm:ss[Z]'),
participant: [{type: [{coding: [{ system: "", code: "", display: ""}],text: ""}], status: '', actor: {reference: "", display: "", type: ""}}]
}

here are the screenshots of the implemented components:

Appointment


Slot


Schedule


upcoming days:

  • write unit test for the components.

thanks for reading till the end ❤️ , see you next week 😄

WEEK 2:

Hello folks! Another week done and another batch of code written and merged !! In the coming sections I

June 26, 2021 01:30 PM

ehr_endpoints

CHECK-IN WORKFLOW :

Valid search parameters for this search are: [_id, _language, _lastUpdated, active, address, address-city, address-country, address-postalcode, address-state, address-use, birthdate, death-date, deceased, email, family, gender, general-practitioner, given, identifier, language, link, name, organization, phone, phonetic, telecom]`

SEARCH PARAMS :

GET [base]/Patient?identifier=[value]

GET [base]/Patient?name=[value]

CREATE PATIENT :

POST [base]/Patient

GET PATIENT :

GET [base]/Patient/[_id]

EDIT PATIENT :

PUT [base]/Patient/[_id]

check-in.mp4 from Shashwat on Vimeo.


APPOINTMENT WORKFLOW :

SCHEDULE TAB

Valid search parameters for this search are: [_id, _language, _lastUpdated, active, actor, date, identifier, service-category, service-type, specialty]`

SEARCH PARAMS :

GET [base]/Schedule?actor=Practitioner/[value]
GET [base]/Schedule?actor=Location/[value]
GET [base]/Schedule?actor=Patient/[value]

GET [base]/Schedule?service-category=[value]

CREATE SCHEDULE :

POST [base]/Schedule

GET SCHEDULE :

GET [base]/Schedule/[_id]

EDIT SCHEDULE :

PUT [base]/Schedule/[_id]

SLOT TAB

Valid search parameters for this search are: [_id, _language, _lastUpdated, appointment-type, identifier, schedule, service-category, service-type, specialty, start, status]`

SEARCH PARAMS :

GET [base]/Slot?status=[value]
GET [base]/Slot?schedule=[value]

CREATE SLOT :

POST [base]/Slot

GET SLOT :

GET [base]/Slot/[_id]

EDIT SLOT :

PUT [base]/Slot/[_id]

APPOINTMENT TAB

Valid search parameters for this search are: [_id, _language, _lastUpdated, actor, appointment-type, based-on, date, identifier, location, part-status, patient, practitioner, reason-code, reason-reference, service-category, service-type, slot, specialty, status, supporting-info]”`

SEARCH PARAMS :

GET [base]/Appointment?actor=[value]
GET [base]/Appointment?status=[value]

CREATE APPOINTMENT :

POST [base]/Appointment

GET APPOINTMENT :

GET [base]/Appointment/[_id]

EDIT APPOINTMENT :

PUT [base]/Appointment/[_id] `


VISIT WORKFLOW:

///////////////////////////////////////////////NURSE///////////////////////////////////////////////

FIND PATIENT:

SEARCH PARAMS :

GET [base]/Patient?identifier=[value]
GET [base]/Patient?name=[value]

once the nurse selects a specific patient the patient Id will be
stored by a redux action. So the patient id below will be fetched from
the redux store via a useselector hook to get the appointments and the
encounters related to a specifc Patient entry.

GET [base]/Appointment?actor=Patient/[_id]

GET [base]/Encounter?subject=Patient/[_id] /* TO GET ALL THE ENCOUNTERS SPECIFIC TO A PATIENT */

POST [base]/Encounter /* TO CREATE AN ENCOUNTER */

PUT [base]/Encounter/[_id]

GET [base]/AllergyIntolerance?patient=Patient/[_id]

POST [base]/AllergyIntolerance /* TO CREATE AN ALLERGY ENTRY FOR THE PATIENT */

MEDICATIONS THE PATIENT IS TAKING/HAS TAKEN:

the fhir resource used here is MedicationStatement : this resource
has a reference to the patient, this resource is required to know what medications the
patient has been taking / taken before.

GET [base]/MedicationStatement?subject=Patient/[_id]

POST [base]/MedicationStatement /* TO CREATE A MEDICATION-STATEMENT ENTRY FOR THE PATIENT */

PATIENT VITALS:

IN FHIR THERE IS NO SEPARATE RESOURCE FOR VITALS , VITALS CAN BE TAKEN
AS AN ENTRY OF OBSERVATION RESOURCE UNDER THE CATEGORY OF VITAL-SIGNS

GET [base]/Observation?category=vital-signs&subject=Patient/[_id]

POST [base]/Observation /* TO CREATE AN OBSERVATION ENTRY FOR THE PATIENT VITALS */

PUT [base]/Observation/[_id] /* TO EDIT OBSERVATION ENTRY FOR THE PATIENT VITALS */


/////////////////////////////////////////PROVIDER/////////////////////////////////////////

FIND PATIENT:

SEARCH PARAMS :

GET [base]/Patient?identifier=[value]
GET [base]/Patient?name=[value]

once the provider selects a specific patient the patient Id will be
stored by a redux action. So the patient id below will be fetched from
the redux store via a useselector hook to get the
encounters related to a specifc Patient entry.

GET [base]/Encounter?subject=Patient/[_id] /* TO GET ALL THE ENCOUNTERS SPECIFIC TO A PATIENT */

PUT [base]/Encounter/[_id]

similar to the above case once an encounter is selected its id will be stored via redux store

GET [base]/Observation?encounter=Encounter/[_id]

POST [base]/Observation

GET [base]/ServiceRequest?encounter=Encounter/[_id]

POST [base]/ServiceRequest


E-PRESCRIPTION WORKFLOW:

////////////////////////////////////////////PRESCRIBER//////////////////////////////////////////

FIND PATIENT:

SEARCH PARAMS :

GET [base]/Patient?identifier=[value]
GET [base]/Patient?name=[value]

once the nurse selects a specific patient the patient Id will be
stored by a redux action. So the patient id below will be fetched from
the redux store via a useselector hook to get the
encounters related to a specifc Patient entry.

GET [base]/Encounter?subject=Patient/[_id] /* TO GET ALL THE ENCOUNTERS SPECIFIC TO A PATIENT */

PUT [base]/Encounter/[_id]

similar to the above case once an encounter is selected its id will be stored via redux store

GET [base]/AllergyIntolerance?patient=Patient/[_id]

MEDICATIONS THE PATIENT IS TAKING/HAS TAKEN:

the fhir resource used here is MedicationStatement : this resource
has a reference to the patient, this resource is required to know what medications the
patient has been taking / taken before.

GET [base]/MedicationStatement?subject=Patient/[_id]

MEDICATIONS PRESCRIPTION:

the fhir resource used here is MedicationRequest

POST [base]/MedicationRequest


CHECK-IN WORKFLOW :

Valid search parameters for this search are: [_id, _language, _lastUpdated, active,

June 26, 2021 01:12 PM

June 25, 2021

Bhavesh Shamra

Third Week of Coding : 19 June - 25 June

This was the third week of the coding phase and it was good. This week majorly, I had worked on the way to play the video blobs that I had fetched from the server last week and showing the pdf files in the app. I had worked on the offline support of the application as well. Let’s see everything in detail-

Added a feature to play all type media files in app

We have 2 types of media files videos and pdfs which we have to show in our app’s media section. Let’s see what approach I had chosen to achieve that and why?

  1. Firstly I had downloaded the blob object of the media that is being uploaded on the dhis2 using XMLHttpRequest.
  2. Then I had created a local temporary space in the memory to save the file.
  3. And lastly using the fileOpener2 plugin, I had opened that file using the supported apps that are already available on the user’s device.

This seems simpler but really It takes a lot of time to figure out how actually Cordova handles all this stuff🤔because I am not much familiar with the Cordova platform but finally I had made it. Actually, for videos I had initially used the most popular thing that is iframe but it didn’t work and I had changed it with the video element of HTML, and it gets working 😍. But the problem arises when I am trying to open pdf because in the browsers there are inbuilt plugins that handle pdf opening and all but for the android, there is no such thing therefore I need to use external apps with the help of fileOpener2 plugin. 

Final Output: Now one can upload pdfs and videos on the dhis2 resources and it will be fetched to our trainer app and can be accessed with the internet.

Have a look at the PR related to this task: Added mediaPage and Populated with real data Fetched from bmgfdev instance and Added support to play all media files of type blob (!194) 

Related Issues : #190 #77 #39

Added SQLite Database for storing data locally

We want our application to be active in offline mode as well therefore I had decided to use the sqlite database of the cordova plugin. Let’s look at the implementation part of the offline-support of media section:

 1. I had made a mhbsTarinerDb and media table to store the data of all the cuments. I will be storing a name (displayName of the document), id (dhis2 id of the document on the server), fileUri (location of the file if this media is downloaded). 

2. When the users click on the media tab then a list will be made from the documents available on the local db and it is shown on the tab at the same time an API call is initiated to the server if a user is online and we received a success response we will update our local db and media tab with this new data.

3. When a user clicks on particular media files then as stated earlier a blob object is downloaded and from it, we make a local file and save it to the device, now one point gets added that is we will store its location to our db as well and when the user again clicks on the particular files then similar thing happen means old content is shown till the new one is not downloaded and when new content is ready it gets updated to our db.

This part is almost ready and is under testing you can look at its progress from the offline-support branch of my forked repo. Worked done till now in offline support of media tab is here.

Work Done this Week

  1. Added a feature to play all type of media files in the app.
  • The list of all documents uploaded on the bmgfdev instance ( here ) is visible in the app.
  • Videos Media & Pdf files both can be opened and can be accessed through the app.

      2. Added SQLite database to store data locally and to provide offline support. 

Planning of next Week

  1. Finish pending work of Offline support and create PR for that.
  2. Adding CI to Trainer App: Continuous integration through Gitlab CI (#112) 
  3. Testing of some issues — 

Important Links

  1. Added mediaPage and Populated with real data Fetched from bmgfdev instance and Added support to play all media files of type blob (!194)
  2. Issue #190
  3. Issue #77 
  4. Issue #39
  5. Added SQL Database for storing data locally (26ad4006) · Commits · Bhavesh Sharma / mHBS-trainer · GitLab

by noreply@blogger.com (Bhavesh Sharma) at June 25, 2021 08:05 PM

Shivaditya Shivganesh

Google Summer of Code: Week 3

Basic POC (Proof of Concept) design was completed and successfully implemented using WebXR and react. A JSON file was created which stores the links and names of all image file present in the directory.

The BiT model was converted using TensorflowJS model converter. The model then generated was used in POC. Images are cast on a Curved Plane in the VR environment, on which model inference runs.

Every 5 Seconds a new image is loaded and inference is given with 4 seconds. The labels are displayed as Text on top of the Plane in the VR environment.

The Video demonstrates a sample scenario. The inference reports undefined because the model was not able to classify the successfully

That's all for today!!!

Hope you had a great week

Do svidaniya

by Shivaditya Shivganesh at June 25, 2021 04:53 PM

June 23, 2021

Mahavir Singh

Week 3 Coding period GSOC 2021 LibreHealth

  

Coding Period Week 3 GSOC 2021 LibreHealth-

Hey, Reader's we are in 3rd week of the coding period.

The 3rd week started on 18th June.





What progress have you made this week-

In the 3rd week of the coding period, I have done the following thing with the cost of care flutter application.

1- Implement Unit testing for inpatient procedure.

2-Implemented Unit test for outpatient procedure.










    

My plan for next week-

1-I will add a search bar to compare hospital screen.
2-UI modification.


The 3rd-week tasks were quite easy. During the 3rd  week I sent a Merge request to the development branch. 

This is all about 3rd week of the coding period. I really enjoyed it.

See you next week.




by noreply@blogger.com (Unknown) at June 23, 2021 11:38 AM

June 18, 2021

Bhavesh Shamra

Second Week of Coding : 14 June-18 June

The second week of codding has been passed and I am getting more dive into the huge code base of the mHBS Tracker and Trainer app. Let’s have a look at what I had done this week :

Find out the Cause of Issue-1

As I stated in last week blog that we were getting the build error like ‘STRING_TOO_LARGE’ which is not affecting the Gradle build in making the apk but is shown as an error while building the app. This is really a very time-consuming error, I had tried a lot of possible solutions to fix it let’s discuss all of them one by one :

  • Android Asset Packaging Tool: Since these errors can be picked out by an SDK tool i.e. AAPT, I first tried that one using this command

aapt dump — values resources dhis-debug.apk | grep -B 1 ‘STRING_TOO_LARGE’

  • Grep Tool: Another way of solving this could be getting a decompiled apk of the app using any online decompiler and in the decompiled apk try to find ‘STRING_TOO_LARGE’ string using grep tool or any other medium.

I had tried both of the above well-known approaches and finally, I have no option other than to check for each and every resource files that can cause this error.

  • Checked Every Resource File: mHBS app is a multi-language support app that has various string resources I had checked each and every string file. The error could also be because of large drawable files if present in the app but our app has no such culprit.

Finally, in the end, I found my culprit that is not actually in our mHBS app. Basically, we are using the dhis2-android-sdk in our app that is used as a submodule and has very large drawable files in its core package and causing this error. Since it is a submodule therefore this can be solved by dhis2 itself.

Find out the Cause of Issue-2

We also had one more issue to solve that we found when we had tried to build the dhis2 app on JDK higher than 8 is ‘NoClassDefFoundError: javax/annotation/Generated’ means dhis2 app is not building with JDK higher than 8. This error can be resolved by adding some dependencies ( Maven Repository: javax.annotation » javax.annotation-api » 1.3.2 (mvnrepository.com) ) to build.gradle. But again these changes should be done on another submodule that the dhis2 app is using i.e. dhis2-rule-engine and can be resolved by dhis2 itself.

Uploaded dummy data on bmgfdev instance of mHBS

We want functionality like that we will be able to upload videos and pdf type resources on the website in the bmgfdev instance and able to fetch it and show it in the trainer app. For now, I had added 6 videos from Webinars (aap.org) and one more test video to the resources of the bmgfdev instance. Check Here

Fetched and shown the Video Resources in media tab

This part is slightly pending due to some problem. I had written down all the HTML code for UI and javaScript code for Api Calls for playing the video media but I am getting some error while hitting the bmgfdev instance API from the browser due to the CORS policy of the browsers. Error is like that -

Access to XMLHttpRequest at ‘https://bmgfdev.soic.iupui.edu/api/document/' from origin ‘http://127.0.0.1:5500' has been blocked by CORS policy: Response to preflight request doesn’t pass access control check: Redirect is not allowed for a preflight request.

I had tested the API and my flow over postman is working fine, as soon as the API get working in the browser all the video files are being loaded in the trainer app. I will try to solve it asap.

Works Done in the Second Week

  1. Find out the cause of the STRING_TOO_LARGE issue.
  2. Find out the cause of incompatibility of dhis2 with JDK higher than 8.
  3. Populated bmgfdev instance with dummy data of videos.
  4. Made a UI to show all the Videos media files in the trainer app.
  5. Fetched Videos in the media tab from bmgfdev instance.

Work to be done in the next week

  1. Fixing the issue of API Calls done from the browser over the bmgfdev instance.
  2. Making a feature in the trainer app to show PDF resources that are uploaded on the bmgfdev instance.
  3. Finding more features that can be added to the video of the media tab.
  4. Solving bugs suggested by mentors.

by noreply@blogger.com (Bhavesh Sharma) at June 18, 2021 06:47 PM

Shivaditya Shivganesh

Google Summer of Code: Week 2

The previous model trained was not performing well on the the testing dataset. So, I had to try a new approach for increasing the model accuracy as well as other parameters. When I tried training with other pre trained networks, after one epoch model started to overfit. So, I had to get creative.

I Used a  BiT model for training, only the last layer was trainable. The model was able to perform better than pervious pre-trained model based on MobileNet.

Regarding the VR Part. The WebXR setup was successful. I was able to set up a basic WebXR environment. TensorflowJs was used for model inference. I used react-framework for binding TensorflowJS and WebXR together. For access to onboard device sensors the WebXR content has to be served through HTTPS.

Model Training Results

MobileNet Based Model: loss: 0.9046 - acc: 0.7174 - f1_m: 0.2450 - precision_m: 301254.4277 - recall_m: 0.2275 - val_loss: 1.0795 - val_acc: 0.6811 - val_f1_m: 0.2366 - val_precision_m: 248592.8750 - val_recall_m: 0.2270

BiT Based Model:loss: 0.6331 - acc: 0.8733 - f1_m: 0.8899 - precision_m: 195757.4552 - recall_m: 0.9773 - val_loss: 1.2562 - val_acc: 0.7955 - val_f1_m: 0.9079 - val_precision_m: 126641.6953 - val_recall_m: 1.0619

Inference Time:

When the SavedModel is converted into TensorflowJS model using the converter few seconds get added up in the inference time. So far, the inference time is not that much and is close if not less than 1 sec.

That's all for day!!

Hope you Had great Week

Ciao

by Shivaditya Shivganesh at June 18, 2021 05:12 PM

Mahavir Singh

Week 2 GSOC 21 LibreHealth

 

Coding Period Week 2 GSOC 2021 LibreHealth-

Hey, Reader's we are in 2nd week of the coding period.

The second week started on 11th June.





What progress have you made this week-

In the second week of the coding period, I have done the following thing with the cost of care flutter application.

1-Added New bookmark feature 

2-add to Bookmark chargemaster.

3-remove to bookmark chargemaster.

4-chargemaster UI modification.

5- added snacbar while adding or removing form bookmark.







    

My plan for next week-

1-I will implement unit tests for inpatient procedures.
2-I will implement unit tests for Outpatient procedures.

During 2nd week I added another commit to the development branch and I updated the Merge request. 

This is all about 2nd week of the coding period. I really enjoyed it.

See you next week.




by noreply@blogger.com (Unknown) at June 18, 2021 10:32 AM

Darshpreet Singh

Coding Period: Week 3 June 19 To June 27

Internationalized Flutter app by adding support for other languages

Created .arb (Application Resource Bundle) file which contains key-value pair strings, I localized all the string text using till now in app. For now I have added translations for 3 languages only

Added metadata of ECEB & on call doctors programs

DHIS2 provides a metadata repository containing metadata packages with various content. A metadata package is a DHIS2-compliant JSON document which describes a set of metadata objects. I exported this metadata for the ECEB & On call doctors program. Users who will use this app will need to import this metadata in their dhis2.

Unit testing for authentication screen

Unit tests are handy for verifying the behavior of a single function, method, or class. I created unit test for the auth functionality.

Test Cases for Hive Storage

  1. User loggedIn return true
  2. Not LoggedIn return false

Flutter BloC test cases

  1. yield AuthenticationLoaded on successful login
  2. yield AuthenticationError on unsuccessful login

Auth Client Test Cases

  1. response code 200 - successful login
  2. response code 401 - unauthorized (wrong credentials)
  3. Socket Exception - no internet connection

Register Baby screen functionality

  • Baby able to get registered using app & their data is stored using api in DHIS2.
  • This feature works offline also, data is synced when user is online next time
  • Created a refresh bloc for state management
  • Added Snackbars for showing info related to syncing
  • stored the list in hive storage

What progress I made this week?

  • Internationalized Flutter app by adding support for other languages
  • Added metadata of ECEB & on call doctors programs
  • Unit testing for authentication screen
  • Register Baby screen functionality (using DHIS2 API)

What do I plan to do next week?

  • Implementing User Profile Screen functionality
  • Baby Health Assessments Capture Functionality
  • Fetching List Of Babies screen in App using API
Internationalized Flutter app by adding support for other languages

June 18, 2021 05:00 AM

Coding Period: Week 2 June 12 To June 18

Creating Login User functionality

  • Used flutter Bloc architecture for state management
  • Used DHIS2 Auth API for authentication
  • username & password is passed as Basic Auth in header in base64 encoding in API
  • Users can now login using username & password in App
  • Added Dark mode support
  • Created config files to store dhis2 apis & id
  • Added password hide/show feature

Screen Shot

Created UI for Baby Assessments

Assessments are divided into multiple phases-

  1. Phase 1 Assessments 0 - 90 minutes from birth

  2. Phase 2 Assessments 60 - 90 minutes after phase 1

  3. Phase 3 Assessments

Categorized in 3 parts

  1. Normal
  2. Problem
  3. Danger

According to the Classification the appropriate assessment will be shown to user

Screen Shots

Added Theme for Dark Mode

Toggle feature is pending but I have enabled support for dark mode

Screen Shots

What progress I made this week?

  • Completed authentication/login functionality
  • Created config files for storing API, DHIS2 Id’s
  • Developed UI of all three Assessments screens
  • Added support for dark mode

What I have planned to do next week?

  • Register Baby screen functionality (using DHIS2 API)
  • Implementing User Profile Screen functionality (using DHIS2 API)
  • Making the above features work also when user is offline and sending data when user is online next time
Creating Login User functionality

June 18, 2021 05:00 AM

June 11, 2021

Bhavesh Shamra

First Week of Coding : 7June -11 June



Hello Guys! The most exciting thing has begun that is the coding phase of GSoC-21. My community bonding period was gone good in discussing things and setting up the environment. This blog contains the work done by me in the First Week of the coding phase.

First of all, I want to share one important point with you :

  1. We had shifted our mHBS-Tracker app to GitLab from Github. Its new link is here.
Merged latest changes of dhis2/dhis2-android-capture-app

Since our repo is very much lagging the new changes of the dhis2 app. The most important task that should be done at the first priority is to merge all the upstream changes. Our repo has approx. 1118 commits whereas in today’s time dhis2 app has approx. 8K commits. Therefore as a first task, I had merged all the upstream changes to our repo in order to work on the dhis2 app.

Modified the dhis2 app to work as mHBS app

After merging the upstream changes we are ready to work on the dhis2 app. Now to use it as a mHBS Tracker app we need to do some modifications to it as per our need. Therefore I had made all those UI changes and App Data changes to make it work as per the needs of the mHBS Tracker App.

List of modifications and other features :

  1. App Name and Logo has been changed.
  2. UI Improvements.
  3. Added External others app of mHBS to app drawer.
  4. Added functionality to open other mHBS apps.

Screenshots of the New mHBS App :


Setup CI/CD Pipeline to automatically build apk/artifact

Without CI/CD it difficult to check whether the particular code will build properly or not and we have to think about a local clone of the project or any other option to get its latest apk. To solve this I had set up the CI/CD Pipeline as well with the MR sent.

Fixed some of the known build errors

There are various build errors that were causing the problem in the successful build of the application I had solved a few of them. But still, there are some issues which need to be resolved but they are not interrupting the apk to build, these are just be reflected when apk is building. You can get a successful build and the latest apk from the code now as well.

Works Done in the First Week 

  1. Merged the upstream changes that have more than 6K unmerged commits.
  2. Modified the final merged code to have features and look like the mHBS app.
  3. Set up CI/CD to automatically build the apk and check for errors.
  4. Fixed Some of the build errors.

Important Links

  1. Merge Request: Having code of all the work done in the first week. It has been merged to the main branch successfully.
  2. Last Triggered CI Pipeline: This pipeline was triggered lastly in the MR.
  3. Last Triggered Job and Artifact Link: Contains all the build log printed while running the ‘assembleDebug’ job. You can download the apk from the right panel of this job page from the ‘Job Artifact’ section.
  4. CI/CD Setup Issue: Link of the CI/CD Setup issue solved with this MR.

Work to be done in the next week 

  1. Solved the build errors of the mHBS Tracker app. There are mainly two problems for the mHBS app :

2. Start working on the mHBS Trainer app for the media section.

3. Check for the complete smooth working of mHBS app and Improvements.


by noreply@blogger.com (Bhavesh Sharma) at June 11, 2021 08:45 PM

Mahavir Singh

Coding Period week 1 GSOC 2021 LibreHealth

Coding Period week 1 GSOC 2021 LibreHealth-

Hey, Reader's we are in 1st week of the coding period.

The coding period started on 8th June. I started working with the Cost of care flutter Application it was really exciting.





What progress have you made this week-

In the first week of the coding period, I have done the following thing with the cost of care flutter application.

1-upgraded project to futter latest version 2.2.1.

2- dart migrate to null safety. 

3-Updated all dependencies that are used in the project to their latest version.

4-Replaced Deprecated Widget.

5-some of the methods were deprecated I updated them too. 

    

My plan for next week-

1-I will implement a bookmark feature to the chargemaster.
2-UI modification of download CDM screen.

During 1st week I sent one  Merge request to the development Branch but I was struggling with pipeline failure. Then I asked my mentors they helped me to fix the pipeline. The pipeline was failing because some of the bloc test methods and Dio library methods were deprecated. 

This is all about 1st week of the coding period.I really enjoyed it.

See you next week.




by noreply@blogger.com (Unknown) at June 11, 2021 05:22 PM

Darshpreet Singh

Coding Period: Week 1 June 07 To June 11

Developing UI of Register Baby Screen

I worked on creating UI of register baby screen, I have used the following packages

  • Flutter Customizable Slider for weight, temperature input (Link)

  • Flutter Date Time Picker to pick baby’s birth date & time (Link)

  • Flutter Bloc Architecture to handle state management (Link)

I have created toggle buttons for baby’s information input such as gender, mode of delivery etc. These toggle buttons uses boolean variable for their state management.

I have created a model class for storing Baby’s health information, This class’s object is created & data is filled when user enter’s data is register baby’s screen.

Creating Navigation Drawer in App

I Added a navigation drawer in app, It has the following items & header with LibreHealth’s Logo.

  • Doctor’s Schedule
  • Messaging
  • About
  • Share App
  • Report Bug

Screen Shots

What progress I made this week?

  • Developed UI of Register Baby Screen
  • Created Sliders for weight, temperature etc.
  • Created Model Class for storing Baby’s Information
  • Created Bloc for register baby screen
  • Created App Drawer with items ( Doctor’s Schedule, Messaging, Share App, Report Bug)

What I have planned to do next week?

  • Developing Assessments Screen UI for all stages
  • Using Sliver App Bar for floating app bars
  • Adding Dark Mode in App
Developing UI of Register Baby Screen

June 11, 2021 05:00 AM

June 10, 2021

Shivaditya Shivganesh

Google Summer of Code: Week 1

This week was all about model building and model validation. Initially, I was stuck a bit on the metric portion, but was later able to overcome it by using special keras libraries. The labyrinthine keras and tensorflow documentation proved to be invaluable.

Model Development

Dataset

The dataset has labelled-images, unlabelled-images, labelled videos and segmented images. For the classification process I am going to use the labelled-images. They have 22 classes labelled in them.

Model

I am training two model, out of which one model will be a custom model and other one will be pre-trained one which is adapted to Kvasir Dataset. A size of 224x224 will be used as the input shape for the model. For data logging purpose i have used tensorboard.

Results

Both the models were trained. The pre-trained model provides low generalisation error in-comparison to the Custom-Model.

CustomModel: loss: 2.4398 - accuracy: 0.7283 - f1_m: 1.1505 - precision_m: 142484.9571 - recall_m: 1.1362 - val_loss: 3.0672 - val_accuracy: 0.0990 - val_f1_m: 0.9958 - val_precision_m: 0.9958 - val_recall_m: 0.9958

PreTrained Model: loss: 0.9046 - acc: 0.7174 - f1_m: 0.2450 - precision_m: 301254.4277 - recall_m: 0.2275 - val_loss: 1.0795 - val_acc: 0.6811 - val_f1_m: 0.2366 - val_precision_m: 248592.8750 - val_recall_m: 0.2270

Virtual Reality

For handling virtual reality portion of the project I am going to use WebXR. This doe not require installation of application on the phone. It supports various platforms like oculus and android

Model Architecture

alt

That's all for today. Meet y'all later

So long

Tl;dr: Model dev cycle complete

References

MobileNetV2

WebXR

CustomModel

PreTrained

by Shivaditya Shivganesh at June 10, 2021 06:21 PM

June 08, 2021

Mahavir Singh

Community Bonding Period 1- 7 June

 Community Bonding Period -

Community Bonding Period June 1 to June  7 June -


The community bonding period is about to end and the coding period starting from today. During this week I revised my Web development notes and refresh some important concepts of HTML, CSS, and JAVA Script.



What progress I made this week?

New Learning -

In this week I  Learn  Bootstrap.Bootstrap is a free and open-source CSS framework directed at responsive, mobile-first front-end web development. It contains CSS- and JavaScript-based design templates for typography, forms, buttons, navigation, and other interface components.
I will discuss to the mentors about using bootstrap in our web app.

What I have planned to do next week?-

The coding period is starting from today and I am very excited about the coding period. For this week I have planned the following task.
1- I will migrate the existing futter to null sefty.
2-I will fix deprecated libraries and update them.
3- GPS is not migrated to null safety I will fork it and use it directly from GitHub after updating it to null safety.

Thank you for reading.











 

by noreply@blogger.com (Unknown) at June 08, 2021 12:45 PM

June 06, 2021

Darshpreet Singh

Community Bonding Period June 1 to June 6

Community Bonding Period June 1 to June 6

Coding period is about to begin tomorrow & I have done preparations to start coding, During this week I had completely set up DHIS2 with program rules/Stages

Few thing I want to Discuss

Baby Classification Logic

Earlier I thought to do Classification in app only , but now I learned about program rules which run automatically and can classify baby easily, Moreover these rules are very much configurable so users can configure these according to their requirements

Currently I used ECEB Action plan to classify Baby’s health in 3 categories - Normal/Problem/Danger

Example of Classification Logic For Danger

#{ECEB_Severe_Jaundice} || #{ECEB_Assess_Temperature}<= 35.5 || #{ECEB_Assess_Temperature} >= 37.5 || #{ECEB_Weight} < 1500 || #{ECEB_Chest_Indrawing} ||#{ECEB_Not_Feeding} || #{ECEB_Fast_Breathing} || #{ECEB_Convulsions}

If any of the above condition is true then the health is in danger.

The program rule has an acion - It classifies health by filling data element ECEB_Classification after evaluating the above expressions.

Creating an Initial Screen to fetch all data elements/program ids from dhis2

For doing API call related to a program/event we need its unique id beforehand, As these ids are not constant on every DHIS2 , I need to first design a screen which fetches all the variables/Stage/Programs ID from the dhis2. Then the user will be able to use the app.

On Call Doctor’s Program

This is an Event Program, Doctor’s schedule is added as an event with data elements name, date, start time, end time, Doctor’s Image.

What progress I made this week?

  • Created program rules for Normal/Problem/Danger
  • Created On Call Doctor’s Program
  • Created Stage 4 & Stage 5 in DHIS2 & modified previous stages according to ECEB action plan

What I have planned to do next week?

  • Developing Register baby screen UI
  • Developing Assessments Screen UI of App
  • Adding Dark Mode in App
  • Adding navigation drawer in app with menus ( Doctor’s Schedule, Messaging, Share App, Report Bug)
Community Bonding Period June 1 to June 6

June 06, 2021 05:00 AM

June 01, 2021

Bhavesh Shamra

Community Bonding at LibreHealth

 Hello everyone, I am glad to share that my project proposal was accepted by LibreHealth in GSoC-21 and I am going to spend my summer working with LibreHealth Community on the Project: Scaling up the mobileHBS/DHIS2 Tracker and Trainer applications — Projects / mHBS — LibreHealth Forums.

I am writing this blog to share my community bonding phase with LibreHealth. It was scheduled from 17th May to 7th June and the coding period will begin in about 10 days.

Project Description

The mobile Helping Babies Survive powered by DHIS2 (mHBS/DHIS2) Tracker (Java) and Trainer (HTML; JavaScript) applications, built within the DHIS2 Mobile platform, are designed to provide educational and training support for maternal and neonatal care among health care providers in low/middle-income countries. We help nurses and physicians in sub-Saharan Africa, Asia, and Latin America deliver evidence-based interventions that save maternal and newborn lives.

In various low/middle-income countries children die at a very low age just in few days after their birth due to the inadequate supply of facilities that they require. The important fact is that all of these deaths are PREVENTABLE and can be prevented by providing proper knowledge to the mother’s of the babies as well as to other person and by providing a proper tracker facility to track the health status of the baby in the early days of his birth.

mHBS (mobile Helping Babies Survive) solve these issues. There are 4 mobile applications, in various stages of design, development, evaluation, and deployment, within the award-winning mHBS/DHIS2 suite of digital tools.

  1. mHBS/DHIS2 Tracker (work: data collection)
  2. mHBS/DHIS2 Trainer (work: educational and training materials)
  3. Essential Care for Every Baby Digital Action Plan (work: clinical decision support)
  4. NeoRoo (work: data collection, education, and automated monitoring of neonatal vital signs among babies utilizing the NeoSMART biomedical device)

I will be working on the scale-up of the already existing mHBS/DHIS2 Tracker and Trainer app so that they can be published on the Play Store.

Community Bonding Period

I had used the last days of my community bonding period to set up the project and in getting familiar with its code base and most of the time I did one thing that was getting more idea of the project i.e. Research… Research… Research… and getting familiar with technologies that are going to be used in the coding phase to write a structured code.

We are going to use the dhis2 app codebase for our mHBS Tracker app to collect data from the users and mHBS Trainer app is not a java or android project it is written in HTML, CSS & JavaScript and we are using Cordova for running it on Android Platform.

  1. Read articles, documentation related to the project.
  2. Learned how to use Cordova for running it’s project on Android.
  3. Set up the codebase and ready to code.
  4. Learned a lot about the technologies and codebase.

Important Links

  1. Talk thread: Proceeding With GSoC
  2. Trainer App: GitHub Repo
  3. Tracker App: GitHub Repo

Conclusion

It was very great to start with the LibreHealth community.

This week onwards, I will be posting regular weekly blog posts on the updates on further progress on this project here. Thanks for reading! 🙂

by noreply@blogger.com (Bhavesh Sharma) at June 01, 2021 08:32 AM

Darshpreet Singh

Community Bonding Period May 18 to 1 June

Community Bonding Period May 18 to 1 June

Hello Everyone,

I am very happy to start my Google Summer of Code journey with LibreHealth, I will be working on Mobile App Development Project, I am very much Thankful to LibreHealth & Google for selecting me again. I have also successfully completed GSoC previous year & have worked on Cost of Care project of LibreHealth.

About Project

To develop an Android & IOS application to provide clinical decision-support for nurses and doctors delivering essential newborn care interventions during the first day of life. This application provides knowledge, skills, and competencies to nurses and doctors in low/middle-income settings so that they can provide life-saving care to newborns from birth through 24 hours postnatal. App uses DHIS2 as backend & can be setup for any hospital/organization

The Goals of this project are

  • Ability to track multiple babies at a time;
  • Time-stamping births to generate an essential newborn care clock for each baby being tracked in the app;
  • Automated classification of babies health status, based on results from observations and assessments that are conducted during the first 2 hours after birth;
  • Automated advice on management of babies, based on their classification; Reminders/alerts to provide recommended essential newborn care interventions;
  • If particular interventions are not delivered on time, or at all, capture of information regarding why this essential newborn care was late, or missed

About Community Bonding Period

  • Community Bonding Period in which you get to know your community and get familiar with their code base and work style.

  • Ask for resources, required by you, to gain your knowledge for the parts of your project you don’t know.

  • Discuss and plan your GSoC work with your mentor.

  • Discuss and plan your time-table for your summer.

My Progress

  • During the community bonding I have introduced myself to mentors & mentors are very much welcoming.
  • I recieved access to DHIS2 for the application development, I have discussed with them about creating Programs, Stages, Attributes in DHIS2.
  • I read the documentation of DHIS2 Tracker API, Creating Program/Stages.
  • I have created a program for On-Call-Doctors & I have to discuss it with mentors.
  • I resolved my doubts related to modifying the already created program in DHIS2.

Tasks For Next Week

  • Completely setting up DHIS2 with all Programs/Stages/Attributes
  • Finalising weekly tasks & creating milestones
  • Reading Documentation
  • Discussing & showing mentors the programs I will modify in DHIS2
Community Bonding Period May 18 to 1 June

June 01, 2021 05:00 AM

Mahavir Singh

Community Bonding Period LibreHealth GSOC 2021

Community-bonding-


Hi, This is Mahavir. This is the very first blog that I am writing during the community bonding period.Today is 31 May and it’s been 13 days since the GSOC result was announced. So let’s have a look at how I spent the community bonding period till now.

My Project-


Improve LibreHealth Toolkit Cost of Care Explorer.





Currently, This project working on the flutter 1.22.6 version, and my first task to upgrade this project to flutter the latest version and null safety. Till now I did some research about flutter's latest version and read about the latest version of dependencies that are used in this project. During this research, I found that GPS dependency is not updated to null safety this was a blockage to upgrade this project.

I discussed this issue with my mentor and muarachmann upgraded this package to null safety.


Conclusion-

Stay tuned for the next blog.

Happy coding.



by noreply@blogger.com (Unknown) at June 01, 2021 03:32 AM

May 31, 2021

Shivaditya Shivganesh

Community Bonding Period LibreHealth GSoC 2021

Hi My Name is Shivaditya Shivganesh, This is first blog post with regards to Google Summer of Code commonly known as GSoC for the year 2021.

I have been selected for the project Project: Neural network-based object detection of anatomical structures and medical artifacts in Virtual Reality

At present we are in the community bonding phase. Which last for about 15 days the actual coding portion of GSoC starts from 7th of June.

I have started to work on Neural Network model that would be required for the project.

About the Project

In this project we are trying to create a Neural Network model that can. classify the respective classes in the Kvasir dataset and display it in an appropriate VR Display.

The Hyper-Kvasir dataset consists of  images which can be classified into 23 classes.

Conclusion

This blogpost was just for the  community bonding purposes. In the forthcoming weeks I plan to write posts regularly about my progress and the challenges I faced.

Until next time

by Shivaditya Shivganesh at May 31, 2021 05:59 PM

May 30, 2021

Shashwat

community-bonding

LibreHealth (@LibreHealthIO) | Twitter


Hello !

Its been quite a while since the GSoC results were announced and community bonding period commenced. The calendar says May 30 and the coding period will begin in about 10 days. So lets move on to how I actually spent the community bonding period yet and what plans do I have for the coming days before the coding period starts.

Project Introduction

The project bases its goal on creating an EHR system using the webcomponents implementing FHIR resources developed during the previous versions of GSoC. For the implementation some new resource based components will be required as well which will be created simultaneously.

During GSoC 2018, under this project a polymer application was developed which combined all the web component0s (developed at that time) into a PWA.

The current project will be built upon this application by adding and implementing workflows. the workflows that will be implemented in the EHR are :

  • Check-in
  • Visit
  • e-Prescription
  • Appointment
  • Lab orders

Amazing Mentor Team

  1. Saptarshi Purkayastha
  2. Namratanehete

Community Bonding Period

Background

During the application period upon the suggestions of the mentors I had decided to mainly work on the CI and the Designs of the PWA during the community bonding period.

Even before the results were announced I was already experimenting with setting up the project so as to identify any problems that may occur as using lit-components inside React can be a little trouble because React never exposes the real DOM.

Bonding Period

So as soon as the results were released I started looking on these parts. I started with the CI part first, one of the pointers in this was also to look for a cross platform - cross browser testing method (SauceLabs) suggested by my mentor. I looked at some of the possibe integrations with these automation tools here.

But most of these are based on e2e testing ( cypress , Puppeteer and others ) and our main focus is on unit and integration testing which will require the react component to be mounted and tested , for which many tools are available but I could not find their integration with sauce or any cross browser-cross platform tool. Once I figure out a way for this issue the CI part will hardly take any time !


the design part:

I have designed one workflow ( check-in ) and will complete the remaining in the coming 2-3 days ! adding to these I will document the endpoints that will be used in each steps in the designed workflows. The endpoints of the check-in workflow is provided below.

here is the video of the designed check-in workflow:

check-in.mp4 from Shashwat on Vimeo.


CHECK-IN WORKFLOW :
SEARCH PARAMS :

GET [base]/Patient?identifier=[value]

GET [base]/Patient?name=[value]

CREATE PATIENT :

POST [base]/Patient

GET PATIENT :

GET [base]/Patient/[_id]

Conclusion

This week’s blog was not too long as I have not written any code, but hoping to deliver some interesting content in the upcoming weeks! I will be posting a blog every week highlighting the things I completed during the week and the things that I plan to achieve.

See you next week 😄

LibreHealth (@LibreHealthIO) | Twitter

May 30, 2021 05:18 PM

April 16, 2021

Mahavir Singh

Defanging an IP Address leetcode solution

 Defanging an IP Address-

Problem Statement-

Given a valid (IPv4) IP address, return a defanged version of that IP address.

defanged IP address replaces every period "." with "[.]".

 

Example 1:

Input: address = "1.1.1.1"
Output: "1[.]1[.]1[.]1"

Example 2:

Input: address = "255.100.50.0"
Output: "255[.]100[.]50[.]0"

 

Constraints:

  • The given address is a valid IPv4 address.

  • Defanging an IP Address leetcode solution

code-



by noreply@blogger.com (Unknown) at April 16, 2021 03:48 PM

February 27, 2021

Mahavir Singh

How to append char to end of string in C++ || Best way to append char to end of string

 How to append char to end of string in C++ || Best way to append char to end of string-

There are 2 ways mention below to append char to the end of string in c++.
But do you know which one is the best way? 
Let's see

Method -1 

+= operator

we can use += use to append char at the end of the string but by using this method it makes a copy of the initial string and take O(length of the string ) time to make a copy of a string.
How to append char to end of string in C++ || Best way to append char to end of string



Method 2-

Push back method by using this method we do not create any copy of original string we only put char to the and of the string so the time complexity of this function is o(1). Obviously, push back is a better method to append char at the end of the string.





by noreply@blogger.com (Unknown) at February 27, 2021 06:32 AM

February 15, 2021

Mahavir Singh

Prime Game February long challenge 2021 solution with code and explanation

 Prime Game February long challenge 2021 solution with code and explanation  -

Problem statement -

Prime Game February long challenge 2021 solution with code and explanation


Chef and Divyam are playing a game with the following rules:

  • First, an integer X!X! is written on a board.
  • Chef and Divyam alternate turns; Chef plays first.
  • In each move, the current player should choose a positive integer DD which is divisible by up to YY distinct primes and does not exceed the integer currently written on the board. Note that 11 is not a prime.
  • DD is then subtracted from the integer on the board, i.e. if the integer written on the board before this move was AA, it is erased and replaced by ADA−D.
  • When one player writes 00 on the board, the game ends and this player wins.

Given XX and YY, determine the winner of the game.

Input

  • The first line of the input contains a single integer TT denoting the number of test cases. The description of TT test cases follows.
  • The first and only line of each test case contains two space-separated integers XX and YY.

Output

For each test case, print a single line containing the string "Chef" if Chef wins the game or "Divyam" if Divyam wins (without quotes).

Constraints

  • 1T1061≤T≤106
  • 1X,Y1061≤X,Y≤106

Subtasks

Subtask #1 (5 points): Y=1Y=1

Subtask #2 (10 points):

  • 1T1021≤T≤102
  • 1X61≤X≤6

Subtask #3 (85 points): original constraints

Example Input

3
1 2
3 1
2021 42

Example Output

Chef
Divyam
Divyam

Explanation

Example case 1: Since D=1D=1 is divisible by 00 primes, Chef will write 00 and win the game in the first move.

Example case 2: Chef must choose DD between 11 and 55 inclusive since D=6D=6 is divisible by more than one prime. Then, Divyam can always choose 6D6−D, write 00 on the board and win the game.

Solution-

Hint-

Do not try to calculate x! .learn sieve of Eratosthenes this problem is related to this topic.

solution will be posted anytime soon.



by noreply@blogger.com (Unknown) at February 15, 2021 02:36 PM

Team Name codechef February 2021 long challenge editorial Full solution with code

 Team Name codechef  February 2021  long challenge editorial Full solution with code-


Problem Statement-

Team Name codechef  February 2021  long challenge editorial Full solution with code


Сhef has assembled a football team! Now he needs to choose a name for his team. There are NN words in English that Chef considers funny. These words are s1,s2,,sNs1,s2,…,sN.

Chef thinks that a good team name should consist of two words such that they are not funny, but if we swap the first letters in them, the resulting words are funny. Note that under the given constraints, this means that a word is a non-empty string containing only lowercase English letters.

Can you tell Chef how many good team names there are?

Input

  • The first line of the input contains a single integer TT denoting the number of test cases. The description of TT test cases follows.
  • The first line of each test case contains a single integer NN.
  • The second line contains NN space-separated strings s1,s2,,sNs1,s2,…,sN.

Output

For each test case, print a single line containing one integer — the number of ways to choose a good team name.

Constraints

  • 1T1001≤T≤100
  • 2N21042≤N≤2⋅104
  • 2|si|202≤|si|≤20 for each valid ii
  • s1,s2,,sNs1,s2,…,sN contain only lowercase English letters
  • s1,s2,,sNs1,s2,…,sN are pairwise distinct
  • the sum of NN over all test cases does not exceed 21042⋅104

Subtasks

Subtask #1 (20 points): s1,s2,,sNs1,s2,…,sN contain only letters 'a' and 'b'

Subtask #2 (80 points): original constraints

Example Input

3
2
suf mas
3
good game guys
4
hell bell best test

Example Output

2
0
2

Explanation

Example case 1: The good team names are ("muf", "sas") and ("sas", "muf").

Example case 2: There are no good team names because all funny words start with 'g'.

Example case 3: The good team names are ("hest", "tell") and ("tell", "hest").


Solution-

Hint- 

make a map of string and vector and insert key as rest of string except head and value as head of the string.

Solution will be posted anytime soon stay connected in telegram for update-
Must join Telegram channel -https://t.me/competitiveProgrammingDiscussion 

by noreply@blogger.com (Unknown) at February 15, 2021 02:34 PM

Frog Sort codechef February 2021 long challenge editorial

 

 Frog Sort codechef February 2021  long challenge editorial -

There are NN frogs (numbered 11 through NN) in a line. For each valid ii, the ii-th frog is initially at the position ii, it has weight WiWi, and whenever you hit its back, it jumps a distance LiLi to the right, i.e. its position increases by LiLi. The weights of the frogs are pairwise distinct.

You can hit the back of each frog any number of times (possibly zero, not necessarily the same for all frogs) in any order. The frogs do not intefere with each other, so there can be any number of frogs at the same time at each position.

Your task is to sort the frogs in the increasing order of weight using the smallest possible number of hits. In other words, after all the hits are performed, then for each pair of frogs (i,j)(i,j) such that Wi<WjWi<Wj, the position of the ii-th frog should be strictly smaller than the position of the jj-th frog. Find the smallest number of hits needed to achieve such a state.

Input

  • The first line of the input contains a single integer TT denoting the number of test cases. The description of TT test cases follows.
  • The first line of each test case contains a single integer NN.
  • The second line contains NN space-separated integers W1,W2,,WNW1,W2,…,WN.
  • The third line contains NN space-separated integers L1,L2,,LNL1,L2,…,LN.

Output

For each test case, print a single line containing one integer ― the smallest number of times you need to hit the backs of the frogs.

Constraints

  • 1T21041≤T≤2⋅104
  • 2N42≤N≤4
  • 1WiN1≤Wi≤N for each valid ii
  • 1Li51≤Li≤5 for each valid ii
  • no two frogs have the same weight

Subtasks

Subtask #1 (50 points):

  • T=50T=50
  • N=2N=2

Subtask #2 (50 points): original constraints

Example Input

3
3
3 1 2
1 4 5
3
3 2 1
1 1 1
4
2 1 4 3
4 1 2 4

Example Output

3
6
5

Explanation

Example case 1: We can hit the back of the first frog three times.

Example case 2: We can hit the back of the first frog four times, then hit the back of the second frog two times.


Problem Statement- 


Solution-

Hint - fix the minimum weight element and arrange the rest of elements.

Solution will be posted anytime soon stay connect .

Must join Telegram channel -https://t.me/competitiveProgrammingDiscussion





by noreply@blogger.com (Unknown) at February 15, 2021 02:33 PM

Maximise Function codechef February 2021 long challenge editorial

 Maximize Function codechef February 2021  long challenge editorial -


Problem Statement- 

You are given a sequence A1,A2,,ANA1,A2,…,AN. Find the maximum value of the expression |AxAy|+|AyAz|+|AzAx||Ax−Ay|+|Ay−Az|+|Az−Ax| over all triples of pairwise distinct valid indices (x,y,z)(x,y,z).

Input

  • The first line of the input contains a single integer TT denoting the number of test cases. The description of TT test cases follows.
  • The first line of each test case contains a single integer NN.
  • The second line contains NN space-separated integers A1,A2,,ANA1,A2,…,AN.

Output

For each test case, print a single line containing one integer ― the maximum value of |AxAy|+|AyAz|+|AzAx||Ax−Ay|+|Ay−Az|+|Az−Ax|.

Constraints

  • 1T51≤T≤5
  • 3N1053≤N≤105
  • |Ai|109|Ai|≤109 for each valid ii

Subtasks

Subtask #1 (30 points): N500N≤500

Subtask #2 (70 points): original constraints

Example Input

3
3
2 7 5
3
3 3 3
5
2 2 2 2 5

Example Output

10
0
6

Explanation

Example case 1: The value of the expression is always 1010. For example, let x=1x=1y=2y=2 and z=3z=3, then it is |27|+|75|+|52|=5+2+3=10|2−7|+|7−5|+|5−2|=5+2+3=10.

Example case 2: Since all values in the sequence are the same, the value of the expression is always 00.

Example case 3: One optimal solution is x=1x=1y=2y=2 and z=5z=5, which gives |22|+|25|+|52|=0+3+3=6|2−2|+|2−5|+|5−2|=0+3+3=6.

Solution-

Hint - Sort the array.

Solution will be posted anytime soon stay connect .

Must join Telegram channel -https://t.me/competitiveProgrammingDiscussion





by noreply@blogger.com (Unknown) at February 15, 2021 02:31 PM

February 09, 2021

Mahavir Singh

Codechef February long challenge solution 2021

  

Codechef February  long challenge solution 2021-

Hey guys Welcome Again, A small update CodeChef February  long challenge solution 2021 starting from 1st week of beb  2021 . Codechef long challenge is one of the popular contests of CodeChef you should participate in codechef Feb  long challenge.This is first contest of codechef in 2021 so good luck.
And wish you happy new year.




I will post the solution after Contest.Stay tuned.

About CodeChef  February  long challenge solution 2021:

CodeChef Long Challenge is a 10-day monthly coding contest where you can show off your computer programming skills. The significance being - it gives you enough time to think about a problem, try different ways of attacking the problem, read the concepts etc. If you’re usually slow at solving problems and have ample time at hand, this is ideal for you. We also put in a lot of efforts in getting quality problems, which would, in turn, foster your learning while solving them.

Solution -

1-Maximise Function codechef February 2021 long challenge editorial

2-Frog Sort codechef February 2021 long challenge editorial

3-Team Name codechef February 2021 long challenge editorial Full solution with code

4-Prime Game February long challenge 2021 solution with code and explanation

Previous Contest Editorial-

1-Chef and Division 3 Codechef january challenge solution || Chef and Division 3 Codechef january challenge Editorial 2021

2-Encoded String codechef January long challenge solution || Encoded String codechef January long challenge solution Editorial 2021

3-Fair Elections Codechef January long challenge 2021 solution || Fair Elections Codechef January 2021 Editorial 

4-Point Of Impact Codechef January 2021 solution || Point Of Impact codechef january 2021 editorial 

5-Watching CPL Codechef January 2021 solution || Watching CPL codechef problem editorial 2021

Past contest Editorial- CodeChef Long challenge editorial | codechef long challenge solutions

CodeChef October Lunchtime Problem Solution | codechef Lunctime Problem solution 

Join Telegram channel for code And editorial  - https://t.me/competitiveProgrammingDiscussion

by noreply@blogger.com (Unknown) at February 09, 2021 05:58 AM

January 25, 2021

Mahavir Singh

0-1 Knapsack Problem | DP-10 Solution Recursive memoization and Tabulation Full Explanation

 Problem Statement-

You are given weights and values of N items, put these items in a knapsack of capacity W to get the maximum total value in the knapsack. Note that we have only one quantity of each item.
In other words, given two integer arrays val[0..N-1] and wt[0..N-1] which represent values and weights associated with N items respectively. Also given an integer W which represents knapsack capacity, find out the maximum value subset of val[] such that sum of the weights of this subset is smaller than or equal to W. You cannot break an item, either pick the complete item, or don’t pick it (0-1 property).

Example 1:

Input:
N = 3
W = 4
values[] = {1,2,3}
weight[] = {4,5,1}
Output: 3

Example 2:

Input:
N = 3
W = 3
values[] = {1,2,3}
weight[] = {4,5,6}
Output: 0

Your Task:
Complete the function knapSack() which takes maximum capacity W, weight array wt[], value array val[] and number of items n as a parameter and returns the maximum possible value you can get.

Expected Time Complexity: O(N*W).
Expected Auxiliary Space: O(N*W)

Constraints:
1 ≤ N ≤ 1000
1 ≤ W ≤ 1000
1 ≤ wt[i] ≤ 1000
1 ≤ v[i] ≤ 1000


Solution -


by noreply@blogger.com (Unknown) at January 25, 2021 10:47 AM

January 13, 2021

Mahavir Singh

Fair Elections Codechef January long challenge 2021 solution || Fair Elections Codechef January 2021 Editorial

 Fair Elections Codechef January long challenge  2021 solution || Fair Elections Codechef January 2021 Editorial -


Problem Statement-

Elections are coming soon. This year, two candidates passed to the final stage. One candidate is John Jackson and his opponent is Jack Johnson.

During the elections, everyone can vote for their favourite candidate, but no one can vote for both candidates. Then, packs of votes which went to the same candidate are formed. You know that for John Jackson, there are NN packs containing A1,A2,,ANA1,A2,…,AN votes, and for Jack Johnson, there are MM packs containing B1,B2,,BMB1,B2,…,BM votes.

The winner is the candidate that has strictly more votes than the other candidate; if both have the same number of votes, there is no winner. You are a friend of John Jackson and you want to help him win. To do that, you may perform the following operation any number of times (including zero): choose two packs of votes that currently belong to different candidates and swap them, i.e. change the votes in each of these packs so that they would go to the other candidate.

You are very careful, so you want to perform as few swaps as possible. Find the smallest number of operations you need to perform or determine that it is impossible to make John Jackson win.

Input

  • The first line of the input contains a single integer TT denoting the number of test cases. The description of TT test cases follows.
  • The first line of each test case contains two space-separated integers NN and MM.
  • The second line contains NN space-separated integers A1,A2,,ANA1,A2,…,AN.
  • The third line contains MM space-separated integers B1,B2,,BMB1,B2,…,BM.

Output

For each test case, print a single line containing one integer ― the smallest number of swaps needed to make John Jackson win, or 1−1 if it is impossible.

Constraints

  • 1T1031≤T≤103
  • 1N,M1031≤N,M≤103
  • 1Ai1061≤Ai≤106 for each valid ii
  • 1Bi1061≤Bi≤106 for each valid ii
  • the sum of NN over all test cases does not exceed 104104
  • the sum of MM over all test cases does not exceed 104104

Subtasks

Subtask #1 (20 points):

  • A1=A2==ANA1=A2=…=AN
  • B1=B2==BMB1=B2=…=BM

Subtask #2 (80 points): original constraints

Example Input

2
2 3
2 2
5 5 5
4 3
1 3 2 4
6 7 8

Example Output

2
1

Explanation

Example case 1: We can perform two swaps ― each time, we swap a pack of 22 votes from AA and a pack of 55 votes from BB. After that, John Jackson gets 5+5=105+5=10 votes and Jack Johnson gets 2+2+5=92+2+5=9 votes.

Example case 2: We can swap the pack of 11 vote from AA and the pack of 88 votes from BB. After that, John Jackson gets 8+3+2+4=178+3+2+4=17 votes and Jack Johnson gets 6+7+1=146+7+1=14 votes.

Fair Elections Codechef January long challenge  2021 solution || Fair Elections Codechef January 2021 Editorial


Solution-

This problem can be solved using brute force approach first we sort both array and we will iterate second array from last and first array form first till we get sum1>sum2  .
after swapping if sum1<sum2 print -1
sum1>sum2 print count of swaping 
else print 0
her is my code follow code below.
Join telegram channel for code and editorial.-https://t.me/competitiveProgrammingDiscussion



by noreply@blogger.com (Unknown) at January 13, 2021 05:53 AM

Encoded String codechef January long challenge solution || Encoded String codechef January long challenge solution Editorial 2021

 Encoded String codechef January long challenge solution || Encoded String codechef January long challenge solution Editorial 2021-

Problem statement-

An encoder encodes the first 1616 lowercase English letters using 44 bits each. The first bit (from the left) of the code is 00 if the letter lies among the first 88 letters, else it is 11, signifying that it lies among the last 88 letters. The second bit of the code is 00 if the letter lies among the first 44 letters of those 88 letters found in the previous step, else it's 11, signifying that it lies among the last 44 letters of those 88 letters. Similarly, the third and the fourth bit each signify the half in which the letter lies.

For example, the letter jj would be encoded as :

  • Among (a,b,c,d,e,f,g,h(a,b,c,d,e,f,g,h || i,j,k,l,m,n,o,p)i,j,k,l,m,n,o,p)jj appears in the second half. So the first bit of its encoding is 11.
  • Now, among (i,j,k,l(i,j,k,l || m,n,o,p)m,n,o,p)jj appears in the first half. So the second bit of its encoding is 00.
  • Now, among (i,j(i,j || k,l)k,l)jj appears in the first half. So the third bit of its encoding is 00.
  • Now, among (i(i || j)j)jj appears in the second half. So the fourth and last bit of its encoding is 11.

So jj's encoding is 10011001,

Given a binary encoded string SS, of length at most 105105, decode the string. That is, the first 4 bits are the encoding of the first letter of the secret message, the next 4 bits encode the second letter, and so on. It is guaranteed that the string's length is a multiple of 4.

Input:

  • The first line of the input contains an integer TT, denoting the number of test cases.
  • The first line of each test case contains an integer NN, the length of the encoded string.
  • The second line of each test case contains the encoded string SS.

Output:

For each test case, print the decoded string, in a separate line.

Constraints

  • 1T101≤T≤10
  • 4N1054≤N≤105
  • The length of the encoded string is a multiple of 44.
  • 0Si10≤Si≤1

Subtasks

  • 100100 points : Original constraints.

Sample Input:

3
4
0000
8
00001111
4
1001

Sample Output:

a
ap
j

Explanation:

  • Sample Case 11 :

The first bit is 00, so the letter lies among the first 88 letters, i.e., among a,b,c,d,e,f,g,ha,b,c,d,e,f,g,h. The second bit is 00, so it lies among the first four of these, i.e., among a,b,c,da,b,c,d.

The third bit is 00, so it again lies in the first half, i.e., it's either aa or bb. Finally, the fourth bit is also 00, so we know that the letter is aa.

  • Sample Case 22 :

Each four bits correspond to a character. Just like in sample case 1100000000 is equivalent to aa. Similarly, 11111111 is equivalent to pp. So, the decoded string is apap.

  • Sample Case 33 :

The first bit is 11, so the letter lies among the last 88 letters, i.e., among i,j,k,l,m,n,o,pi,j,k,l,m,n,o,p. The second bit is 00, so it lies among the first four of these, i.e., among i,j,k,li,j,k,l.

The third bit is 00, so it again lies in the first half, i.e., it's either ii or jj. Finally, the fourth bit is 11, so we know that the letter is jj.

Encoded String codechef January long challenge solution || Encoded String codechef January long challenge solution Editorial 2021


Solution-

THis question is based on pattern finding question. You have to find a simple pattern  that 

if(s=="0000"){
return 'a';
}
if(s=="0001"){
return 'b';
}
if(s=="0010"){
return 'c';
}
if(s=="0011"){
return 'd';
}
if(s=="0100"){
return 'e';
}
if(s=="0101"){
return 'f';
}
if(s=="0110"){
return 'g';
}
if(s=="0111"){
return 'h';
}
if(s=="1000"){
return 'i';
}
if(s=="1001"){
return 'j';
}
if(s=="1010"){
return 'k';
}
if(s=="1011"){
return 'l';
}
if(s=="1100"){
return 'm';
}
if(s=="1101"){
return 'n';
}
if(s=="1110"){
return 'o';
}
if(s=="1111"){
return 'p';
} Now you have to iterate over string in set of 4 character. finally print ans. follow my code
Join telegram channel for code and editorial.-https://t.me/competitiveProgrammingDiscussion



by noreply@blogger.com (Unknown) at January 13, 2021 03:39 AM

Point Of Impact Codechef January 2021 solution || Point Of Impact codechef january 2021 editorial

 Point Of Impact Codechef January 2021 solution || Point Of Impact codechef january 2021 editorial -

Problem statement-

You are playing a Billiards-like game on an N×NN×N table, which has its four corners at the points {(0,0),(0,N),(N,0),{(0,0),(0,N),(N,0), and (N,N)}(N,N)}. You start from a coordinate (x,y)(x,y)(0<x<N,0<y<N)(0<x<N,0<y<N) and shoot the ball at an angle 4545∘ with the horizontal. On hitting the sides, the ball continues to move with the same velocity and ensuring that the angle of incidence is equal to the angle of reflection with the normal, i.e, it is reflected with zero frictional loss. On hitting either of the four corners, the ball stops there and doesn’t move any further.

Find the coordinates of the point of collision, when the ball hits the sides for the KthKth time. If the ball stops before hitting the sides KK times, find the coordinates of the corner point where the ball stopped instead.

Input:

  • The first line of the input contains an integer TT, the number of testcases.
  • Each testcase contains a single line of input, which has four space separated integers - NNKKxxyy, denoting the size of the board, the number of collisions to report the answer for, and the starting coordinates.

Output:

For each testcase, print the coordinates of the ball when it hits the sides for the KthKth time, or the coordinates of the corner point if it stopped earlier.

Constraints

  • 1T1051≤T≤105
  • 2N1092≤N≤109
  • 1K1091≤K≤109

Subtasks

  • 3030 points : Sum of KK over all test cases 107≤107
  • 7070 points : Original constraints.

Sample Input:

2
5 5 4 4
5 2 3 1

Sample Output:

5 5
3 5

Explanation:

  • Sample Case 11 :

We are given a 55 by 55 board. We shoot the ball from coordinates (4,4)(4,4), and we need to find its coordinates after it has collided with sides 55 times. However, after shooting, the ball goes directly to the corner (5,5)(5,5), and stops there. So we report the coordinates (5,5)(5,5).

fig1

  • Sample Case 22 :

We are given a 55 by 55 board. We shoot the ball from the coordinates (3,1)(3,1), and we need to find its coordinates after it has collided with the sides twice. After shooting, it first hits the right side at (5,3)(5,3), and then the top side at (3,5)(3,5). So, we report (3,5)(3,5).

fig1

Solution -

Actually this is a simple problem you need little bit of maths knowledge to solve this problem.
You have to find 4 points on where the ball is striking. the fact is that the ball can strike a maximum of 4 different point and after first 4 point  point of impact will start repeating.

You need to find 4 points of impact and ball direction(clockwise / anticlockwise) .ans differ according to ball direction.
Here is my code. look it and check how i implemented this logic.


Join telegram channel for code and editorial.-https://t.me/competitiveProgrammingDiscussion

by noreply@blogger.com (Unknown) at January 13, 2021 03:34 AM

Watching CPL Codechef January 2021 solution || Watching CPL codechef problem editorial 2021

 Watching CPL Codechef January 2021 solution || Watching CPL codechef problem editorial 2021-

Problem statement-

Get excited, folks, because it is time for the final match of Codechef Premier League (CPL)!

Mike and Tracy also want to watch the grand finale, but unfortunately, they could not get tickets to the match. However, Mike is not someone who gives up so easily — he has a plan to watch the match.

The field where the match is played is surrounded by a wall with height KK. Outside, there are NN boxes (numbered 1 1 through NN). For each valid ii, the ii-th box has a height HiHi.

Mike wants to take some boxes and stack them on top of each other to build two towers. The height of each tower is the sum of heights of all the boxes that form it. Of course, no box may be in both towers. The height of each tower should be at least KK. Then Mike can climb on top of one tower and Tracy on top of the other, and they can watch the match uninterrupted!

While Mike is busy stacking the boxes, Tracy would like to know the smallest number of boxes required to build two towers such that each of them has height at least KK, or at least that it is impossible to build such towers. Can you help Tracy?

Input

  • The first line of the input contains a single integer TT denoting the number of test cases. The description of TT test cases follows.
  • The first line of each test case contains two space-separated integers NN and KK.
  • The second line contains NN space-separated integers H1,H2,,HNH1,H2,…,HN.

Output

For each test case, print a single line containing one integer — the smallest number of boxes required to build two towers, or 1−1 if it is impossible.

Constraints

  • 1T51≤T≤5
  • 1N,K4,0001≤N,K≤4,000
  • 1Hi1051≤Hi≤105 for each valid ii

Subtasks

Subtask #1 (30 points):

  • 1N,K1001≤N,K≤100
  • 1Hi1001≤Hi≤100 for each valid ii

Subtask #2 (70 points): original constraints

Example Input

2
8 38
7 8 19 7 8 7 10 20
4 5
2 10 4 9

Example Output

7
2

Explanation

Example case 1: The first tower can be built with boxes 8+10+20=388+10+20=38 and the second tower with boxes 7+7+8+19=417+7+8+19=41. In this case, the box with height 77 is left unused.

Example case 2: We only need the box with height 1010 for one tower and the box with height 99 for the other tower.

Watching CPL Codechef January 2021 solution || Watching CPL codechef problem editorial 2021


Solution -

Hint- other test cases.
8 15
10 7 7 5 1 1 1 1
output - 5

This problem is based on dynamic programming you need to learn the dynamic programming concept first.
where DP[i][k] represents minimum boxes required to make at least k hight till ith index.
we will use the suffix array here to find whether it is possible to make another box of height k. 
finally, we will print the optimal answer.
this question is similar to the 0/1 knapsack problem .
Refer this video  for better understanding -





Join telegram channel for code and editorial.-https://t.me/competitiveProgrammingDiscussion

by noreply@blogger.com (Unknown) at January 13, 2021 03:25 AM

January 11, 2021

Mahavir Singh

Chef and Division 3 Codechef january challenge solution || Chef and Division 3 Codechef january challenge Editorial 2021

 Chef and Division 3  Codechef january challenge solution || Chef and Division 3  Codechef january challenge Editorial-

Problem statement-

Chef wants to host some Division-3 contests. Chef has NN setters who are busy creating new problems for him. The ithith setter has made AiAi problems where 1iN1≤i≤N.

A Division-3 contest should have exactly KK problems. Chef wants to plan for the next DD days using the problems that they have currently. But Chef cannot host more than one Division-3 contest in a day.

Given these constraints, can you help Chef find the maximum number of Division-3 contests that can be hosted in these DD days?

Input:

  • The first line of input contains a single integer TT denoting the number of test cases. The description of TT test cases follows.
  • The first line of each test case contains three space-separated integers - NNKK and DD respectively.
  • The second line of each test case contains NN space-separated integers A1,A2,,ANA1,A2,…,AN respectively.

Output:

For each test case, print a single line containing one integer ― the maximum number of Division-3 contests Chef can host in these DD days.

Constraints

  • 1T1031≤T≤103
  • 1N1021≤N≤102
  • 1K1091≤K≤109
  • 1D1091≤D≤109
  • 1Ai1071≤Ai≤107 for each valid ii

Subtasks

Subtask #1 (40 points):

  • N=1N=1
  • 1A11051≤A1≤105

Subtask #2 (60 points): Original constraints

Sample Input:

5
1 5 31
4
1 10 3
23
2 5 7
20 36
2 5 10
19 2
3 3 300
1 1 1

Sample Output:

0
2
7
4
1

Explanation:

  • Example case 1: Chef only has A1=4A1=4 problems and he needs K=5K=5 problems for a Division-3 contest. So Chef won't be able to host any Division-3 contest in these 31 days. Hence the first output is 00.

  • Example case 2: Chef has A1=23A1=23 problems and he needs K=10K=10 problems for a Division-3 contest. Chef can choose any 10+10=2010+10=20 problems and host 22 Division-3 contests in these 3 days. Hence the second output is 22.

  • Example case 3: Chef has A1=20A1=20 problems from setter-1 and A2=36A2=36 problems from setter-2, and so has a total of 5656 problems. Chef needs K=5K=5 problems for each Division-3 contest. Hence Chef can prepare 1111 Division-3 contests. But since we are planning only for the next D=7D=7 days and Chef cannot host more than 11 contest in a day, Chef cannot host more than 77 contests. Hence the third output is 77.

Chef and Division 3  Codechef january challenge solution || Chef and Division 3  Codechef january challenge Editorial


Solution-

This problem can be solve using brute force approach.
calculate sum of array and print cout<<min(sum/k,d)<<endl;
here is my code-

Join telegram channel for code and editorial.-https://t.me/competitiveProgrammingDiscussion

by noreply@blogger.com (Unknown) at January 11, 2021 11:37 PM

December 31, 2020

Mahavir Singh

Count Set Bits GFG problems solution

https://practice.geeksforgeeks.org/problems/set-bits0143/1

Problem statement- 

Given a positive integer N, print count of set bits in it. 

Example 1:

Input:
N = 6

Output:
2

Explanation:
Binary representation is '110'
So the count of the set bit is 2.

Example 2:

Input:
8

Output:
1

Explanation:
Binary representation is '1000'
So the count of the set bit is 1.

Your Task:  
You don't need to read input or print anything. Your task is to complete the function setBits() which takes an Integer N and returns the count of number of set bits.

Expected Time Complexity: O(LogN)
Expected Auxiliary Space: O(1)

Constraints:
1 ≤ N ≤ 109

count set bit



SOlution -

If we do AND operation 
1&1=1
1&0=0
by using above property 
we will perform and operation with current number if  1&currnumber gives it means we will increament our final ans
by 1
we will right shift current number till current number become 0.
follow code below.
code-


by noreply@blogger.com (Unknown) at December 31, 2020 09:34 AM

December 30, 2020

Mahavir Singh

Red and Blue codeforces problem code

 Problem Statement-

Monocarp had a sequence aa consisting of n+mn+m integers a1,a2,,an+ma1,a2,…,an+m. He painted the elements into two colors, red and blue; nn elements were painted red, all other mm elements were painted blue.

After painting the elements, he has written two sequences r1,r2,,rnr1,r2,…,rn and b1,b2,,bmb1,b2,…,bm. The sequence rr consisted of all red elements of aa in the order they appeared in aa; similarly, the sequence bb consisted of all blue elements of aa in the order they appeared in aa as well.

Unfortunately, the original sequence was lost, and Monocarp only has the sequences rr and bb. He wants to restore the original sequence. In case there are multiple ways to restore it, he wants to choose a way to restore that maximizes the value of

f(a)=max(0,a1,(a1+a2),(a1+a2+a3),,(a1+a2+a3++an+m))f(a)=max(0,a1,(a1+a2),(a1+a2+a3),…,(a1+a2+a3+⋯+an+m))

Help Monocarp to calculate the maximum possible value of f(a)f(a).

Input

The first line contains one integer tt (1t10001≤t≤1000) — the number of test cases. Then the test cases follow. Each test case consists of four lines.

The first line of each test case contains one integer nn (1n1001≤n≤100).

The second line contains nn integers r1,r2,,rnr1,r2,…,rn (100ri100−100≤ri≤100).

The third line contains one integer mm (1m1001≤m≤100).

The fourth line contains mm integers b1,b2,,bmb1,b2,…,bm (100bi100−100≤bi≤100).

Output

For each test case, print one integer — the maximum possible value of f(a)f(a).

Example
input
Copy
4
4
6 -5 7 -3
3
2 3 -4
2
1 1
4
10 -3 2 2
5
-1 -2 -3 -4 -5
5
-1 -2 -3 -4 -5
1
0
1
0
output
Copy
13
13
0
0
Note

In the explanations for the sample test cases, red elements are marked as bold.

In the first test case, one of the possible sequences aa is [6,2,5,3,7,3,4][6,2,−5,3,7,−3,−4].

In the second test case, one of the possible sequences aa is [10,1,3,1,2,2][10,1,−3,1,2,2].

In the third test case, one of the possible sequences aa is [1,1,2,3,2,4,5,3,4,5][−1,−1,−2,−3,−2,−4,−5,−3,−4,−5].

In the fourth test case, one of the possible sequences aa is [0,0][0,0].

Solution-


by noreply@blogger.com (Unknown) at December 30, 2020 06:03 AM

September 01, 2020

Darshpreet Singh

GSoC Journey Ended Only, Not The Open Source

Hello, This blog is about my Google Summer Of Code journey with LibreHealth, it covers everything from applying for GSoC, getting selected, community bonding to final evaluations. I hope you will enjoy reading this & will find something useful in it. So, Let's get started.

Little Bit About Myself

I am Darshpreet Singh currently pursuing Bachelor Of Technology in Computer Science & Engineering, I have just completed my second year of engineering. From the beginning of my second year I started learning mobile app development, I was really passionate about app development and then got into the field deeper with time, completed 2 internships, and so on my journey with open source started

Aiming for GSoC 2020 & Submitting POC, Proposal

I heard a lot about GSoC from my college seniors and LinkedIn, I started asking a lot to people on LinkedIn how to get selected & what more should I learn. I got replies from lot of people they guided me a lot. I aimed to get selected in GSoC in 2020, I contributed in some organisation before the GSoC but the projects I contributed to were not selected, I was little disappointed. Still I had some hope I kept searching in the organisation & projects list to find an android related project. Finally after searching a lot I found LibreHealth, they had a lot of projects in mobile development, I aimed to submit my best to this organisation, I completed the POC(Proof Of Concept) task in just 2 days, I also did more than the required. I communicated a lot with mentors & after discussing a lot I submitted my proposal.

Getting Selected

It was a long month for me waiting for the results, On day of result I frequently checked my mail & GSoC website for result. It was 4th May at 11:30 PM, I got surprised to see that I am selected for GSoC, I was very happy, I thanked my mentors a lot for selecting me & assured them that I will defintely work hard & will make them feel proud of my work. Due to my excitement I was not able to sleep on time, I slept late at night but woke up early to start my GSoC journey & to tell my parents & friends about it.

download_cdm

About Project

To make an app which can display costs of medical procedures of US hospitals & a web scraper which can scrape ChargeMasters & update data periodically in GitLab Repository. The app will display nearby hospitals and the user can compare hospitals, filter hospitals based on location & radius. App can download nearby hospitals ChargeMaster from GitLab Repository and save it to local storage of phone in SQL database. User can view downloaded ChargeMaster, search in it, filter by price & category. This App can work offline and can update downloaded ChargeMasters.

About My Work

The Community Bonding Period

The community period begin the next day, I introduced myself to community & other selected students. I discussed a lot about project ideas such as use of API to get nearby hospitals & dicussing about CI (Continous Integration) Pipeline which will scrap the chargemasters every month automatically. Searched data on internet to get chargemasters, I found some websites of US government which had good amount of data.

First Work Period

  • Completed UI of App Screens with Dummy Data
  • Worked on Data Scraper
  • Setup GitLab CI Pipeline
  • Scraped & Processed CDM of Alaska State
  • Made SQL Database class for App
  • Worked on Home Screen backend Code
    • Used Overpass API to fetch Nearby hospitals
    • Used Google Images to get image of hospital by name
  • Scraped & Processed CDM of Indiana State
  • Learned & Used Flutter BLoC (Business Logic Of Component) Architecture
  • Used Hive to store local data
  • Worked on new tab in bottom navigation which will download cdm
  • Wrote SQL queries with which we can read & insert data in SQL Database in App

Blockers Faced

  • I wanted app to completely work offline after it fetched data once, So I started to store everything locally, I faced problem in saving images of hospitals, I thought it is not necessary to store images when user is offline, So, I am showing a placeholder, but whenever internet will be ON user can view images of hospitals as well

Second Work Period

  • Worked on Search Screen of App.
  • Made DAO ( Data Access Object ) class which uses SQL queries to query database.
  • Made Comparing Hospitals procedures functionality
  • Tested both IOS & Android App
  • Scraped CDM of California State
  • Wrote Readme.md file for scraper
  • Separated “process.py” from “Data” Directory, so that user don’t need to clone large repository.
  • I have to setup chromedriver & chromebrowser in CI Pipeline & then make this project run properly
  • I worked on Showing progress indicator while downloading CDM & saving to SQL database.
  • Fixed Network exceptions while downloading CDM in app.
  • Made Readme.md & troubleshoot.md for web scraper
  • Fixed the blocker
  • Completed UI of compare hospitals screen
  • Fixed bugs in download CDM screen
  • Scraped Medicare Data & wrote process script for that

Blockers Faced

chromedriver & chromebrowser were not working in Linux CI Pipeline, I was getting exception in pipeline, but it was working on my windows. I solved this blocker after searching too much on internet & found that chromedriver & chromebrowser need to be same.

Third Work Period

  • Worked on Share App, About App screens.
  • Used Flutter cache Manager to download & Save CDM to cache.
  • Search functionality in view CDM Screen.
  • Decreased size of data scraper repository
  • Fixed CI pipeline & CDMs are saved in master branch
  • Wrote Unit Test of

    • Home Screen
    • Download CDM screen,
    • Saved CDM Screen
    • View CDM
    • Search Screen
    • View CDM Statewise screen
    • Compare Hospital Screen
    • Settings Screen
  • Also Wrote Unit Tests for Overpass API, GitLab API, Medicare Hospital Compare API

  • Complete Readme.md for app
  • Created App Intro Slides
  • Worked on search by price in search screen of App
  • Created Splash Screen
  • Created option in App settings to choose any location of US to try App.
  • Fixed various bugs in App [ Fixed Location permission bug, if user denies then he has to manually allow location from settings ]
  • Used Orange LH theme as suggested by Mentor Mua N. Laurent.
  • Added retry button in snackbar of Location widget

Blockers Faced

I don't have IOS machine, So I was not able to setup splash screen for ios app properly, I have asked Mentor Mua N. Laurent for help in this. Still I will try to use a virtual macOS to setup the splash screen.

About Mentors

I had 4 mentors assigned during GSoC

I would like to thank all of them for their valuable suggestions & their involvement with me during the project. I want to specially thank mentor Mua N. Laurent for guiding me very closely, having frequent chat & video calls with me, testing my code, suggesting improvements in it. I could not reach this level without your mentoring.

GSoC Journey Ended Only, Not The Open Source

It was great experience for me during the GSoC working for open source projects. GSoC journey ended only, not my open source journey, I will continue to contribute to LibreHealth. I will assist the new members who are willing to contribute for this project. I will actively take part in the discussions and I will contribute by creating, Solving issues and adding improvements to this app.

https://gist.github.com/Darshpreet2000/9f08ee2080163851a2b6834c1eef16ba

Conclusion

GSoC was a wonderful experience for me, It improved a lot my programming skills, i would just say that GSoC is a great opportunity, work hard, be patient & enjoy your summer writing code. And also become a part of your organization after completing this program.

Screenshots

Home screen displaying nearby hospitals & user location Settings screen to filter nearby hospitals & change location Search screen - Searching by procedure
Search screen - Searching by price Bottom sheet to filter searching in CDM Navigation drawer - Navigate to different app screens.
Choose any two hospitals to compare them Compare screen - Comparing general information Compare screen - Comparing patient experience
Download CDM - Download ChargeMaster of your nearby hospitals View CDM - Viewing individual CDM with search functionality. View CDM Statewise - View CDM of other states of US.
Saved ChargeMasters - CDMs Saved in SQL database of app About us page of the project in the app.

September 01, 2020 05:00 AM

August 31, 2020

Aishwarya Harpale

GSoC 2020 with LibreHealth : Final Report

Low Powered Models for Disease Detection and Classification for Radiology Images


Project Description -

The aim of this project is to create Deep Learning models for detection and classification of radiology images. The models must be compressed such that they can be deployed to low powered devices like ARM devices, Android devices, etc. Compression techniques such as Quantization and Pruning can be used.  

 

Mentors -

Priyanshu Sinha

Judy Gichoya

Geeta Priya Padmanabhan


Tech Stack - 

Numpy

Pandas

PyDicom

Tensorflow

Tensorflow-Lite/ Tensorflow-Model-Optimization

Docker

Qemu


Project Link - Click here

Commits - Click here  

Merge Requests - Click here


Why to do this -

There has been a lot of progress in developing Machine Learning models that predict the medical condition of a patient based upon specific inputs relevant to the diagnosis of that condition. However, these models have drawbacks while deployment in real-time on edge devices. Firstly, they have been trained on high-end GPUs that consume a lot of power and have a lot of computational capacity. Edge devices function on limited power and have a considerably low computational limit. Next, these models are extremely large in size, usually a few hundred megabytes. While training, a large amount of space is available. But the same is not reflected on edge devices having low storage capacity. Healthcare professionals do not have high-end machines available for immediate usage of these models. But edge devices, being low-cost, are easily available. To tackle the problem of model deployment, we use model compression techniques that reduce four factors - power consumption, storage usage, computational cost and latency of detection models in the healthcare category.

 

What have you done -

For the purpose of this project, 2 datasets were used -

RSNA Pneumonia Detection Dataset

Chest-XRay 14 Dataset

The compression techniques used were -

Dynamic Quantization

Float16 Quantization

Int8 Quantization

Model Pruning

Model Pruning + Dynamic Quantization

Model Pruning + Float16 Quantization

Model Pruning + Int8 Quantization

 

RSNA Pneumonia Detection -

Two models were trained on this dataset - DenseNet201 and InceptionV3. We achieved the following results in the models’ performance with respect to accuracy and size.

Accuracies comparing original and compressed models -

 

Size comparing original and compressed models -

 

Accuracies comparing pruned and quantized-pruned models - 

 


Size comparing pruned and quantized-pruned models - 

 


Chest XRay14 -

Pretrained CheXNet model was used for this dataset from Bruce Chou's Github repository (link in references). The following results were obtained for this dataset.    

AUROC Score Comparison between orginial and compressed models -

AUROC Score Comparison between Pruned and Quantized Pruned models -

 

 Model Size Comparison -

 

 

How have you done it -

The general pipeline goes like this -

Step 1 - Data Exploration and Cleaning

In this step, we take raw data and explore it. We find out the number of classes, number of data items per class and the general distribution of data points. After deriving these insights, we clean the raw data to get rid of any unnecessary features or data entries. We also restructure tabular data such that it can be fed to the models. This involves steps like creating one-hot encoding of labels, creating extra columns, modifing path variable to redirect to images. In case of images, activities such as augmentation, resizing, shearing, etc are performed. 

Step 2 - Modelling

This is the next step in which we initialize data generators that generate preprocessed images and labels in fixed batches. Data is split into train-val-test subsets. Model architectures are initialized. We have used 3 architectures for this project - DenseNet201, InceptionV3 and CheXNet. We also initialize callbacks, checkpoints and optimizers that will be used during training. 

Step 3 - Training and Model Evaluation

Here, we train the models till we achieve acceptable performance. The model should neither be underfit nor overfit. After training is over, we evaluate the models. We evaluated DenseNet and InceptionV3 trained on the RSNA Pnemonia Detection Dataset based on accuracy. This is because the models directly output the class of the input image. CheXNet trained on Chest-XRay14 dataset was evaluated based on AUROC score because the output was not a fixed class but a class probability score. We also record the size of this original model.

Step 4 - Model Pruning

In model pruning, we trim the unnecessary connections in the neural network. here, I have used Polynomial Decay as the sparsity function. Pruning starts from 50% and goes upto 80% of the total weights in the model. After this, we remove the excess connections and compress the layers of the neural network. This model gets saved in a .h5 format.

Step 5 - Post-training Quantization

After the models are trained, we quantize them. This is done using Tensorflow Lite Converters. There are 3 types of quantizations that we are performing in this project - Dynamic, Float16 and Int8 quantization. We initialize the converter as per our requirement and pass the pre-trained or pruned model to it. The output is a quantized model in the form of a TFLite FlatBuffer. We evaluate the quantized models based on accuracy/AUROC score (as per the original model) and size.

Step 6 - Inference

For performing inference, using normal .h5 models, we use the model.predict() fucntion. While using TFLite models, we initialize interpreters that will set the input and output tensors. We invoke the interpreter on an input image and retrive the output tensor returned by the interpreter. The inference script was run for all models - original, pruned, quantized and hybrid.

 

Future Scope -

1. Testing these models on actual hardware such as Raspberry Pi and Android phones.

2. Compressing object detection/segmentation/UV based models.

3. Creating a UI to serve these models on the frontend.

 

References -

1. https://www.tensorflow.org/lite/performance/model_optimization
2. https://youtu.be/3JWRVx1OKQQ
3. https://youtu.be/4iq-d2AmfRU
4. CheXNet - https://github.com/brucechou1983/CheXNet-Keras

by Aishwarya Harpale (noreply@blogger.com) at August 31, 2020 08:36 AM