def clean_codebook(codebook):
    """Clean the codebock and add information about column type.

    This function:
        * indexes the dataframe on the ``variable`` column
        * adds a data type column which is used for cleaning
        * drops one column which does not appear in the data
        * adds a missing space in a value in the coding column to aid in
          parsing coding strings when recoding values
        * adds a missing sentinel value for child weight variables
        * renames the ``health_care_experience`` column to ``hce``

    Args:
        codebook (dataframe): original GHDx codebook

    Returns:
        (dataframe)
    """
    df = codebook.set_index('variable')

    df.loc[df.coding.notnull(), 'type'] = 'categorical'
    df.loc[df.coding.isnull(), 'type'] = 'numeric'
    df.loc[df.index.str.startswith('word_'), 'type'] = 'word'
    df.loc[['site', 'g2_01', 'g2_02'], 'type'] = 'info'

    # Some numeric variables have a sentinel value for missing which appears
    # in the coding coding. This value is always a set of 9s as "Don't Know"
    # Since this is the only coding it appears at the begining of the string
    num_with_dk = df.coding.str.contains('^9+ "Don\'t Know"').fillna(False)
    df.loc[num_with_dk, 'type'] = 'numeric'

    # These regexs are designned to NOT match the string '[specify unit]',
    # which is a numeric encoding of the unit
    freetext_re = 'specified|, specify|from the certificate|Record from where'
    df.loc[df.question.str.contains(freetext_re), 'type'] = 'freetext'

    # This columns is not actually in the data
    df.drop('gs_diagnosis', inplace=True)

    # The codebook is missing a space between the 1 and "Grams" which causes
    # the mapping from coding function to fail
    df.loc['c1_08a', 'coding'] = ('1 "Grams" 8 "Refused to Answer" '
                                  '9 "Don\'t Know"')

    # The codebook does not mention that the values 9999 is used as a sentinel
    # for missing for child weight at previous medical visits
    df.loc[['c5_07_1', 'c5_07_2'], 'coding'] = '9999 "Don\'t Know"'

    df.rename(columns={'health_care_experience': 'hce'}, inplace=True)
    order = ['question', 'module', 'type', 'hce', 'coding']

    return df[order]