Monitoringi

Założenia

Moduł stanowi komponent, który agreguje sprawy związane z różnymi urzędami, które odnoszą się do zbiernia informacji tej samej kategorii. Zatem monitoringiem będzie np. zainteresowanie wysoką opłaty za śmieci w Polsce. Na tej postawie system tworzy liczne sprawy dla każdego urzędu, który ma być objęty badaniem.

Architektura

Model

class feder.monitorings.models.Monitoring(id, created, modified, name, slug, user, description, subject, hide_new_cases, template, use_llm, responses_chat_context, normalized_response_template, results, email_footer, notify_alert, is_public, domain)[source]
Parameters:
  • id (AutoField) – Id

  • created (AutoCreatedField) – Utworzony

  • modified (AutoLastModifiedField) – Zmodyfikowany

  • name (CharField) – Nazwa

  • slug (AutoSlugField) – Adres url

  • user_id (ForeignKey to feder.users.models.User) – Użytkownik / użytkowniczka

  • description (TextField) – Opis

  • subject (CharField) – Temat

  • hide_new_cases (BooleanField) – Czy ukrywać nowe sprawy przy przypisywaniu?

  • template (TextField) – Użyj {{EMAIL}} aby umieścić adres odpowiedzi

  • use_llm (BooleanField) – Użyj LLM do oceny odpowiedzi

  • responses_chat_context (JSONField) – Kontekst odpowiedzi w monitoringu dla czatu AI

  • normalized_response_template (JSONField) – Znormalizowany szablon odpowiedzi

  • results (TextField) – Wyniki monitoringu i otrzymanych odpowiedzi

  • email_footer (TextField) – Podpis w stopce e-maili, w tym w odpowiedziach na e-maile

  • notify_alert (BooleanField) – Powiadom o nowych alertach osoby, które mogą je widzieć

  • is_public (BooleanField) – Czy publicznie widoczny?

  • domain_id (ForeignKey to feder.domains.models.Domain) – Domena użyta do wysłania wiadomości

exception DoesNotExist
exception MultipleObjectsReturned
generate_voivodeship_table()[source]

Generate html table with monitoring voivodeships and their institutions and cases counts

class feder.monitorings.models.MonitoringGroupObjectPermission(id, permission, group, content_object)[source]
Parameters:
exception DoesNotExist
exception MultipleObjectsReturned
class feder.monitorings.models.MonitoringQuerySet(model=None, query=None, using=None, hints=None)[source]
with_case_confirmation_received_count()[source]

function to annotate with case count when case.confirmation_received field is True

with_case_quarantined_count()[source]

function to annotate with case count when case.is_quarantined field is True

with_case_response_received_count()[source]

function to annotate with case count when case.response_received field is True

class feder.monitorings.models.MonitoringUserObjectPermission(id, permission, user, content_object)[source]
Parameters:
exception DoesNotExist
exception MultipleObjectsReturned

Panel administracyjny

class feder.monitorings.admin.MonitoringAdmin(*args, **kwargs)[source]

Admin View for Monitoring

actions = None

Widoki

class feder.monitorings.views.DraftListMonitoringView(**kwargs)[source]
Parameters:
  • url_namemonitorings:drafts

  • url_namemonitorings:drafts

get_context_data(**kwargs)[source]

Insert the single object into the context dict.

get_object_list(obj)[source]

A method to return object list to additional list. This should be overriden.

Parameters:

obj – The object the view is displaying.

Returns:

A list of object to paginated

Return type:

QuerySet

Raises:

ImproperlyConfigured – The method was not overrided.

get_queryset()[source]

Return the QuerySet that will be used to look up the object.

This method is called by the default implementation of get_object() and may not be called if get_object() is overridden.

model

alias of Monitoring

class feder.monitorings.views.LetterListMonitoringView(**kwargs)[source]
Parameters:
  • url_namemonitorings:letters

  • url_namemonitorings:letters

get_context_data(**kwargs)[source]

Insert the single object into the context dict.

get_object_list(obj)[source]

A method to return object list to additional list. This should be overriden.

Parameters:

obj – The object the view is displaying.

Returns:

A list of object to paginated

Return type:

QuerySet

Raises:

ImproperlyConfigured – The method was not overrided.

get_queryset()[source]

Return the QuerySet that will be used to look up the object.

This method is called by the default implementation of get_object() and may not be called if get_object() is overridden.

model

alias of Monitoring

class feder.monitorings.views.MassMessageView(**kwargs)[source]
Parameters:

url_namemonitorings:mass-message

form_class

alias of MassMessageForm

forms_valid(form, inlines)[source]

If the form and formsets are valid, save the associated models.

get_context_data(**kwargs)[source]

Insert the form into the context dict.

get_form_kwargs()[source]

Return the keyword arguments for instantiating the form.

get_success_url()[source]

Return the URL to redirect to after processing a valid form.

model

alias of Letter

class feder.monitorings.views.MonitoringAssignView(**kwargs)[source]
Parameters:

url_namemonitorings:assign

get_context_data(**kwargs)[source]

Get the context for this view.

get_filterset_kwargs(filterset_class)[source]

Returns the keyword arguments for instantiating the filterset.

get_queryset()[source]

Return the list of items for this view.

The return value must be an iterable and may be an instance of QuerySet in which case QuerySet specific behavior will be enabled.

model

alias of Institution

class feder.monitorings.views.MonitoringAutocomplete(**kwargs)[source]
Parameters:

url_namemonitorings:autocomplete

get_queryset()[source]

Filter the queryset with GET[‘q’].

class feder.monitorings.views.MonitoringCasesAjaxDatatableView(**kwargs)[source]

View to provide table list of all Monitoring Cases with ajax data.

Parameters:

url_namemonitorings:monitoring_cases_table_ajax_data

get_latest_by(request)[source]

Override to customize based of request.

Provides the name of the column to be used for global date range filtering. Return either ‘’, a fieldname or None.

When None is returned, in model’s Meta ‘get_latest_by’ attributed will be used.

model

alias of Case

class feder.monitorings.views.MonitoringCasesTableView(**kwargs)[source]

View for displaying template with table of Monitoring Cases.

Parameters:

url_namemonitorings:monitoring_cases_table

get_context_data(*args, **kwargs)[source]

Get the context for this view.

model

alias of Monitoring

class feder.monitorings.views.MonitoringChatView(**kwargs)[source]
get_context_data(**kwargs)[source]

Insert the single object into the context dict.

get_queryset()[source]

Return the QuerySet that will be used to look up the object.

This method is called by the default implementation of get_object() and may not be called if get_object() is overridden.

model

alias of Monitoring

class feder.monitorings.views.MonitoringCreateView(**kwargs)[source]
Parameters:

url_namemonitorings:create

form_class

alias of MonitoringForm

form_valid(form)[source]

If the form is valid, save the associated model.

model

alias of Monitoring

class feder.monitorings.views.MonitoringDeleteView(*args, **kwargs)[source]
Parameters:

url_namemonitorings:delete

model

alias of Monitoring

class feder.monitorings.views.MonitoringDetailView(**kwargs)[source]
Parameters:
  • url_namemonitorings:details

  • url_namemonitorings:details

get_context_data(**kwargs)[source]

Insert the single object into the context dict.

get_object_list(obj)[source]

A method to return object list to additional list. This should be overriden.

Parameters:

obj – The object the view is displaying.

Returns:

A list of object to paginated

Return type:

QuerySet

Raises:

ImproperlyConfigured – The method was not overrided.

get_queryset()[source]

Return the QuerySet that will be used to look up the object.

This method is called by the default implementation of get_object() and may not be called if get_object() is overridden.

model

alias of Monitoring

class feder.monitorings.views.MonitoringListView(**kwargs)[source]
Parameters:

url_namemonitorings:list

get_queryset()[source]

Return the list of items for this view.

The return value must be an iterable and may be an instance of QuerySet in which case QuerySet specific behavior will be enabled.

model

alias of Monitoring

class feder.monitorings.views.MonitoringPermissionView(**kwargs)[source]
Parameters:

url_namemonitorings:perm

get_context_data(**kwargs)[source]

Insert the single object into the context dict.

model

alias of Monitoring

class feder.monitorings.views.MonitoringReportView(**kwargs)[source]
Parameters:
  • url_namemonitorings:report

  • url_namemonitorings:report

get_context_data(**kwargs)[source]

Get the context for this view.

get_queryset()[source]

Return the list of items for this view.

The return value must be an iterable and may be an instance of QuerySet in which case QuerySet specific behavior will be enabled.

get_template_names()[source]

Return a list of template names to be used for the request. Must return a list. May not be called if render_to_response is overridden.

model

alias of Case

class feder.monitorings.views.MonitoringResponsesReportView(**kwargs)[source]
Parameters:

url_namemonitorings:responses_report

class feder.monitorings.views.MonitoringResultsUpdateView(**kwargs)[source]
Parameters:

url_namemonitorings:results_update

form_class

alias of MonitoringResultsForm

model

alias of Monitoring

class feder.monitorings.views.MonitoringResultsView(**kwargs)[source]
Parameters:

url_namemonitorings:results

get_context_data(**kwargs)[source]

Insert the single object into the context dict.

get_queryset()[source]

Return the QuerySet that will be used to look up the object.

This method is called by the default implementation of get_object() and may not be called if get_object() is overridden.

model

alias of Monitoring

class feder.monitorings.views.MonitoringTemplateView(**kwargs)[source]
Parameters:

url_namemonitorings:template

get_context_data(**kwargs)[source]

Insert the single object into the context dict.

get_queryset()[source]

Return the QuerySet that will be used to look up the object.

This method is called by the default implementation of get_object() and may not be called if get_object() is overridden.

model

alias of Monitoring

class feder.monitorings.views.MonitoringUpdatePermissionView(**kwargs)[source]
Parameters:

url_namemonitorings:perm-update

form_class

alias of SaveTranslatedUserObjectPermissionsForm

form_valid(form)[source]

If the form is valid, redirect to the supplied URL.

get_context_data(**kwargs)[source]

Insert the form into the context dict.

get_form_kwargs()[source]

Return the keyword arguments for instantiating the form.

class feder.monitorings.views.MonitoringUpdateView(**kwargs)[source]
Parameters:

url_namemonitorings:update

form_class

alias of MonitoringForm

form_valid(form)[source]

Call the super first, so that when overriding get_form_valid_message, we have access to the newly saved object.

model

alias of Monitoring

class feder.monitorings.views.MonitoringsAjaxDatatableView(**kwargs)[source]

View to provide table list of all Monitorings with ajax data.

Parameters:

url_namemonitorings:monitorings_table_ajax_data

model

alias of Monitoring

class feder.monitorings.views.MonitoringsTableView(**kwargs)[source]

View for displaying template with Monitorings table.

Parameters:

url_namemonitorings:table

class feder.monitorings.views.MultiCaseTagManagement(**kwargs)[source]
Parameters:

url_namemonitoring-case-tags-update

class feder.monitorings.views.PermissionWizard(**kwargs)[source]
Parameters:

url_namemonitorings:perm-add

done(form_list, form_dict, *args, **kwargs)[source]

This method must be overridden by a subclass to process to form data after processing all steps.

get_context_data(*args, **kwargs)[source]

Returns the template context for a step. You can overwrite this method to add more data for all or some steps. This method returns a dictionary containing the rendered form step. Available template context variables are:

  • all extra data stored in the storage backend

  • wizard - a dictionary representation of the wizard instance

Example:

class MyWizard(WizardView):
    def get_context_data(self, form, **kwargs):
        context = super().get_context_data(form=form, **kwargs)
        if self.steps.current == 'my_step_name':
            context.update({'another_var': True})
        return context
get_form_kwargs(step=None)[source]

Returns the keyword arguments for instantiating the form (or formset) on the given step.

class feder.monitorings.views.UserMonitoringAutocomplete(**kwargs)[source]
Parameters:

url_namemonitorings:autocomplete_user

get_queryset()[source]

Filter the queryset with GET[‘q’].