def add_columns(self): """Adds bhp-specific olumns in the listing """ bhp_columns = { # Participant ID "getParticipantID": { "title": _("Participant ID"), "index": "getParticipantID", "sortable": True, "toggle": True, "after": "getClientSampleID" }, # Visit Number "getVisit": { "title": _("Visit Code"), "attr": "getVisit", "sortable": False, "toggle": True, "after": "getParticipantID" } } # Add the columns rv_keys = map(lambda r: r["id"], self.listing.review_states) for column_id, column_values in bhp_columns.items(): utils.add_column(listing=self.listing, column_id=column_id, column_values=column_values, after=column_values["after"], review_states=rv_keys)
def add_stored_review_state(self): """Adds the "stored" review state to the listing's review_states pool """ # Columns to hide hide = ["getAnalysesNum", "getDateVerified", "getDatePreserved", "getDatePublished", "getDueDate", "getStorageLocation", "Printed" "Progress", "SamplingDate",] columns = filter(lambda c: c not in hide, self.listing.columns.keys()) # Custom transitions print_stickers = { "id": "print_stickers", "title": _("Print stickers"), "url": "workflow_action?action=print_stickers" } # "stored" review state stored = { "id": "stored", "title": _("Stored"), "contentFilter": { "review_state": ("stored",), "sort_on": "created", "sort_order": "descending", }, "transitions": [], "custom_transitions": [print_stickers], "columns": columns, } # Add the review state utils.add_review_state(self.listing, stored, after="published") # Add the column "DateStored" to "stored" review_state column_values = { "title": _("Date stored"), "index": "getDateStored", "toggle": True} utils.add_column(self.listing, "getDateStored", column_values, after="getDateReceived", review_states=("stored",)) # Add Samples Container column, but only if the current user logged in # is not a client contact if not api.get_current_client(): column_values = { "title": _("Storage"), "attr": "getSamplesContainerID", "replace_url": "getSamplesContainerURL", "toggle": True } utils.add_column(self.listing, "getSamplesContainer", column_values, after="getDateStored", review_states=("stored", ))
def add_columns(self): """Adds health-specific columns in the listing """ health_columns = collections.OrderedDict(( ("getPatientID", { "title": _("Patient ID"), "toggle": True, "after": "ClientBatchID", }), ("getClientPatientID", { "title": _("Client PID"), "toggle": True, "after": "getPatientID", }), ("Patient", { "title": _("Patient"), "toggle": True, "index": "getPatientTitle", "after": "getClientPatientID", }), ("Doctor", { "title": _("Doctor"), "toggle": True, "index": "getDoctorTitle", "after": "Patient", }), ("OnsetDate", { "title": _("Onset Date"), "toggle": True, "after": "Patient", }), ("PatientAgeOnsetDate", { "title": _("Patient Age"), "sortable": False, "after": "OnsetDate", }), )) # Add the columns rv_keys = map(lambda r: r["id"], self.listing.review_states) for column_id, column_values in health_columns.items(): utils.add_column(listing=self.listing, column_id=column_id, column_values=column_values, after=column_values["after"], review_states=rv_keys)
def before_render(self): # Add stored review state print_stickers = { "id": "print_stickers", "title": _("Print stickers"), "url": "workflow_action?action=print_stickers" } base_column_ids = self.listing.columns.keys() hide = ["getDateVerified", "getDatePublished"] columns = filter(lambda col: col not in hide, base_column_ids) stored = { "id": "stored", "title": _("Stored"), "contentFilter": { "review_state": ("stored",), "sort_on": "created", "sort_order": "descending", }, "transitions": [], "custom_transitions": [print_stickers], "columns": columns, } utils.add_review_state(self.listing, stored, after="published") # Add the column Date Stored to the "stored" review state column_values = { "title": _("Date stored"), "index": "getDateStored", "attr": "getId", "toggle": True} utils.add_column(self.listing, "getDateStored", column_values, after="getDateReceived", review_states=("stored",)) # Add Samples Container column, but only if the current user logged in # is not a client contact if not api.get_current_client(): column_values = { "title": _("Storage"), "attr": "getSamplesContainerID", "replace_url": "getSamplesContainerURL", "toggle": True } utils.add_column(self.listing, "getSamplesContainer", column_values, after="getDateStored", review_states=("stored", ))
def add_columns(self): """Adds bhp-specific columns in the listing """ bhp_columns = { # Referral Laboratory "ReferralLab": { "title": _("Referral Lab"), "index": "getReferralLabUID", "sortable": False, "toggle": True, "ajax": True, "after": "retested" }, } # Add the columns rv_keys = map(lambda r: r["id"], self.listing.review_states) for column_id, column_values in bhp_columns.items(): utils.add_column(listing=self.listing, column_id=column_id, column_values=column_values, after=column_values["after"], review_states=rv_keys)
def add_columns(self): """Adds health-specific columns in the listing """ is_client_context = self.is_client_context() health_columns = collections.OrderedDict(( ("getPatientID", { "title": _("Patient ID"), "toggle": is_client_context, "after": "ClientBatchID", }), ("getClientPatientID", { "title": _("Client PID"), "toggle": is_client_context, "after": "getPatientID", }), ("Patient", { "title": _("Patient"), "toggle": is_client_context, "index": "getPatientTitle", "after": "getClientPatientID", }), ("Doctor", { "title": _("Doctor"), "toggle": True, "index": "getDoctorTitle", "after": "Patient", }), ("OnsetDate", { "title": _("Onset Date"), "toggle": True, "after": "Patient", }), )) # Add the columns rv_keys = map(lambda r: r["id"], self.listing.review_states) for column_id, column_values in health_columns.items(): utils.add_column(listing=self.listing, column_id=column_id, column_values=column_values, after=column_values["after"], review_states=rv_keys)