meta-edc 0.3.37__py3-none-any.whl → 0.3.39__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. meta_analytics/__init__.py +0 -2
  2. meta_analytics/dataframes/__init__.py +1 -0
  3. meta_analytics/dataframes/get_last_imp_visits_df.py +101 -0
  4. meta_auth/auth_objects.py +1 -0
  5. meta_consent/consents.py +6 -0
  6. meta_consent/locale/lg/LC_MESSAGES/django.po +69 -0
  7. meta_consent/locale/sw/LC_MESSAGES/django.po +12 -12
  8. meta_dashboard/locale/lg/LC_MESSAGES/django.po +30 -0
  9. meta_dashboard/locale/sw/LC_MESSAGES/django.po +11 -2
  10. meta_dashboard/navbars.py +2 -0
  11. meta_dashboard/tests/urls.py +0 -1
  12. meta_dashboard/view_utils/subject_screening_button.py +2 -2
  13. meta_edc/__init__.py +3 -10
  14. meta_edc/{celery/debug.py → celery.py} +2 -2
  15. meta_edc/navbars.py +2 -0
  16. meta_edc/settings/debug.py +4 -0
  17. meta_edc/settings/defaults.py +29 -16
  18. meta_edc/templates/meta_edc/bootstrap3/home.html +1 -1
  19. meta_edc/urls.py +1 -0
  20. {meta_edc-0.3.37.dist-info → meta_edc-0.3.39.dist-info}/METADATA +6 -6
  21. {meta_edc-0.3.37.dist-info → meta_edc-0.3.39.dist-info}/RECORD +72 -61
  22. {meta_edc-0.3.37.dist-info → meta_edc-0.3.39.dist-info}/WHEEL +1 -1
  23. meta_pharmacy/admin/__init__.py +0 -1
  24. meta_pharmacy/admin/actions.py +38 -0
  25. meta_pharmacy/admin_site.py +5 -1
  26. meta_pharmacy/apps.py +2 -0
  27. meta_pharmacy/forms/__init__.py +2 -0
  28. meta_pharmacy/forms/rx_form.py +16 -0
  29. meta_pharmacy/{forms.py → forms/substitutions_form.py} +1 -14
  30. meta_pharmacy/label_configs.py +30 -0
  31. meta_pharmacy/labels/__init__.py +3 -1
  32. meta_pharmacy/labels/draw_label_for_subject_with_barcode.py +58 -0
  33. meta_pharmacy/labels/draw_label_for_subject_with_code128.py +14 -0
  34. meta_pharmacy/labels/draw_label_with_test_data.py +26 -0
  35. meta_pharmacy/labels/label_data.py +14 -0
  36. meta_pharmacy/labels/print_sheets.py +22 -11
  37. meta_pharmacy/list_data.py +8 -0
  38. meta_pharmacy/management/commands/__init__.py +0 -0
  39. meta_pharmacy/management/commands/update_initial_pharmacy_data.py +10 -0
  40. meta_pharmacy/migrations/0002_initial.py +7 -5
  41. meta_pharmacy/migrations/0008_remove_lotnumber_medication_and_more.py +390 -0
  42. meta_pharmacy/migrations/0009_remove_historicalrx_slug.py +17 -0
  43. meta_pharmacy/models/__init__.py +1 -2
  44. meta_pharmacy/models/label_data.py +38 -0
  45. meta_pharmacy/models/{label.py → rx_label.py} +8 -19
  46. meta_pharmacy/utils/__init__.py +1 -0
  47. meta_pharmacy/utils/update_initial_pharmacy_data.py +146 -0
  48. meta_prn/admin/pregnancy_notification_admin.py +6 -2
  49. meta_reports/admin/__init__.py +1 -0
  50. meta_reports/admin/dbviews/glucose_summary_admin.py +1 -1
  51. meta_reports/admin/endpoints_admin.py +1 -1
  52. meta_reports/admin/last_imp_refill_admin.py +181 -0
  53. meta_reports/admin/modeladmin_mixins.py +3 -3
  54. meta_reports/migrations/0052_lastimpvisit.py +57 -0
  55. meta_reports/migrations/0053_rename_lastimpvisit_lastimprefill_and_more.py +31 -0
  56. meta_reports/models/__init__.py +1 -0
  57. meta_reports/models/last_imp_refill.py +34 -0
  58. meta_subject/admin/study_medication_admin.py +10 -0
  59. meta_subject/forms/study_medication_form.py +35 -0
  60. meta_subject/locale/lg/LC_MESSAGES/django.po +470 -0
  61. meta_subject/locale/sw/LC_MESSAGES/django.po +191 -89
  62. meta_subject/metadata_rules/predicates.py +34 -7
  63. meta_subject/migrations/0214_historicalstudymedication_stock_codes_and_more.py +44 -0
  64. meta_subject/migrations/0215_alter_historicalstudymedication_stock_codes_and_more.py +46 -0
  65. meta_subject/tests/tests/test_mnsi.py +180 -113
  66. meta_visit_schedule/visit_schedules/phase_three/crfs.py +18 -6
  67. tests/test_settings.py +4 -1
  68. meta_edc/celery/__init__.py +0 -2
  69. meta_edc/celery/live.py +0 -17
  70. meta_edc/celery/uat.py +0 -17
  71. meta_pharmacy/admin/lot_number_admin.py +0 -43
  72. meta_pharmacy/labels/get_label_data.py +0 -30
  73. meta_pharmacy/models/lot_number.py +0 -25
  74. meta_reports/models/unmanaged/README +0 -14
  75. meta_reports/models/unmanaged/patient_history_missing_baseline_cd4.py +0 -26
  76. meta_reports/models/unmanaged/patient_history_missing_baseline_cd4.sql +0 -10
  77. meta_reports/models/unmanaged/unattended_three_in_row.py +0 -24
  78. meta_reports/models/unmanaged/unattended_three_in_row.sql +0 -19
  79. meta_reports/models/unmanaged/unattended_three_in_row2.py +0 -24
  80. meta_reports/models/unmanaged/unattended_three_in_row2.sql +0 -39
  81. meta_reports/models/unmanaged/unattended_two_in_row.py +0 -22
  82. meta_reports/models/unmanaged/unattended_two_in_row.sql +0 -19
  83. {meta_reports/models/unmanaged → meta_edc/migrations}/__init__.py +0 -0
  84. {meta_edc-0.3.37.dist-info → meta_edc-0.3.39.dist-info}/AUTHORS +0 -0
  85. {meta_edc-0.3.37.dist-info → meta_edc-0.3.39.dist-info}/LICENSE +0 -0
  86. {meta_edc-0.3.37.dist-info → meta_edc-0.3.39.dist-info}/top_level.txt +0 -0
  87. /meta_pharmacy/{admin/label_admin.py → management/__init__.py} +0 -0
@@ -1,43 +0,0 @@
1
- from django.contrib import admin
2
- from django_audit_fields import audit_fieldset_tuple
3
- from edc_model_admin.dashboard import ModelAdminSubjectDashboardMixin
4
-
5
- from ..admin_site import meta_pharmacy_admin
6
- from ..models import LotNumber
7
-
8
-
9
- @admin.register(LotNumber, site=meta_pharmacy_admin)
10
- class LotNumberAdmin(ModelAdminSubjectDashboardMixin, admin.ModelAdmin):
11
- """Admin class for proxy model of edc_pharmacy.Rx"""
12
-
13
- show_object_tools = True
14
-
15
- # form = LotNumberForm
16
-
17
- fieldsets = (
18
- (
19
- None,
20
- {
21
- "fields": (
22
- "lot_no",
23
- "expiration_date",
24
- "allocation",
25
- "qty",
26
- )
27
- },
28
- ),
29
- audit_fieldset_tuple,
30
- )
31
-
32
- list_display = (
33
- "lot_no",
34
- "expiration_date",
35
- )
36
-
37
- radio_fields = {"allocation": admin.VERTICAL}
38
-
39
- list_filter = ("allocation",)
40
-
41
- search_fields = [
42
- "lot_no",
43
- ]
@@ -1,30 +0,0 @@
1
- from django.core.exceptions import ObjectDoesNotExist
2
- from tqdm import tqdm
3
-
4
- from meta_consent.models import SubjectConsent
5
- from meta_rando.models import RandomizationList
6
-
7
- from ..models import Label, LotNumber, Rx
8
-
9
-
10
- class InvalidLotNumber(Exception):
11
- pass
12
-
13
-
14
- def get_label_data(lot_no, max_labels: int | None = None) -> list[Label]:
15
- try:
16
- lot_no = LotNumber.objects.get(lot_no=lot_no)
17
- except ObjectDoesNotExist:
18
- raise ObjectDoesNotExist("The lot number given is invalid")
19
- else:
20
- labels = []
21
- qs = SubjectConsent.objects.values("subject_identifier", "site_id", "gender").all()
22
- for obj in tqdm(qs, total=qs.count()):
23
- if max_labels and len(labels) >= max_labels:
24
- break
25
- rando = RandomizationList.objects.get(subject_identifier=obj["subject_identifier"])
26
- if rando.assignment != lot_no.allocation:
27
- continue
28
- rx = Rx.objects.get(subject_identifier=obj["subject_identifier"])
29
- labels.append(Label.objects.create(rx=rx, lot_no=lot_no))
30
- return labels
@@ -1,25 +0,0 @@
1
- from django.db import models
2
- from edc_model.models import BaseUuidModel
3
- from edc_pharmacy.models import Medication
4
- from edc_randomization.constants import ACTIVE, PLACEBO
5
-
6
-
7
- class LotNumber(BaseUuidModel):
8
-
9
- lot_no = models.CharField(max_length=25, unique=True)
10
-
11
- medication = models.ForeignKey(
12
- Medication, on_delete=models.PROTECT, null=True, blank=False
13
- )
14
-
15
- allocation = models.CharField(
16
- max_length=25, choices=((ACTIVE, "Active"), (PLACEBO, "Placebo"))
17
- )
18
-
19
- expiration_date = models.DateField()
20
-
21
- qty = models.IntegerField(null=True)
22
-
23
- class Meta(BaseUuidModel.Meta):
24
- verbose_name = "Lot Number"
25
- verbose_name_plural = "Lot Numbers"
@@ -1,14 +0,0 @@
1
- The models in this folder represent VIEWS in the DB. Since the VIEWS
2
- are created separately, the model classes are "unmanaged". Unmanaged
3
- models do not trigger migrations that change the schema. However,
4
- a change to any of these model classes will trigger a migration, but
5
- the migration does to change the schema.
6
-
7
- Each model class has a corresponding SQL file. A migration has been
8
- created to run the ``CREATE VIEW`` commands using the
9
- ``migrations.RunSQL`` method.
10
-
11
- If you change the ``CREATE VIEW`` command, you have to generate a
12
- new empty migration which calls ``migrations.RunSQL`` to re-run the
13
- modified ``CREATE VIEW`` SQL command.
14
- (remember to ``DROP VIEW`` first.)
@@ -1,26 +0,0 @@
1
- from django.db import models
2
- from edc_qareports.model_mixins import QaReportModelMixin, qa_reports_permissions
3
-
4
-
5
- class PatientHistoryMissingBaselineCd4(QaReportModelMixin, models.Model):
6
-
7
- visit_code = models.CharField(max_length=25)
8
-
9
- visit_code_sequence = models.IntegerField()
10
-
11
- cd4 = models.IntegerField(verbose_name="Last CD4")
12
-
13
- cd4_date = models.DateField(verbose_name="Date of last CD4")
14
-
15
- user_created = models.CharField(max_length=25)
16
-
17
- user_modified = models.CharField(max_length=25)
18
-
19
- modified = models.DateTimeField()
20
-
21
- class Meta:
22
- verbose_name = "Patient History: Missing Baseline Cd4"
23
- verbose_name_plural = "Missing Baseline Cd4"
24
- managed = False
25
- db_table = "patient_history_missing_baseline_cd4_view"
26
- default_permissions = qa_reports_permissions
@@ -1,10 +0,0 @@
1
- create view patient_history_missing_baseline_cd4_view as
2
- select *, uuid() as 'id', now() as created, 'meta_reports.patienthistorymissingbaselinecd4' as report_model from (
3
- select subject_identifier, v.visit_code, v.visit_code_sequence,cd4,
4
- cd4_date, crf.site_id, crf.user_created, crf.user_modified,
5
- crf.modified
6
- from meta_subject_patienthistory as crf
7
- left join meta_subject_subjectvisit as v on crf.subject_visit_id=v.id
8
- where cd4 is null or cd4_date is null
9
- ) as A
10
- order by subject_identifier;
@@ -1,24 +0,0 @@
1
- from django.db import models
2
- from edc_qareports.model_mixins import QaReportModelMixin, qa_reports_permissions
3
-
4
-
5
- class UnattendedThreeInRow(QaReportModelMixin, models.Model):
6
-
7
- appt_datetime = models.DateTimeField()
8
-
9
- first = models.CharField(max_length=25)
10
-
11
- second = models.CharField(max_length=25)
12
-
13
- third = models.CharField(max_length=25)
14
-
15
- interval_days = models.IntegerField()
16
-
17
- from_now_days = models.IntegerField()
18
-
19
- class Meta:
20
- managed = False
21
- db_table = "unattended_three_in_row_view"
22
- verbose_name = "R100: Unattended appointments: Three in a row"
23
- verbose_name_plural = "R100: Unattended appointments: Three in a row"
24
- default_permissions = qa_reports_permissions
@@ -1,19 +0,0 @@
1
- create view unattended_three_in_row_view as (
2
- select *, uuid() as 'id', now() as created, 'meta_reports.unattendedthreeinrow' as report_model from (
3
- select `subject_identifier`, `site_id`, `appt_datetime`, `first`, `second`, `third`,
4
- datediff(`third_date`, `first_date`) as 'interval_days',
5
- datediff(now(), `first_date`) as 'from_now_days'
6
- from (
7
- select `subject_identifier`,`site_id`,`appt_datetime`,
8
- FIRST_VALUE(`visit_code`) OVER w as 'first',
9
- NTH_VALUE(`visit_code`, 2) OVER w as 'second',
10
- NTH_VALUE(`visit_code`, 3) OVER w as 'third',
11
- FIRST_VALUE(`appt_datetime`) OVER w as 'first_date',
12
- NTH_VALUE(`appt_datetime`, 3) OVER w as 'third_date'
13
- from edc_appointment_appointment where `visit_code_sequence`=0 and `appt_status`='New'
14
- and `appt_datetime` <= now()
15
- WINDOW w as (PARTITION BY `subject_identifier` order by `appt_datetime` ROWS UNBOUNDED PRECEDING)
16
- ) as A
17
- where `second` is not null and `third` is not null
18
- ) as B
19
- order by `site_id`, `from_now_days` desc);
@@ -1,24 +0,0 @@
1
- from django.db import models
2
- from edc_qareports.model_mixins import QaReportModelMixin, qa_reports_permissions
3
-
4
-
5
- class UnattendedThreeInRow2(QaReportModelMixin, models.Model):
6
-
7
- first = models.CharField(max_length=25)
8
-
9
- second = models.CharField(max_length=25)
10
-
11
- third = models.CharField(max_length=25)
12
-
13
- interval_days = models.IntegerField()
14
-
15
- from_now_days = models.IntegerField()
16
-
17
- missed_count = models.IntegerField()
18
-
19
- class Meta:
20
- managed = False
21
- db_table = "unattended_three_in_row2_view"
22
- verbose_name = "R110: Unattended appointments: Three in a row (with missed)"
23
- verbose_name_plural = "R110: Unattended appointments: Three in a row (with missed)"
24
- default_permissions = qa_reports_permissions
@@ -1,39 +0,0 @@
1
- create view unattended_three_in_row2_view as (
2
- with appointments as (
3
- select `subject_identifier`, `site_id`, `visit_code`, `visit_code_sequence`, `appt_datetime`,
4
- case when `appt_timing`='missed' then 'New' else `appt_status` end as 'appt_status',
5
- case when `appt_timing`='missed' then 1 else 0 end as 'missed'
6
- from edc_appointment_appointment
7
- where `visit_code_sequence`=0 and appt_datetime<=now()
8
- order by subject_identifier, appt_datetime
9
- )
10
- select *, uuid() as 'id', now() as 'created', 'meta_reports.unattendedthreeinrow2' as report_model from (
11
- select distinct `subject_identifier`, `site_id`, `first`, `second`, `third`,
12
- datediff(`third_date`, `first_date`) as 'interval_days',
13
- datediff(now(), `first_date`) as 'from_now_days',
14
- `first_status`, `second_status`, `third_status`, sum(`missed`) as `missed_count`
15
- from (
16
- select `subject_identifier`,`site_id`,`appt_datetime`, `missed`,
17
- FIRST_VALUE(`appt_status`) OVER w as 'third_status',
18
- NTH_VALUE(`appt_status`, 2) OVER w as 'second_status',
19
- NTH_VALUE(`appt_status`, 3) OVER w as 'first_status',
20
- FIRST_VALUE(`visit_code`) OVER w as 'third',
21
- NTH_VALUE(`visit_code`, 2) OVER w as 'second',
22
- NTH_VALUE(`visit_code`, 3) OVER w as 'first',
23
- FIRST_VALUE(`appt_datetime`) OVER w as 'third_date',
24
- NTH_VALUE(`appt_datetime`, 2) OVER w as 'second_date',
25
- NTH_VALUE(`appt_datetime`, 3) OVER w as 'first_date'
26
- from appointments
27
- WINDOW w as (PARTITION BY `subject_identifier` order by `appt_datetime` desc ROWS UNBOUNDED PRECEDING)
28
- ) as A
29
- where `second` is not null and `third` is not null
30
- and `first_status`='New'
31
- and `second_status`='New'
32
- and `third_status`='New'
33
- group by `subject_identifier`, `site_id`, `first`, `second`, `third`,
34
- datediff(`third_date`, `first_date`),
35
- datediff(now(), `first_date`),
36
- `first_status`, `second_status`, `third_status`
37
- order by `subject_identifier`, `site_id`
38
- ) as B
39
- );
@@ -1,22 +0,0 @@
1
- from django.db import models
2
- from edc_qareports.model_mixins import QaReportModelMixin, qa_reports_permissions
3
-
4
-
5
- class UnattendedTwoInRow(QaReportModelMixin, models.Model):
6
-
7
- appt_datetime = models.DateTimeField()
8
-
9
- first = models.CharField(max_length=25)
10
-
11
- second = models.CharField(max_length=25)
12
-
13
- interval_days = models.IntegerField()
14
-
15
- from_now_days = models.IntegerField()
16
-
17
- class Meta:
18
- managed = False
19
- db_table = "unattended_two_in_row_view"
20
- verbose_name = "R120: Unattended appointments: Two in a row"
21
- verbose_name_plural = "R120: Unattended appointments: Two in a row"
22
- default_permissions = qa_reports_permissions
@@ -1,19 +0,0 @@
1
- create view unattended_two_in_row_view as (
2
- select *, uuid() as 'id', now() as 'created', 'meta_reports.unattendedtwoinrow' as report_model from (
3
- select `subject_identifier`, `site_id`, `appt_datetime`, `first`, `second`,
4
- datediff(`second_date`, `first_date`) as 'interval_days',
5
- datediff(now(), `first_date`) as 'from_now_days'
6
- from (
7
- select `subject_identifier`,`site_id`,`appt_datetime`,
8
- FIRST_VALUE(`visit_code`) OVER w as 'first',
9
- NTH_VALUE(`visit_code`, 2) OVER w as 'second',
10
- NTH_VALUE(`visit_code`, 3) OVER w as 'third',
11
- FIRST_VALUE(`appt_datetime`) OVER w as 'first_date',
12
- NTH_VALUE(`appt_datetime`, 2) OVER w as 'second_date'
13
- from edc_appointment_appointment where `visit_code_sequence`=0 and `appt_status`='New'
14
- and `appt_datetime` <= now()
15
- WINDOW w as (PARTITION BY `subject_identifier` order by `appt_datetime` ROWS UNBOUNDED PRECEDING)
16
- ) as A1
17
- where `second` is not null and `third` is null
18
- ) as A2
19
- order by `site_id`, `from_now_days` desc);