Skip to content

Commit 817fbf6

Browse files
committed
Got batch review working with Postman
1 parent afa0267 commit 817fbf6

File tree

6 files changed

+40
-6
lines changed

6 files changed

+40
-6
lines changed

frontend/webpack.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ module.exports = {
5757
externals: {
5858
// global app config object
5959
config: JSON.stringify({
60-
apiUrl: 'https://api.parserx.io'
60+
//apiUrl: 'https://api.parserx.io'
6161
//apiUrl: 'http://139.144.27.208'
62-
//apiUrl: 'http://192.168.1.20:8005'
62+
apiUrl: 'http://192.168.1.20:8003'
6363
//apiUrl: 'http://192.168.1.14:8005'
6464
})
6565
}

parsers/sig.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ class SigParser(Parser):
2323
'additional_info': additional_info.parsers,
2424
}
2525
# TODO: make this match_keys assignment more elegant
26-
#match_keys = ['original_sig_text'] + ['sig_text', 'sig_readable'] + method.parsers[0].match_keys + dose.parsers[0].match_keys + strength.parsers[0].match_keys + route.parsers[0].match_keys + frequency.parsers[0].match_keys + when.parsers[0].match_keys + duration.parsers[0].match_keys + indication.parsers[0].match_keys + max.parsers[0].match_keys + additional_info.parsers[0].match_keys
27-
match_keys = ['original_sig_text'] + ['sig_text', 'sig_readable', 'max_dose_per_day'] + method.parsers[0].match_keys + dose.parsers[0].match_keys + strength.parsers[0].match_keys + route.parsers[0].match_keys + frequency.parsers[0].match_keys + when.parsers[0].match_keys + duration.parsers[0].match_keys + indication.parsers[0].match_keys + max.parsers[0].match_keys + additional_info.parsers[0].match_keys
26+
#match_keys = ['original_sig_text'] + ['sig_text', 'sig_readable', 'max_dose_per_day'] + method.parsers[0].match_keys + dose.parsers[0].match_keys + strength.parsers[0].match_keys + route.parsers[0].match_keys + frequency.parsers[0].match_keys + when.parsers[0].match_keys + duration.parsers[0].match_keys + indication.parsers[0].match_keys + max.parsers[0].match_keys + additional_info.parsers[0].match_keys
27+
match_keys = ['sig_text', 'sig_readable', 'max_dose_per_day'] + method.parsers[0].match_keys + dose.parsers[0].match_keys + strength.parsers[0].match_keys + route.parsers[0].match_keys + frequency.parsers[0].match_keys + when.parsers[0].match_keys + duration.parsers[0].match_keys + indication.parsers[0].match_keys + max.parsers[0].match_keys + additional_info.parsers[0].match_keys
2828
parser_type = 'sig'
2929

3030
def get_normalized_sig_text(self, sig_text):
@@ -267,7 +267,7 @@ def print_progress_bar (iteration, total, prefix = 'progress:', suffix = 'comple
267267
print()
268268

269269
#print(SigParser().infer(ndc='68788640709'))
270-
parsed_sigs = SigParser().parse_sig_csv()
270+
#parsed_sigs = SigParser().parse_sig_csv()
271271
#SigParser().parse('TAKE 1 CAPSULE BY MOUTH IN THE MORNING AND 1 CAPSULE AT NOON AND 1 CAPSULE IN THE EVENING AND 1 CAPSULE BEFORE BEDTIME')
272272
#parsed_sigs = SigParser().parse_validate_sig_csv()
273273
#print(parsed_sigs)
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Generated by Django 3.2.9 on 2022-12-14 05:41
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('sig', '0021_alter_sigparsed_indication_text'),
10+
]
11+
12+
operations = [
13+
migrations.AddField(
14+
model_name='sigreviewed',
15+
name='sig_corrected',
16+
field=models.TextField(null=True),
17+
),
18+
]

sig/models.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@ class SigReviewed(models.Model):
122122
created = models.DateTimeField(auto_now_add=True)
123123
# overall sig correct
124124
sig_correct = models.BooleanField(null=True)
125+
# in the case of automatic feedback, the corrected sig from the user
126+
sig_corrected = models.TextField(null=True)
125127
# status of individual sig components if overall sig not correct
126128
method_status = models.CharField(choices=STATUS_CHOICES, null=True, max_length=10)
127129
dose_status = models.CharField(choices=STATUS_CHOICES, null=True, max_length=10)

sig/serializers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class SigReviewedSerializer(serializers.ModelSerializer):
1111
class Meta:
1212
# NOTE: this is how we only show reviews that were completed by the currently logged in user
1313
model = SigReviewed
14-
fields = ['id', 'created', 'sig_parsed', 'owner', 'sig_correct', 'method_status', 'dose_status', 'strength_status', 'route_status', 'frequency_status', 'duration_status', 'indication_status', 'themes', 'notes']
14+
fields = ['id', 'created', 'sig_parsed', 'owner', 'sig_correct', 'sig_corrected', 'method_status', 'dose_status', 'strength_status', 'route_status', 'frequency_status', 'duration_status', 'indication_status', 'themes', 'notes']
1515

1616
class SigParsedSerializer(serializers.ModelSerializer):
1717
sig_reviewed = SigReviewedSerializer(many=True, read_only=True)

sig/views.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,20 @@ class SigReviewedViewSet(viewsets.ModelViewSet):
195195
serializer_class = SigReviewedSerializer
196196
permission_classes = [IsAdminUser, IsOwnerOrReadOnly]
197197

198+
def create(self, request, *args, **kwargs):
199+
data = request.data
200+
many = isinstance(data, list)
201+
print (data, many)
202+
serializer = self.get_serializer(data=data, many=many)
203+
serializer.is_valid(raise_exception=True)
204+
self.perform_create(serializer)
205+
headers = self.get_success_headers(serializer.data)
206+
return Response(
207+
serializer.data,
208+
status=status.HTTP_201_CREATED,
209+
headers=headers
210+
)
211+
198212
class UserViewSet(viewsets.ReadOnlyModelViewSet):
199213
"""
200214
This viewset automatically provides `list` and `detail` actions.

0 commit comments

Comments
 (0)