c19 icon indicating copy to clipboard operation
c19 copied to clipboard

Make sure people can report on behalf of people in their household [C19-9]

Open holgerthorup opened this issue 5 years ago • 3 comments

[FROM LOUIS:]

Important that we can collect data for households, who may only have one cell phone.

Data Structure Detach concepts person and phone. To do:

  • [ ] Rename "person" to "phone"
  • [ ] Create "person", which has a "phone" column (which is a foreign key to phone)
  • [ ] create a new "person" for each number, with the same id, so the previous foreign key holds up.
  • [ ] "survey"'s "person" column should of course be a foreign key to the new "person".

Application Allow people to create surveys on behalf of members of their household. If they register 3 members of their household in their initial survey, allow them to fill out 2 more initial surveys.

When following up, let the batch job run on "person", meaning a phone number with 3 persons on, would receive 3 follow up surveys. We should handle it such, that people understand why they get 3 links, and not just one (and that 3 different people should fill them out!)

holgerthorup avatar Mar 20 '20 16:03 holgerthorup

[ALTERNATIVE DESIGN PROPOSAL]: I don't want to rename stuff on DB to limit downstream effects on currently live systems.

Important that we can collect data for households, who may only have one cell phone.

Data Structure Detach concepts person and participant. To do:

  • [x] Create a concept of a participant, which has a person FK
  • [x] Add another FK to survey related to participant should have a name column for the user to name each entry.

Application Allow people to create surveys on behalf of members of their household.

On the main survey attached to the phone number, there should be a button to "Fill out for another member of your household" -> Give it name (encourage not to give persons real name for privacy) -> Show Survey

When following up, let the batch job run on participant too, meaning a person with 3 participants, would receive 3 follow up surveys. Additional surveys on participant level should be sent (and show in UI) with names.

holgerthorup avatar Mar 20 '20 18:03 holgerthorup

Database changes I've committed (in development - not in production yet; todo):

create table participant
(
  id     serial  not null
    constraint participant_pkey
    primary key,
  person integer not null
    constraint participant_person_id_fk
    references person
    on update cascade on delete cascade
);

create unique index participant_id_uindex
  on participant (id);


ALTER TABLE public.survey ADD participant int NULL;
ALTER TABLE public.survey
ADD CONSTRAINT survey_participant_id_fk
FOREIGN KEY (participant) REFERENCES public.participant (id) ON DELETE SET NULL ON UPDATE CASCADE;

ALTER TABLE public.person ADD primary_participant int NULL;
ALTER TABLE public.person
ADD CONSTRAINT person_participant_id_fk
FOREIGN KEY (primary_participant) REFERENCES public.participant (id) ON UPDATE CASCADE;

louislva avatar Mar 24 '20 19:03 louislva

Working to-do:

  • [x] Create primary participant when creating person
  • [x] Endpoint to create a new participant
  • [x] When submitting initial survey give option to fill out survey for each household member (@louislva)
  • [x] When filling out follow ups, ability to fill out the other participants surveys (@louislva)
    • [ ] Prompt for this if user didn't do it
  • [ ] Create surveys for each participant when following up manually
  • [ ] Create surveys for each participant when sending out SMS asking for follow ups
  • [ ] Ability to identify each participant, so you know who's who when filling it out - but so a malicious actor couldn't triangulate your identity (for example, names would be bad;)
  • [ ] When doing follow-ups, ability to add a new participant under your phone number/person, if you didn't do it initially; this first survey should of course be initial for the newly created participant

louislva avatar Mar 27 '20 11:03 louislva