@classmethod
def from_client_json(cls, resource_json, id_=None, expected_version=None, client_id=None):
    fhir_q = questionnaire.Questionnaire(resource_json)
    if (not fhir_q.group):
        raise BadRequest('No top-level group found in questionnaire')
    if ('version' not in resource_json):
        raise BadRequest('No version info found in questionnaire')
    external_id = None
    if (fhir_q.identifier and (len(fhir_q.identifier) > 0)):
        external_id = fhir_q.identifier[0].value
    semantic_desc = None
    irb_mapping = None
    if fhir_q.extension:
        for ext in fhir_q.extension:
            if (ext.url == _SEMANTIC_DESCRIPTION_EXTENSION):
                semantic_desc = ext.valueString
            if (ext.url == _IRB_MAPPING_EXTENSION):
                irb_mapping = ext.valueString
    q = Questionnaire(resource=json.dumps(resource_json), questionnaireId=id_, semanticVersion=expected_version, externalId=external_id, semanticDesc=semantic_desc, irbMapping=irb_mapping)
    (code_map, concepts, questions) = cls._extract_codes(fhir_q.group)
    from rdr_service.dao.code_dao import CodeDao
    code_id_map = CodeDao().get_internal_id_code_map(code_map)
    cls._add_concepts(q, code_id_map, concepts)
    cls._add_questions(q, code_id_map, questions)
    return q
@classmethod
def from_client_json(cls, resource_json, id_=None, expected_version=None, client_id=None):
    fhir_q = questionnaire.Questionnaire(resource_json)
    if (not fhir_q.group):
        raise BadRequest('No top-level group found in questionnaire')
    if ('version' not in resource_json):
        raise BadRequest('No version info found in questionnaire')
    external_id = None
    if (fhir_q.identifier and (len(fhir_q.identifier) > 0)):
        external_id = fhir_q.identifier[0].value
    semantic_desc = None
    irb_mapping = None
    if fhir_q.extension:
        for ext in fhir_q.extension:
            if (ext.url == _SEMANTIC_DESCRIPTION_EXTENSION):
                semantic_desc = ext.valueString
            if (ext.url == _IRB_MAPPING_EXTENSION):
                irb_mapping = ext.valueString
    q = Questionnaire(resource=json.dumps(resource_json), questionnaireId=id_, semanticVersion=expected_version, externalId=external_id, semanticDesc=semantic_desc, irbMapping=irb_mapping)
    (code_map, concepts, questions) = cls._extract_codes(fhir_q.group)
    from rdr_service.dao.code_dao import CodeDao
    code_id_map = CodeDao().get_internal_id_code_map(code_map)
    cls._add_concepts(q, code_id_map, concepts)
    cls._add_questions(q, code_id_map, questions)
    return q