Looking at the documentation for Target documents in CouchDB, I have some questions.
Q1. Which database are these stored in once they are synced to the server?
I assume in the medic
DB, but just want to confirm.
Q2. The documentation says that there is “one [Targets document] per analytics reporting period”. Given the scenario below, can you confirm my understanding is correct?
Scenario: If you had 2x “All time” targets, 5x “monthly” targets, and 1x “quarterly” target (that uses a function to evaluate quarters), my understanding is that…
- The 2x “All time” targets would both be represented in 1 persistent Target document that has 2 array elements in the “targets” key. This document would just keep getting updated for perpetuity, there would only ever be one Target document that represents these 2 Targets .
- The 5x “monthly” targets would have one Target document per month that has 5x array elements in the “targets” key. One new Target document would be created every month for these 5x Targets.
- The 1x “quarterly” target would have one Target document per quarter that has this one Target in it. One new Target document would be created every quarter for this Target.
Q3. The documentation says that Target documents are “updated a maximum of once per day”. Is that a typo?
It seems weird that if you had a Target that counts pregnancy registrations in a given month, and you registered one in the morning and one in the afternoon, the one in the afternoon wouldn’t be counted until the next day.
Q4. From the Target document, can you please clarify how to know the “analytics reporting period”?
The _id
of the Target document has the format:
"_id": "target~2000-01~user-contact-guid~org.couchdb.user:agatha",
I assume the data between the first two ~
represents the reporting period, and in this example, I assume this means January of the year 2000. What will it be for “all time” Targets or Targets whose date
property is based on a function?
Q5. For Targets with a type = percent
, what information will be available in the Targets document?
Will the numerator and denominator be available? Will the percentage be represented as a decimal?