Trying to create a custom process that shares specific information - google-sheets

I work for a high school that has a regular four day school week and calls students in for "Reteach and Enrichment" on Fridays. To help organize the schedule for this, the school has created a Google Sheet that lists all of the student names and allows the teachers to fill in what time they would like any particular student to come to their class that Friday. This is working fine for the school's organizational side, but informing students of their assignments is currently a bit of a nightmare.
Because students will try to get out of anything, we have to have documentation indicating that we "told the students they need to come to our classroom on Friday". This is currently done in the form of giving a student a slip of carbon copy paper informing them of the time they are called in. As you can imagine, this is extremely time-consuming and full of holes since the students can throw the paper away or claim "they never got the paper" even though we've got a second copy of that paper indicating that it was filled out. But I digress.
The reason I'm writing to you fellow internet people is that I've taken on the task of trying to streamline the process of notifying the students of their schedules for Fridays. Because of privacy issues, we cannot give the students read-only access to the master list for Fridays, but I'm looking for a way to inform them of their specific information. My first thought was to write a program that would make a google sheet of each line on the master sheet, and share that sheet with the student whose information was on that line. This seems painful to set up and manage though and will lead to a lot of documents in google drives that are only needed for a week. The second problem is that I'm not sure what type of application I could use to run a program that would need to be able to access one google sheet, copy information from it, create a new google sheet, paste the copied information, gather the correct account the information needs to be shared with, and share read access to the new sheet that was created. I was thinking of using Auto Hotkey, but I know there's got to be a better solution to this problem.
If you have any suggestions for a different approach, please let me know. I believe that I can get an automated process to do what I described above if I can get the process down to a rote set of steps to take for each line on the original google sheet. But I'm hoping there's a way to do like an XLookup or Vlookup from a new sheet that references the original or something.

Related

How to write a script to create and populate new spreadsheets from a master document?

I would like to create a pupil progress sheet for each of my pupils that is held in my gdrive and is owned by me (Teacher).This spreadsheet would use import range to pull test data from the 'Class sheet'. The pupil would be able to view their file but not make changes, or make a copy of the file so that they can make changes!).
This I can do manually but doing this for a class of 30 (let alone the 10 classes I have!) would be tedious in the extreme. I would imagine that a script might be able to automate much of this and I was wondering if there are any showstoppers in the list of requirements below before investigating further.
Is it possible to create a script that does the following from a MASTER SHEET (below):
A B C D
1 ID NAME EMAIL
2 1 sample sample#gmail.com
3 2 sample2 sample2#gmail.com
1) Run through the list above and create a duplicate of a separate template Google Sheets file for each person in Column C.
2) Rename the sheet to their name using column C
3) Populate a single cell (A1) within the new spreadsheets with their ID (Column B)
4) Share with the email (Column D) allowing VIEWING only and disabling copying the file etc.
Yes, you can create a "Master" document, only readable and not editable by anyone else but you. That document can be accessible to all your students after you share it with a "public link" to view (not to edit).
With the help of Google's SpreadSheet, you can create a file with different questions for instance, and run a script to generate different types of tests, but this might require a little of knowledge of Javascript. You can learn how to make Google drive scripts from tutorials.
For me, the creation of automatic named files for every student, and send emails automatically is not a great idea, but yes you can do it and there are tutorials on how to send emails from a Spreadsheet.
The best option is to just give a link to your students.
Preferably, after you create a sharing link from Google Drive, you should make the link as short as possible, by using a free service like the site bit.ly where any huge and hard to remember old link, can be shortened to something more easy to use like bit.ly/TomTests_Oct2016.
You can also consider to use Khan Academy if it fits your needs, since you are a teacher. This is definitely one good platform to evaluate students progress, with a lot of free content (if not everything).

What's the most efficient way to create an alert queue for a model with hundreds of millions of entries?

I am currently working on an application in Rails (though language/framework shouldn't matter for this question since it is more of a theoretical one). I'm working on wrapping my head around this problem:
Say I am tracking millions of blogs online and am plugged into their RSS feeds. My app pings these feeds every few few minutes to see if there has been any new activity across any of these millions of blogs. If there is any new activity, I want to alert users of my application who have signed up to receive alerts for specific blogs that there has been an alert.
Does it make sense to have a user_blog_alerts table (where a user can specify custom keywords to be alerted about) and continuously check this table against every new entry that comes in from my feed? And when there is a match, to add them to a queue (using Redis)?
What is the best, most efficient way to build and model this alerting system? Am I even thinking about this in the right way? Are there any good examples or tutorials on this when working with such large amounts of data?
I'm not sure what the right way to do this is, but the thought of continuously scanning a table over and over sounds exhausting (ie. unscalable).
Off the top of my head, what if you created a LIST for every blog in Redis. The values would be the user IDs of those who wanted an alert. The key name would contain the blog id (ex: "user_blog_alerts:12345").
Then when you got a new post for blog 12345 it's a simple lookup to see if that key exists. If it does, then fire off alerts for each user in the list.

How to Track my sites URLs across the web? Not using google analytics

Sorry for the simple question but I've searched through the forums for 2 hours.
Goal:
I want to track my websites URLs across the web. I'm current using google analytical to do tracking which is fine for me. But I want to show my users where their links are being clicked when they login to their account.
What's the best way I can do this? I'm using a php backed if that helps. My goal is to provide: how many times their links are clicked and where the URL was clicked from.
Edit: I was hoping somebody else would give you a better hint, but since the question doesn't seem to attract many people I'll try to give you a better answer.
So, breaking down your problem to pieces, you want to trigger a piece of code everytime a page is accessed. You should be able to do a mapping between the page and its owner at one point - when rendering the statistics. If you want to "cut corners" and have a simple solution, you simply insert into your database a new entry describing the event. You seem to be only interested in the number of times it was accessed, so for a specific pageID, you can count how many entries there is, so this data can be computed directly from your database.
Now, the interesting part, figuring out where the visitor comes from. If you take a look at the $_SERVER variable for PHP, documented here, you will see that it contains a lot of interesting information. I think you're mostly interested in 'HTTP_REFERER' which contains
The address of the page (if any) which referred the user agent to the
current page. This is set by the user agent. Not all user agents will
set this, and some provide the ability to modify HTTP_REFERER as a
feature. In short, it cannot really be trusted.
Looking quickly on Stack Overflow I didn't find a more trustable source, so when available, I guess that's the only data you can use.
If you want to make things a bit more robust, you could log the IP address of the visitor and only count 1 visit per day.
So, to recapitulate, you create a table which logs the visits, containing the pageID and referer (optionally the IP address and date to prevent multiple insertions on the same day from the same user if you want to be strict). You add a function call to each page that will record the information of your pageID, maybe the URL or an ID you use internally? and the value of $_SERVER['HTTP_REFERER']. Then, when a user wants to see his stats, you look up every pageID that belongs to him, then pull the count of entries for that page and all the referers.
I hope my explanations are clear. It's definitely not bulletproof, but it's simple and should do the job, and it can be programmed pretty quickly.
Old answer: Piwik (documented here) is pretty similar to Google Analytics. Since you own the database where the data is stored, you could probably extract all the data you want, the way you want it, and manipulate it the way you want without having to depend on someone else (Google).

When writing a BDD feature, should I put previous user interaction into a Given step, or a When step?

I am trying to write requirements for a multi-step business process (via a wizard). I have many scenarios where user interactions with one screen will change whether you are allowed to pick options on another screen.
For example (I've obscured the actual business, but the process and form of the steps is nearly identical):
Feature: Personal Diagnostic Search Filter
In order to select a Technician who offers Personal Diagnostics,
when I've asked for a Personal Diagnostic
As a Business Customer
I want to limit my search to Technicians who offer Personal Diagnostics
Background:
Given a Business named "Big Al's Auto Supply"
And a Customer named "Bob Test" at the "Big Al's Auto Supply" Business
And an Account named "bobtest#testbusiness.com" owned by "Bob Test"
And the "bobtest#testbusiness.com" Account has the "Repair Order Creator"
permission
And you log in as "bobtest#testbusiness.com"
And you start scheduling a new Repair Order
Scenario: Enter the Select Technician page when Use PD is selected
Given you select Use PD
When you enter the Select Technician page
Then the PD Filter should be visible
And the PD Filter should be selected
Scenario: Basic Search for Technicians when PD Filter is selected
Given a Technician named "PD Technician"
And the Technician named "PD Technician" supports PD
And a Technician named "Non-PD Technician"
And the Technician named "Non-PD Technician" does not support PD
And you select Use PD
And you enter the Select Technician page
And you select the PD Filter
And you select Basic Search
When you search for Technicians with the name "Technician"
Then your search results should contain "PD Technician"
And your search results should not contain "Non-PD Technician"
But on the Gherkin wiki, it is recommended that you:
Avoid talking about user interaction in givens
They go on to make an exception, though:
Log in a user (An exception to the no-interaction recommendation. Things that “happened earlier” are ok).
It also is said on that page that:
The purpose of When steps is to describe the key action the user performs
What belongs in a Given and what belongs in a When if you have a lot of UI interaction?
In my first scenario, select Use PD requires UI interaction, as it is part of the wizard for creating a new Repair Order. However it is a precondition for PD Filter to be visible, and is triggered when the user enters the Select Technician page.
The first scenario might not be so bad, but the second scenario exacerbates the problem. The search is triggered when you hit Search but there are a lot of UI interactions that must be done to navigate to that page. Some of those interactions can't be glossed over, either, as Use PD must be selected for the search filter to even appear. But those UI interactions aren't the key action of the scenario.
As a general rule, try as much as possible to phrase the scenario as if you're having a conversation about it, and exclude as much irrelevant information as possible.
For instance, I would love your scenarios above to read something like:
Given our customer Bob Test is scheduling a repair order
And we have two technicians: "Fred Technician" and "George Nontechnician"
When Bob Test decides he wants a Personal Diagnostic
And he selects a technician
Then the search results should only contain "Fred Technician"
Then do whatever is necessary to make those steps work - be they logging in or otherwise. Notice I haven't talked about "pages", or taken the actual steps - they should be intuitive for the user. BDD isn't about testing. It's about coming up with examples of how people are going to use the system, so that you can have conversations around those examples and explore them, find exceptions and different scenarios, etc.
Checking that the filter is visible is not valuable. The user doesn't care that the filter is visible. He cares that he can use the filter to get his results, so just do that.
In the code, I usually pass a "World" object between my steps. That can get a lot of the gubbins out of the way. I haven't used Gherkin much but I imagine it provides for a similar ability. You can store all the user details in there, which technicians you've created so that you can check it doesn't bring back "George Nontechnician" in the results, etc.
Using friendly names for roles is useful too, because people can then imagine what Fred and George look like.
Get rid of anything which isn't going to make a difference in the scenario and isn't going to help people imagine it happening. You know that Bob has permission to schedule an order because that's what he's doing - just add the necessary stuff to that step.
The "When" is the behavior you're interested in describing. In this case, you're interested in the ability to filter for Personal Diagnostics, so all the user interaction associated with behavior should be in the "When", and all previous interaction should be in the "Givens". I find it useful to try and think of a context in which the outcome is different - for instance, what happens if there are no PD technicians available? That tells me what the difference is; we'll be setting up a different context but performing the same event. Context goes in the Given, events go in the When. (This used to be much simpler before "Background" was introduced).
In general, if your eyes glaze over when you look at a scenario, you're doing something wrong.
Hope this helps.

MongoDB and embedded documents, good use cases

I am using embedded documents in MongoDB for a Rails 3 app. I like that I can use embedded documents and the values are all returned with one query and there is less load on the database server. But what happens if I want my users to be able to update properties that really should be shared across documents. Is this sort of operation feasible with MongoDB or would I be better off using normal id based relations? If ID based relations are the way to go would it affect performance to a great degree?
If you need to know anything else about the application or data I would be happy to let you know what I am working with.
Document that has many properties that all documents share.
Person
name: string
description: string
Document that wants to use these properties:
Post
(references many people)
body: string
This all depends on what are you going to do with your Person model later. I know of at least one working example (blog using MongoDB) where its developer keeps user data inside comments they make and uses one collection for the entire blog. Well, ok, he uses second one for his "tag cloud" :) He just doesn't need to keep centralized list of all commenters, he doesn't care. His blog contains consolidated data from all his previous sites/blogs?, almost 6000 posts total. Posts contain comments, comments contain users, users have emails, he got "subscribe to comments" option for every user who comments some post, authorization is handled by the external OpenID service aggregator (Loginza), he keeps user email got from Loginza response and their "login token" in their cookies. So the functionality is pretty good.
So, the real question is - what are you going to do with your Users later? If really feel like you need a separate collection (you're going to let users have centralized control panels, have site-based registration, you're going to make user-centristic features and so on), make it separate. If not - keep it simple and have fun :)
It depends on what user info you want to share acrross documents. Lets say if you have user and user have emails. Does not make sence to move emails into separate collection since will be not more that 10, 20, 100 emails per user. But if user say have some big related information that always growing, like blog posts then make sence to move it into separate collection.
So answer depend on user document structure. If you show your user document structure and what you planning to move into separate collection i will help you make decision.

Resources