How to create an audience of users that were active in the past, but not in the past week - firebase-analytics

I want to send messages to users who were active in the past but inactive in the last 7 days. I am trying to create an audience that targets users who have NOT completed the event X in the LAST 7 DAYS, but they HAD completed it at some point in the past. Because there is no "last N days" condition to exclude, I am unable to create this audience. Is there a workaround?

According to the blog post on A Crash Course in Using the New Audiences in Analytics, it is possible to exclude groups from dynamic audiences these days. See the section on Excluding Groups in the post.
So you'll need two groups:
Users that were ever active
Users that were active in the past week
And then you build your final audience of users that are in group 1, but not in group 2.
An example of this (again from the blog post):
The above screenshot creates an audience of users who did exercise at least 5 times, but did not track a meal.

Related

Best way to track membership history

I am creating a membership management database. One of the aspects I want to keep track of is the duration of a membership, and I want to keep track of any breaks in membership also.
Example:
A person joins , they renew each year on time for 3 years, but then there is a lapse in renewal for 2 months on the 4th year, and then they renew. I would like to be able to see the membership period of 3 years, the 2 month lapse, and then the new renewal.
Currently (see image), I originally was planning on just updating the membership_expire field to be a year from the date of the latest renewal but then realized I would be losing the previous membership renewal history by updating that field.... So how do I work around that?
I have a feeling the solution may be to create a seperate table to keep track of each renewal but I am not sure that is the best way to do it.
The database should reflect the reality.
If a "membership" can have multiple renewals, with different periods,
then your data structure should support it.
meaning- you need to create another table with FK to membership,
and each row would represent a period of time (start and expires)

How to create a database that shows a vacant doctor appointment time slots?

Context:
I am working on a tele-health application that allows clients to choose an appointment type and then choose an available time slot to take that appointment. The client can only choose the appointment type and have no access to data regarding the available doctors
Procedure:
Client chooses appointment type
A Calendar is populated with available appointments for the next 30 days (sample calandar)
Once the client selects an appointment, one of the available doctors that can provide the service are assigned to them
Variables:
Each doctor has availability slots within weekdays (might have more than one on the same day)
One doctor may give more than appointment type
each service has a duration (some appointment types are set to 30 minutes and some maybe up to 60 minutes)
Problem:
Right now I am having trouble with:
listing the available time as shown in the sample calendar above in an efficient manner. Efficiency is key as this data will be needed to be retrieved a lot. I tried creating a view that has all the possible appointments, but that solution is extremely redundant.
Accounting for appointments of different duration
Current Database Design
Ideally I would like to return a list of JSON objects that contain the available start times per day (for the next 30 days) and a list of doctor id's that can handle this appointment.
Assuming that the time slots are all the same length, then you can create a calendar of all the time slots that are available.
I would suggest that each "slot" (appointment) have the information in your appointment table -- but with the caveat that "empty" appointments would also be included. Or, have the slots as a separate table with an appointment_id when the slot is taken.
Presumably, there is some limit on when future appointments can be made -- say 3 months in the future or one year in the future. Have a weekly job that adds another week in the future to the table.
Then you can summarize and readily see both available slots and unavailable appointments.

Send message to users who registered by did not complete event X

I would like to send messages to users who registered 7 days ago, and have not made a purchase, as a reminder.
I have created the audience below. My questions are :
Is it certain that the message will not be sent out right after the registration and that the evaluation period will be 7 days after the registration to make sure they haven't made a purchase? Do I need to specify this anywhere?
When choosing the Scheduling settings for the message, if I choose "Daily" then will all users who qualify to receive this message get it at the next 12:00 (as of 7 days after they register)?
Thanks!
The criteria
I don't think your audience is correct. "In any 7 days period" doesn't mean "7 days ago".
With your current settings, you will target any user that registers within the last 7 days (= also 2 days ago, 3 days ago...).
By choosing "Daily" all users in your audience will receive your message. But you can specify within the notification parameters that users can receive this notification only once.
I'm also trying to create audiences of users that performed an action X-days ago, so I can't tell you right now the best way to do it.
Hope this helps!

MySQL Database Schema for role based system

We are developing a platform for NGOs (N) to get their work done via Individual Volunteers (V) or Volunteers via a Company (C)
NGO
An NGO can come signup for an account and create a profile.
It creates Activities (jobs it needs help from volunteers) to which Individual Volunteers or a Company (Sub set of their Employees who are registered as Volunteers in the system) can apply.
An NGO can check the Applicants Profile and previous Work History
and accept the application. On Acceptance they become members of an
Activity.
Here While they work after regular intervals say 2weeks they need to
enter the amount of hours they have contributed towards that
particular activity.
NGO has to validate this time so that it can reflect in a Volunteers profile as credit
Company
A Company signup for a profile.
It uploads the list of all its employees in a particular formatted CSV file to add Volunteers against itself or send an invite link to to ask their employees to signup. If an Employees already exists in the system we send an email asking him to validate the company's claims
Company can search for a particular Task and apply to it by selecting all its employes or a subset of it.
While Validating time for the work done it can be done it two ways. 1 Company can centrally say V1 V2 V3 have completed 2hrs 3hrs and 2hrs and submit for validation from the NGO or allow each of its Employees handle this manually and allow them to submit it.
Where i need help?
I have created the NGO and single Volunteer relationships. I am confused as to how use the same tables but allow a new entity like Company come in between the NGO and Volunteer and manage the time validation and activity management.
The Time Validated is very important as it will be used to be shown that in the Social Equity Balance of the NGO, Company as well as Volunteers (Individual Work and also Worked for a cause through a company)
I have created the ER diagram below for the NGO and Volunteer and need to create the Company part of it.
Link: http://i.stack.imgur.com/OMY21.png
I'm not sure you need to change your schema much, or even at all. Your schema requires an application to go with it to make it do anything - you can't implement all the logic here - some/most of it will be in your application.
As I understand it, your spec says that all actual volunteer work is performed by individuals, some of whom may be associated with a Company and some aren't. Your schema captures this already.
That's pretty much all you need, I think. When you say:
While Validating time for the work done it can be done it two ways. 1 Company can centrally say V1 V2 V3 have completed 2hrs 3hrs and 2hrs and submit for validation from the NGO or allow each of its Employees handle this manually and allow them to submit it.
This is already covered - either each individual inputs their own work records or the application allows the company to do it for them - and then the NGO validates these records in the same way, regardless of who entered them.
I have created the NGO and single Volunteer relationships. I am confused as to how use the same tables but allow a new entity like Company come in between the NGO and Volunteer and manage the time validation and activity management.
Lets go through a worked example to illustrate both use cases, to make sure we've got everything covered:
Worked Examples
Individual, no company
An individual signs up, creating a row in the volunteers table. They sign-up for an activity, creating a row in the ngo_activity_applications table.
The NGO approves them, creating a row in the ngo_activity_members table - and either removing the row in the ngo_activity_applications table, or changing it's status - the spec. is unclear.
The individual does some work and logs the time in the app, creating rows in the ngo_activity_time_validations table.
The NGO validates the work done somehow, then tells the app this. This presumably changes the status of the rows in the ngo_activity_time_validations table and creates either one summary row or matching rows in the volunteer_validated_times table. Spec unclear where cost_per_hour comes from?
Company
A company signs up and uploads a CSV file with 3 volunteers in. This creates a row in the companies table, plus three rows in the volunteers table, and 3 rows in the company_volunteers linking table.
Company Volunteer 1 signs up to an activity individually and everything proceeds as above.
The Company signs up for a different activity and volunteers all 3 of it's people to work on it. This creates 3 rows in the ngo_activity_applications table.
The NGO approves all three, creating three new rows in the ngo_activity_members table - and either removing the rows in the ngo_activity_applications table, or changing their status - the spec. is unclear.
The volunteers do some work and the company logs time in the app on behalf of Company Volunteers 1 and 2 - and Company Volunteer 3 logs her own time:
Company Volunteers 1 and 2
The company uses the application to log the time on their behalf - creating 2 rows in the ngo_activity_time_validations table.
Company Volunteer 3
Company Volunteer 3 uses the application to log their own time - creating a row in the ngo_activity_time_validations table.
The NGO validates the work done somehow, then tells the app this. This presumably changes the status of the rows in the ngo_activity_time_validations table and creates either one summary row or matching rows in the volunteer_validated_times table. Spec unclear where cost_per_hour comes from?
Summary
You can see how much validated time any individual has logged by querying the volunteer_validated_times table JOINed to the volunteers table. You can also see how much validated time any Company has logged, by doing the same query but also joining on the company_volunteers table.
Possible changes & Questions:
You might want to add a company_entered flag to the ngp_activity_time_validations table, so that you can distinguish between records entered by individuals and ones entered by the company on an individuals behalf. You might also want to add the ID of the person who makes the entry in this table, if logging that is relevant to your application.
Might want to add an hourly_rate column to the volunteers table, to use as a default cost_per_hour when creating rows in the volunteer_validated_times table.

MySQL tables pattern for event calendar

I've been developing a PHP app recently that is aimed at helping Doctors & patients getting in touch and also uses FullCalendar for the doctor So he can manage his events.
My problem is: as I learned coding by myself, I have not learned how to decide whether to use this or that DB organisation.
Currently, the app creates a new table for each new subscription (Doctors only) that is named event_[$doctor_id] but I have to admit I'm scared by the perspective of having 3000 users!
My needs are:
keep a ref for each event during 2 years after its date (but not necessarily in the same dB table)
events younger than 6 months need to be visible in the calendar
to avoid errors, events are never (almost) deleted from the db - they are just disabled in order to allow the user to repair a 2 weeks old mistake
I Was considering using date named tables like "201303" for all the events taking place in March 2013, and then use a bot every month that will somehow save the oldest information (6 months + old) in a specific table or even in a file.
But as the changes might take me a few hours, I'd appreciate some advice from you people!