Coder Social home page Coder Social logo

simple-android's People

Contributors

benryder1988 avatar govindkrjoshi avatar harimohanraj89 avatar janhavisinghh avatar msasikanth avatar noyize avatar olttwa avatar paranoidbeing avatar prabhanshuguptagit avatar pratul avatar ragunathjawahar avatar rakshakhegde avatar renovate[bot] avatar rishabjaiswal avatar saket avatar sanchita avatar siddh1004 avatar ssrihari avatar timcheadle avatar transifex-integration[bot] avatar vinaysshenoy avatar vkrmis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

simple-android's Issues

As an Admin, I can manage the state protocol, and protocol drugs for facilities to decide what nurses can use in the mobile interface.

Protocol Info

Model

Protocol

  • id uuid
  • name string
  • follow_up_days integer

ProtocolDrug

  • id uuid
  • name string
  • dosage string
  • protocol_id integer
  • rxnorm_code string

Facility

  • protocol_id uuid

Questions

  • Should we build a user interface to create or manage protocols and drugs?
    • Assumption: yes

TODO

  • Create protocol and protocol drug models
  • Use rails scaffolding to generate views to CRUD protocols and protocol drugs
  • Add rake task to add Punjab's hypertension protocol
  • Build sync to device for protocol and protocol drugs

Preview

screen shot 2018-06-04 at 5 34 41 pm

Server (coarse-grained) API audits

user_id did action on model with record_id at timestamp

what to log

  • actions: fetch, create, update, login
  • models: patients, addresses, phone numbers, blood pressures, prescribed drugs
  • record_id
  • user_id
  • timestamp

when to log

  • during login and sync API calls

where to log

  • database table, append-only

Nurse can record Prescribed Drugs

As a ... I can ... So that ...

As a nurse, after recording their BP, I can record the patient's prescribed drugs according to the state protocol.

  • Show prescriptions under the current protocol
  • Save user selections
  • Show custom prescriptions
  • Add custom prescriptions
  • Support deletion of prescriptions

Bugs

  • P0 After entering BP, then tap "add medicine", then tapping medicine/dose, then hit back arrow, BP keyboard pops back up
  • P0 In some cases, 2 dosages are selected for the same drug (example: https://vitalstrat.slack.com/files/UAKE25198/FBCLDE4GZ/img_20180625_092427_963.jpg)
  • P1 When "add another medicine" entry is up, add an overlay to obfuscate the background
  • P1 If patient doesn't have any meds, the button should not say "UPDATE", but instead "ADD MEDICINES" (copy what's on Zeplin)
  • P1 After entering drugs, the back button sometimes displays the BP entry screen instead of the Patient Summary screen
  • P1: (This may already be recorded) Add a new patient, BP pops up, enter BP, then tap "Add" on medicine, choose a medication, then hit back arrow in top left.... BP jumps up again. The BP shouldn't be triggered again.
  • P1: Before medication is added the medicine button says "Add". It should say "Add medicines" as per Zeplin.
  • P2 There should be a SAVE/DONE button after medicines are added

Integrate sentry

  • Integrate Android app with Sentry SDK (for fatals)
  • Provide Sentry configuration and secrets from Bitrise while generating builds
  • Enable multidex
  • Sanity check that everything here is done?

Sync BP data with server

TODO:

  • Finalise data model for blood pressure
  • Add model, migrations, same validations as other models
  • Include mergeable concern, add mergeable test for BP
  • Write specs for blood pressure api
  • Implement sync: adding blood pressures, test this
  • Implement sync: retrieving blood pressures, test this

Questions:

  • Do we compute risk level on mobile, store it, send it to server?
    • Assumption: we'll compute it on mobile, not send it to server

Data Model, API spec

  • id: uuid
  • systolic: integer
  • diastolic: integer
  • created_at: timestamp
  • updated_at: timestamp
  • patient_id: uuid
  • all are required

Nurse can self-register

As a Nurse, I can register myself on the app to avoid slow and manual back-and-forth with the Resolve team.

This card has been carved out and deprioritized for the MVP in favour of having the Resolve team register nurses/users in the backend by creating users through the web UI.

Nurse can look up Patient by name

As a ... I can ... So that ...

Nurse can lookup a patient by name, and enter a new patient record if lookup fails, so that s/he can move on to enter a BP for the patient, whether old or new.

(#7 is a subset of this issue)

Bugs

  • P0: The search results screen occasionally does not show any search results, even though the data is there.
  • P0 Scrolling through the list of patients hides the age filter and resets it
  • P0 Age filter doesn’t work. I added an 89 year old patient, and filtering on 88 gives me [89, 52, 0, 25] year olds
  • P1: Back button does not return to Home Screen: After entering a new user, if I enter the first BP I'm prompted for and then click back, I go back to the Patient Entry screen, not the Home Screen. I can do this any number of times (re-creating a duplicate user and re-entering the initial BP prompt) and I still return to the New Patient screen. If I enter a second BP by clicking "New BP" the back button works properly and returns me to the Home Screen.
  • P1: The string "null" shows up in search results where a field was ignored. The search results should be formatted to display all variations of meaningful & void data together.
  • P2: After searching for a user and clicking on their result to view the Patient Summary screen, clicking "back" twice to return to the home screen sometimes continues to display the keyboard. The keyboard should be hidden when returning to the home screen.
  • P2: There should be some way to indicate that an age filter has been applied. Currently, so when I apply the filter and then search by name, the search works within the age parameter +/-3 as expected, but the user (nurse) cannot see this on the screen.

Misc

  • Update the search results UI to match zeplin
  • Update the search query to match name or phone numbers
  • If user selects a patient, open the patient's summary screen
    • Pre-fill the new patient's name or phone-number from the search query
  • If user clicks Back button, go back to the Home screen

Age filter

  • Make the UI in the toolbar
  • Add a bottom sheet
  • Update the query to show results with ±3 years of age entered
  • Update the query to show results with ±3 years of date-of-birth

Patient Sync API

  • Make sync push API call also send phone numbers
  • Make sync pull API call also retrieve and store phone numbers

Nurse cannot enter an invalid BP

As a ... I can ... So that ...

As a Nurse, I cannot enter an invalid blood pressure with the BP keyboard.

A rules-based keyboard will restrict user data entry on the BP Entry screen to decrease the likelihood of typos when entering a patient's BP.

Configure CI

  • Canary test to ensure sanity of the test rig
  • Ensure downloadable APKs are being generated
  • Ensure that individual artifacts can be downloaded, and not a combined compressed artifact
  • Pay for Bitrise and ask them for an "open source discount" or something

Nurse can add patient by scanning Aadhaar card

As a ... I can ... So that ...

As a nurse I should be able to add a new patient by scanning their Aadhaar card so that patient entry is a single click.

  • Request camera permission
  • Handle temporary permission denial
    [ ] Handle permanent permission denial
  • Find a QR code scanning library
  • Read QR code
  • Initiate a new patient entry flow
  • "Search by Name" and "Search by Phone" become a single button
  • Clicking the scan square should open the Aadhaar-scanning camera
  • Home Screen (Aadhaar Scan) Redesign to Spec [moved to its own card]

Sync patient data from server to user

  • Get new/updated patients from server
  • Save the timestamp of the latest record synced with server
  • Log validation errors
  • Mark patients with validation errors as invalid
  • Finish unit tests
  • Save phone numbers

We need to think this through
We need to batch records that need to be sent from server to user. Do we use pagination mechanisms? How do we define last_sync_at? Should we record server_updated_at in addition to device_updated_at?

Nurse can add new patient

As a ... I can ... So that ...

As a nurse I can add a new patient by manually entering the name, dob/approximate age, gender, address and phone numbers.

Bugs

  • P0 When I search, the "Create new patient" button never shows up (see Zeplin 09-Patient/09c-Patient name search fill). Is this just not done yet?
  • P0 On a standard Nexus 5-size screen the label for DD/MM/YYYY on the date of birth field is truncated to DD/MM/Y... Preferred fix would be (A) We should immediately hide "Age" when the user focuses on the DOB field. But for MVP we'll do the faster (B) Remove "Date of Birth" from the label, since it already shows in the hint.
  • P1 When “add another medicine” entry is up, add an overlay to obfuscate the background
  • P1 On a standard Nexus 5-sized screen the word "Transgender" wraps badly; fix is to ellipsis ("...") instead of wrapping
  • P1 "male" and "female" are reversed on save
  • P1 The state with no medications needs to have "Add medicines" on the button with no "Updated" date in the top right.
  • P1: Required fields should be highlighted
  • P1: Instead of TODO, can we fill in actual values for district / state
  • P2 In the new patient form, the phone number is pre-filled and there's no X to clear it.
  • P2 The empty state of the BP section should have empty rows with grey lines showing where BPs will be displayed (see Zeplin).
  • P2 Validation errors (such as a birthdate of "33/33/3333") do not explain to the user what is wrong.

UI considerations

  • All input fields should show a "X" button when they have some data, and they are in focus.
  • Phone Number
    • Needs a "NONE" checkbox.
    • "NONE" should only be visible while phone number is empty
  • Date of birth / Age
    • DOB should show change the hint from "Date of Birth" to "DD/MM/YYYY" as the user starts typing.
    • DOB should show forward-slashes automatically as the user inputs the date.
    • If data is entered in either DOB or Age, the field should expand to fill width of layout.
  • Address
    • For MVP, we inline COV, District and State fields into the primary data screen.
    • Colony of Village should have a "NONE" checkbox.
    • District and State should be auto-filled from the nurse's facility data.

UX decisions

Q: What happens when up/back is pressed and the form is not empty.
A: Although the app is capable of let the user pickup from where they left by pre-filling the form with previous values, we aren't sure how to decide when to reset and when to pre-fill. So we're going to reset the form for MVP.

Q: What happens when a None checkbox is checked for say, the phone number field
A: The field is cleared. The checkbox is unchecked when the user starts typing again.

Admin can register User (backend)

Bugs

  • rename "password" to "PIN" so it's more obvious
  • restrict "full name" to alphabetic input
  • from a Facility's user list, there should be a "Create User" option

User model

  • id - UUID
  • full_name - String
  • phone_number - String [required, non empty]
  • security_pin_hash - String

Relationships

  • User belongs to one facility
  • User has recorded many blood pressures (updates the blood pressure model)

Questions

  • Do we need to store the medical license number for the user?
    • assumption: since it doesn't appear in the screens for the MVP, we don't need this yet
  • Should we build a user interface to create or manage users?
    • yes
  • Should we build sync from device for user?
    • assumption: yes

TODO

  • Create user model
  • Add factories for user
  • Build sync to device for user
  • Use rails scaffolding to generate views to CRUD users
  • use bcrypt to hash passwords

Sync patient data from user to server

  • Create patient model payload (patient, address)
  • Create patient model payload (phone numbers)
  • Schedule periodic syncing of patients
  • Send sync-pending patients to server
  • Limit the number of patients to send to the server
  • Finish unit tests

As a nurse, I want the patient records on device to be sent in batches to the backend, so that the central database is updated, and the data is safe.

Patient data model

ID - UUID [to discuss]
Full Name - String
Age when created - Integer
Date of Birth - Date
Gender (male / female / transgender) - Enum/String
Status (active, dead, migrated, unresponsive, other [define other]) - Enum/String

Address data model

id – uuid
street address - string
colony - string
village - string
district - string
state - string
country - string
pin - string

Phone number data model

number - string
type -string
active - boolean

Relationships

Patient belongs to an address
Patient has and belongs to many phone numbers

Questions:

  • What is the "other" patient status?
  • What should the status be when a patient is "Removed from call list"?

Not relevant for MVP. We'll still keep the status field in the code. We'll default to "active" status. @saket please default to "active" status on the device as well.

  • Should we perform any validation on the mobile number?

No, as discussed with Daniel. To allow landlines, extensions, etc.

  • Should village/colony be the same field? Should they be mandatory?

Yes, single field. Not mandatory. As discussed with Tim/Daniel at standup on 17/05.

Re: address model

  1. Locality: as entered by nurses on the app. How would we model this?
  2. Aadhar address: what are the fields? How would this fit into our model?

Nurse can see Risk Level

As a ... I can ... So that ...

As a nurse, I can see BP indicated as high, very high etc. based on the protocol followed by the facility (state?).

Need information on the thresholds for "high", "very high" etc. based on the protocol followed by the facility (state?) I work in.

Bugs

  • spacing issue in the rows

Deploy to the Play Store

The final decision on the package name is org.simple.clinic.

  • Create an app listing on the Play Store
  • Create an alpha channel for the app, whitelist our team so they can start getting updates from the store instead of going through Bitrise
  • Setup auto increment of build numbers

Optional:

  • Get API endpoints from Bitrise' env variables

Nurse can enter BP for new patient

As a ... I can ... So that ...

As a nurse after I have added a new patient, I can enter a patient's BP or skip to the next screen quickly

Bugs

  • P0 Cursor needs to advance from systolic to diastolic inputs automatically. If the user types a 1 or a 2 in the systolic input, automatically jump after 3 characters. If the user types a 3-9 jump after 2 characters
  • P0 Disable rotation for now (it deletes whatever was typed in)
  • P1 After rotation, BP cannot be saved, and back button doesn't work
  • P1 When BP entry is up, add an overlay to obfuscate the background
  • P1 Before typing, there is only one dot displayed for systolic and one dot displayed for diastolic. It should be 3 dots and 3 dots.
  • P1 After entering initial BP, the "done" button does nothing. Clicking "done" should return the user to the home screen.
  • P1 After entering initial BP, sometimes the number pad displays over top of the Systolic/Diastolic fields so the user cannot see what she is entering.
  • Once a new patient has been saved, the BP entry sheet shows up every time the summary screen is resumed after coming back from prescribed drugs screen
  • P2 If you have a high BP then a normal BP, the normal BP shows up as red. (It re-renders as gray if you rotate)
  • P2: If you enter a high BP (e.g. 190/80) and then enter a normal BP (e.g. 135/60)... the normal BP is red. If you leave the patient record and come back to the same record, the color is correct (grey). — if this is the same as the above P2, please just check it off, @saket / @pratul .

Automate AWS setup, and deploy

  • Clean unused code for ansible and terraform scripts
  • Ansible setup, scripts for the above
  • Capistrano setup, scripts for deploy
  • Expose monit UI
  • setup deploy user
  • staging
  • qa
  • production
  • document AWS provisioning in README

Nurse can login (API Authentication)

How it works

  1. User registers in admin interface, while in the facility
  2. Someone from RTSL enters data in the admin interface
  3. Backend sends a special SMS to a "registered" user's phone with a link
  4. Link has special URL that opens the app (the app must be pre-installed on the user's device for the link to correctly work)
  5. App picks up OTP that is part of the URL, and stores it temporarily
  6. App shows the login screen and lets the user enter their phone number and PIN
  7. App makes the login API call with phone number, PIN and OTP (that was part of SMS)
  8. Server sends back the user "object" and an access token
  9. App stores the access token for future use
  10. From this point onward, every subsequent API call made by the app needs 2 headers...
    -- X_USER_ID with value as the user ID that was returned in the login API call
    -- HTTP_AUTHORIZATION with value as Bearer (insert access token from login API call)
  11. App makes the facility API call to get the list of facilities
  12. App starts the sync workers in the background, and shows the home screen to the user

Keep in mind

  • If any API call receives 401 as status in response, the user should be logged out.
  • When the app is closed and opened, login screen should appear.

Questions

  • Should the PIN entry screen appear every time the app goes into background?
    no, there should be a delay of 15 mins (configurable) after which user should be asked to enter the PIN again
  • Do sessions time out on the device? Is there a notion of sessions on the device?
    no, they shouldn't, at least for the MVP release

Server TODOs

  • Generate otp and otp_valid_until when user is created from admin console
  • Login user using phone number, pin and otp
  • Login responds with user record and access token
  • Respond to user with access-token. This token should be revocable from backend
  • Authenticate sync apis with user access token
  • Configure Twilio and ensure SMSs can be sent to Indian numbers
  • invalidate OTP after successful login (indicated by the first authenticated API call with given auth token)

Android TODOs

  • UI
    • Go through all the screens on zeplin and make layouts
  • API
    • Setup the API call in Paw
    • Study the responses and make models
  • Controller(s)
    • Read SMS, extract OTP from SMS and store it somewhere
    • Get phone number and PIN from the UI
    • Make API call using phone number, PIN and OTP
    • Store API results as the "user object"
    • Make the facility API call with X_USER_ID and HTTP_AUTHORIZATION headers
    • Store received facilities
    • Fix loggedInUser() in UserSession class
    • Update BP tests to do user login first, and use logged-in-user data
  • Retrofit
    • Make header interceptors that works on all API calls except login
  • Elsewhere
    • Don't start sync workers until login is successfully done
    • Complete facility sync before start other sync workers

Sync Facility to device

Sync facilities onto device, so that patient and blood pressures can be recorded against it.

This needs to happen before nurse registration, because the nurse needs to choose a facility during registration.

Admin can create Facility

Bugs

  • editing a user from a facility's page returns a 404 because it links to protocol drugs (see detailed explanation below)
  • column rendering bug listed below

Nurse can view Patient Summary

As a ... I can ... So that ...

As a nurse, I can view the patient's summary, so that I can diagnose the patient based on their historical blood pressures and drug prescriptions.

This includes profile information, blood pressure history, and drugs.

  • Show a Done button when summary is opened after saving a new patient
  • Ensure that the software and hardware back buttons have the same behavior

Bugs

  • P1 Remove the Edit button from the Patient Summary screen
  • P1 "Low" BP text sometimes shows up as red instead of grey
  • P1: See the patient "Bidisha: F, phone 5888585866, Age 33". Her gender is F on the search list and is M on the patient record screen.
  • P1 The DONE button should always show up on the patient details screen as per @dhruv's Zeplin screens. When you search for a patient, tap on the patient in the search list, there is no DONE button.
  • P2 Drug section should say "Updated 3 days ago" not "Updated -3 days ago"

Medicines

  • Show medicines
  • Show last updated timestamp

BP history

  • Show BP measurements
  • Show HIGH, VERY HIGH and EXTREMELY HIGH in red color
  • Show today's measurements in bold

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.