Source code for q2_cores.EPL.queries.demographic_info_query

import logging
from typing import Optional
from lxml.builder import E

from q2_cores.EPL.queries.epl_soap_base import EplSoapBase
from q2_cores.EPL.queries import mock_responses


[docs] class DemographicInfoQuery(EplSoapBase): """Builds the xml payload for the demographic call for the EPL core.""" def __init__( self, logger: logging.Logger, ssn: str, institution_id: str, consumer_id: str, request_namespace: Optional[str] = None, header_namespace: Optional[str] = None, ): if not request_namespace: request_namespace = "urn:ws:eplinc:com:cgs:v1_00" if not header_namespace: header_namespace = "urn:ws:eplinc:com:cgs:common:v1_00" self.ssn = ssn self.institution_id = institution_id self.consumer_id = consumer_id self.request_namespace = request_namespace self.header_namespace = header_namespace super().__init__(logger)
[docs] def build(self): xml = E.MemberInquiryRequest( E.MessageHeader( E.InstId(self.institution_id), E.ConsumerId(self.consumer_id), xmlns=self.header_namespace, ), E.TIN(self.ssn), xmlns=self.request_namespace, ) request = [xml] return self.wrap_in_soap(request)
[docs] def mock_response(self): return mock_responses.mock_demo_response()