Skip to content

Commit

Permalink
add documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
mkangia authored and kaapstorm committed Aug 20, 2024
1 parent 6eb2a7a commit 6f81f95
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions corehq/motech/generic_inbound/backend/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ def _get_validation_error(self, status_code, message, errors):


def _execute_generic_api(domain, couch_user, device_id, context, configurable_api):
# context is all data returned in structure corehq.motech.generic_inbound.utils.get_evaluation_context
_apply_api_filter(configurable_api, context)
_validate_api_request(configurable_api, context)

Expand Down Expand Up @@ -122,6 +123,7 @@ def _apply_api_filter(api, eval_context):
if not api_filter:
return False

# root_doc here is the all data available as in corehq.motech.generic_inbound.utils.get_evaluation_context
if not api_filter(eval_context.root_doc, eval_context):
raise GenericInboundRequestFiltered()

Expand Down
5 changes: 5 additions & 0 deletions corehq/motech/generic_inbound/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,15 @@ class ConfigurableAPI(models.Model):
updated_on = models.DateTimeField(auto_now=True)
name = models.CharField(max_length=255)
description = models.TextField(blank=True, null=True)
# UCR Expression to filter incoming/outgoing requests
# before they are processed/sent
filter_expression = models.ForeignKey(
UCRExpression, on_delete=models.PROTECT, related_name="api_filter", null=True, blank=True)
# UCR Expression to transform the data to be processed/sent
# from the original data received/to be sent
transform_expression = models.ForeignKey(
UCRExpression, on_delete=models.PROTECT, related_name="api_expression")
# type of data backend like JSON, HL7 etc
backend = models.CharField(max_length=100, default=ApiBackendOptions.json)

objects = AuditingManager()
Expand Down

0 comments on commit 6f81f95

Please sign in to comment.