from django.conf import settings from edc.dashboard.section.classes import BaseSectionView, site_sections from edc.map.classes import site_mappers site_mappers.autodiscover() class SectionReportsView(BaseSectionView): section_name = 'reports' section_display_name = 'Reports' section_display_index = 50 section_template = 'section_bcpp_reports.html' def contribute_to_context(self, context, request, *args, **kwargs): return context def get_current_community(self): return site_mappers.get_current_mapper().map_area site_sections.register(SectionReportsView)
from edc.dashboard.section.classes import BaseSectionView, site_sections from ..search import HnsccSearchByWord from ..models import Enrollment class SectionHnsccView(BaseSectionView): section_name = 'subject' section_display_name = 'Subjects' section_display_index = 10 section_template = 'section_hnscc_subject.html' dashboard_url_name = 'hnscc_dashboard_url' add_model = Enrollment search = {'word': HnsccSearchByWord} show_most_recent = True site_sections.register(SectionHnsccView)
section_display_index = 45 section_template = 'section_bcpp_clinic.html' dashboard_url_name = 'subject_dashboard_url' add_model = ClinicEligibility search = {'word': ClinicSearchByWord} show_most_recent = True def contribute_to_context(self, context, request, *args, **kwargs): try: daily_log = DailyLog.objects.get(report_date=date.today()) except DailyLog.DoesNotExist: daily_log = None current_survey = Survey.objects.current_survey() context.update({ 'current_survey': current_survey, 'current_community': str(site_mappers.get_current_mapper()), 'daily_log': daily_log, 'subject_dashboard_url': self.dashboard_url_name, }) return context # only include section for CPC or the central server if site_mappers.get_current_mapper( ).intervention or device.device_id == device.central_server_id: site_sections.register(SectionClinicView)
from edc.dashboard.section.classes import BaseSectionView, site_sections from edc.map.classes import site_mappers site_mappers.autodiscover() class SectionAnalyticsView(BaseSectionView): section_name = 'Analytics' section_display_name = 'Analytics' section_display_index = 70 section_template = 'bcpp_analytics/analytics_index.html' def contribute_to_context(self, context, request, *args, **kwargs): context.update({}) return context site_sections.register(SectionAnalyticsView)
from edc.dashboard.section.classes import BaseSectionView, site_sections from .search import MaternalSearchByWord from .models import MaternalConsent class SectionMaternalView(BaseSectionView): section_name = 'maternal' section_display_name = 'Maternal' section_display_index = 20 section_template = 'section_maternal.html' dashboard_url_name = 'subject_dashboard_url' add_model = MaternalConsent search = {'word': MaternalSearchByWord} show_most_recent = True site_sections.register(SectionMaternalView)
from edc.dashboard.section.classes import BaseSectionView, site_sections class SectionStatisticsView(BaseSectionView): section_name = 'statistics' section_display_name = 'Statistics' section_display_index = 40 section_template = 'section_statistics.html' dashboard_url_name = 'subject_dashboard_url' site_sections.register(SectionStatisticsView)
from collections import namedtuple from edc.dashboard.section.classes import BaseSectionView, site_sections ModelMeta = namedtuple('ModelMeta', 'app_label model_name') class SectionAdministrationView(BaseSectionView): section_name = 'administration' section_display_name = 'Administration' section_display_index = 140 section_template = 'mpepu_section_administration.html' site_sections.register(SectionAdministrationView, replaces='administration') class SectionAppointmentView(BaseSectionView): section_name = 'appointments' section_display_name = 'Appointments' section_display_index = 110 section_template = 'mpepu_section_appointment.html' site_sections.register(SectionAppointmentView, replaces='appointments')
Keyword Arguments: results_per_page: (default: 25) """ current_survey = Survey.objects.current_survey() if not results_per_page: results_per_page = 25 if device.is_central_server: if current_survey.survey_abbrev == 'Y1': _search_result = [] for household_structure in search_result: if household_structure.survey.survey_abbrev == 'Y1': _search_result.append(household_structure) return super(SectionHouseholdView, self)._paginate(_search_result, page, results_per_page) elif current_survey.survey_abbrev == 'Y2': _search_result = [] for household_structure in search_result: if household_structure.survey.survey_abbrev in ['Y1', 'Y2']: _search_result.append(household_structure) return super(SectionHouseholdView, self)._paginate(_search_result, page, results_per_page) else: return super(SectionHouseholdView, self)._paginate(search_result, page, results_per_page) else: _search_result = [] for household_structure in search_result: if household_structure.survey == current_survey: _search_result.append(household_structure) return super(SectionHouseholdView, self)._paginate(_search_result, page, results_per_page) site_sections.register(SectionHouseholdView)
from collections import namedtuple from edc.dashboard.section.classes import BaseSectionView, site_sections ModelMeta = namedtuple('ModelMeta', 'app_label model_name') class SectionAdministrationView(BaseSectionView): section_name = 'administration' section_display_name = 'Administration' section_display_index = 100 section_template = 'hnscc_section_administration.html' def contribute_to_context(self, context, request, *args, **kwargs): context.update({ 'enrollment_meta': ModelMeta('hnscc_subject', 'enrollment'), }) return context site_sections.register(SectionAdministrationView, replaces='administration') class SectionAppointmentView(BaseSectionView): section_name = 'appointments' section_display_name = 'Appointments' section_display_index = 110 section_template = 'hnscc_section_appointment.html' site_sections.register(SectionAppointmentView, replaces='appointments')
from ..search import MemberSearchByWord site_mappers.autodiscover() class SectionMemberView(BaseSectionView): section_name = 'member' section_display_name = 'Members' section_display_index = 30 section_template = 'section_member.html' search = {'word': MemberSearchByWord} def contribute_to_context(self, context, request, *args, **kwargs): current_survey = None if settings.CURRENT_SURVEY: current_survey = Survey.objects.current_survey() context.update({ 'current_survey': current_survey, 'current_community': str(site_mappers.get_current_mapper()), 'mapper_name': site_mappers.get_current_mapper().map_area, 'CONFIRMED': CONFIRMED, }) return context site_sections.register(SectionMemberView)
from edc.dashboard.section.classes import BaseSectionView, site_sections from .search import InfantSearchByWord from .models import InfantBirth class SectionInfantView(BaseSectionView): section_name = 'infant' section_display_name = 'Infants' section_display_index = 30 section_template = 'section_infant.html' dashboard_url_name = 'subject_dashboard_url' add_model = InfantBirth search = {'word': InfantSearchByWord} show_most_recent = True site_sections.register(SectionInfantView)
section_template = 'section_bcpp_plot.html' search = {'word': PlotSearchByWord} show_most_recent = False def contribute_to_context(self, context, request, *args, **kwargs): current_survey = None if settings.CURRENT_SURVEY: current_survey = Survey.objects.current_survey() context.update({ 'current_survey': current_survey, 'current_community': str(site_mappers.get_current_mapper()), 'mapper_name': site_mappers.get_current_mapper().map_area, 'gps_search_form': GpsSearchForm(initial={'radius': 100}), 'use_gps_to_target_verification': settings.VERIFY_GPS, 'search_term': kwargs.get('search_term'), }) context.update() return context def get_current_community(self): return site_mappers.get_current_mapper().map_area site_sections.register(SectionPlotView)
from edc.dashboard.section.classes import BaseSectionView, site_sections from .search import MaternalSearchByWord from .models import MaternalConsent class SectionMaternalView(BaseSectionView): section_name = 'maternal' section_display_name = 'Maternal' section_display_index = 20 section_template = 'section_maternal.html' dashboard_url_name = 'subject_dashboard_url' add_model = MaternalConsent search = {'word': MaternalSearchByWord} show_most_recent = True site_sections.register(SectionMaternalView)
registered_subject=subject_consent. household_member.registered_subject): if [ survey for survey in Survey.objects.all() if survey == household_member.household_structure.survey ]: subject_consent.household_member = household_member subject_consent.survey = household_member.household_structure.survey _search_result.append(deepcopy(subject_consent)) break return super(SectionSubjectView, self)._paginate(_search_result, page, results_per_page) else: _search_result = [] for subject_consent in search_result: for household_member in HouseholdMember.objects.filter( registered_subject=subject_consent.household_member. registered_subject): if household_member.household_structure.survey.survey_slug == settings.CURRENT_SURVEY: subject_consent.household_member = household_member subject_consent.survey = household_member.household_structure.survey _search_result.append(deepcopy(subject_consent)) return super(SectionSubjectView, self)._paginate(_search_result, page, results_per_page) site_sections.register(SectionSubjectView)
from edc.dashboard.section.classes import BaseSectionView, site_sections from .search import InfantSearchByWord from .models import InfantBirth class SectionInfantView(BaseSectionView): section_name = 'infant' section_display_name = 'Infants' section_display_index = 30 section_template = 'section_infant.html' dashboard_url_name = 'subject_dashboard_url' add_model = InfantBirth search = {'word': InfantSearchByWord} show_most_recent = True site_sections.register(SectionInfantView)
from edc.dashboard.section.classes import BaseSectionView, site_sections from edc_device import device ModelMeta = namedtuple('ModelMeta', 'app_label model_name') class SectionAdministrationView(BaseSectionView): section_name = 'administration' section_display_name = 'Administration' section_display_index = 140 section_template = 'bcpp_section_administration.html' def contribute_to_context(self, context, request, *args, **kwargs): context.update({ 'is_server': device.is_server, 'replaceable_meta': ModelMeta('bcpp_household', 'replaceable'), 'plot_meta': ModelMeta('bcpp_household', 'plot'), 'household_meta': ModelMeta('bcpp_household', 'household'), 'subjectconsent_meta': ModelMeta('bcpp_subject', 'subjectconsent'), }) return context site_sections.register(SectionAdministrationView, replaces='administration')