Ejemplo n.º 1
0
def deidentify_case_action(action):
    # v1
    if hasattr(action, "case_name"):
        action.case_name = random_fullname()
    # v2
    if "case_name" in action.updated_known_properties:
        action.updated_known_properties["case_name"] = random_fullname()
Ejemplo n.º 2
0
def deidentify_case_action(action):
    # v1
    if hasattr(action, "case_name"):
        action.case_name = random_fullname()
    # v2
    if "case_name" in action.updated_known_properties:
        action.updated_known_properties["case_name"] = random_fullname()
Ejemplo n.º 3
0
def deidentify_case(doc):
    assert (doc.doc["doc_type"] == "CommCareCase")
    case = CommCareCase.wrap(doc.doc)
    case.name = random_fullname()
    for action in case.actions:
        deidentify_case_action(action)
    doc.doc = case._doc
    return doc
Ejemplo n.º 4
0
def deidentify_case(doc):
    assert(doc.doc["doc_type"] == "CommCareCase")
    case = CommCareCase.wrap(doc.doc)
    case.name = random_fullname()
    for action in case.actions:
        deidentify_case_action(action)
    doc.doc = case._doc
    return doc
Ejemplo n.º 5
0
def deidentify_commcare_user(doc):
    assert (doc.doc["doc_type"] == "CommCareUser")
    user = CommCareUser.wrap(doc.doc)
    for i in range(len(user.phone_numbers)):
        user.phone_numbers[i] = random_phonenumber()

    name = random_fullname()
    user.first_name = name.split(" ")[0]
    user.last_name = name.split(" ")[1]
    user.username = username_from_name(name)
    doc.doc = user._doc
    return doc
Ejemplo n.º 6
0
def deidentify_commcare_user(doc):
    assert(doc.doc["doc_type"] == "CommCareUser")
    user = CommCareUser.wrap(doc.doc)
    for i in range(len(user.phone_numbers)):
        user.phone_numbers[i] = random_phonenumber()
    
    name = random_fullname()
    user.first_name = name.split(" ")[0]
    user.last_name = name.split(" ")[1]
    user.username = username_from_name(name)
    doc.doc = user._doc
    return doc