Demographics
hemlock_demographics.demographics
def hemlock_demographics.demographics(*items, page=False, require=False, record_index=False) [source]
Parameters: | *items : str
Names of demographic items to return. See the full list of available items. page : bool, default=False
Indicates that a page should be returned containing the demographics items. If Indicates that participants are required to respond to the items. record_index : bool, default=FalseIndicates that the dataframe should record the order in which the demographic items appear on the page. |
---|---|
Returns: | demographics : hemlock.Page or list of hemlock.Question
A page containing the requested demographics items if |
Examples
from hemlock import push_app_context
from hemlock_demographics import demographics
app = push_app_context()
demographics('age', 'gender', 'race', page=True).preview()
hemlock_demographics.comprehensive_demographics
def hemlock_demographics.comprehensive_demographics(**kwargs) [source]
Parameters: | **kwargs :
Keyword arguments are passed to |
---|---|
Returns: | demographics :
A comprehensive demographics questionnaire including basic demographics, family demographics, country demographics, and SES demographics. |
hemlock_demographics.basic_demographics
def hemlock_demographics.basic_demographics(**kwargs) [source]
Parameters: | **kwargs :
Keyword arguments are passed to |
---|---|
Returns: | basic demographics :
Gender, age, and race. |
hemlock_demographics.family_demographics
def hemlock_demographics.family_demographics(**kwargs) [source]
Parameters: | **kwargs :
Keyword arguments are passed to |
---|---|
Returns: | family demographics :
Number of household residents, number of children, living with parents or in-laws, marital status. |
hemlock_demographics.country_demographics
def hemlock_demographics.country_demographics(**kwargs) [source]
Parameters: | **kwargs :
Keyword arguments are passed to |
---|---|
Returns: | country demographics :
Country of residence, origin, citizenship, and household language. |
hemlock_demographics.status_demographics
def hemlock_demographics.status_demographics(**kwargs) [source]
Parameters: | **kwargs :
Keyword arguments are passed to |
---|---|
Returns: | SES demographics :
Education, employment, occupation, work sector, savings, subjective social class and income group. |
hemlock_demographics.register
def hemlock_demographics.register(key=None) [source]
Register a demographics item.
Parameters: | key : str or None, default=None
String key for the item. If |
---|
Examples
@register()
def gender(require=False):
gender = Check(
'<p>What is your gender?</p>',
['Male', 'Female', 'Other'],
var='Gender'
)