Skip to content
Snippets Groups Projects
Commit 033e089a authored by Josef Hardi's avatar Josef Hardi
Browse files

refactor(optum): enable event occurrence to be configurable

parent 4de83243
No related branches found
No related tags found
No related merge requests found
......@@ -217,12 +217,7 @@ class Optum:
AND t2.index_date <= t1.observation_period_end_date
) AS t3
INNER JOIN (
SELECT
t0.*
FROM
condition_occurrence AS t0
WHERE
t0.condition_source_value in ({condition_valueset})
{event_occurrence}
) AS t4
ON t3.person_id = t4.person_id
AND t3.claim_id = t4.claim_id"""
......@@ -305,24 +300,22 @@ class Optum:
"""
"""
entry_criteria_sql = ""
event_occurrence_sql = ""
for k, v in entry_criteria.items():
if k == 'condition':
entry_criteria_sql = textwrap.dedent(
self._ENTRY_CRITERIA.format(
person_module=self._PERSON,
person_claims_module=self._PERSON_CLAIMS,
condition_occurrence_module=self._CONDITION_OCCURRENCE,
zipcode_valueset=",".join(str(z) for z in zips),
condition_valueset=",".join(f'"{x}"' for x in self._CONDITIONS[v]['codes'])))
condition_valueset=",".join(f'"{x}"' for x in self._CONDITIONS[v]['codes'])
event_occurrence_sql = f'SELECT t0.*\nFROM condition_occurrence AS t0\nWHERE t0.condition_source_value in ({condition_valueset})'
elif k == 'conditionCodes':
entry_criteria_sql = textwrap.dedent(
self._ENTRY_CRITERIA.format(
person_module=self._PERSON,
person_claims_module=self._PERSON_CLAIMS,
condition_occurrence_module=self._CONDITION_OCCURRENCE,
zipcode_valueset=",".join(str(z) for z in zips),
condition_valueset=",".join(f'"{x}"' for x in v)))
condition_valueset=",".join(f'"{x}"' for x in v)
event_occurrence_sql = f'SELECT t0.*\nFROM condition_occurrence AS t0\nWHERE t0.condition_source_value in ({condition_valueset})'
entry_criteria_sql = textwrap.dedent(
self._ENTRY_CRITERIA.format(
person_module=self._PERSON,
person_claims_module=self._PERSON_CLAIMS,
condition_occurrence_module=self._CONDITION_OCCURRENCE,
zipcode_valueset=",".join(str(z) for z in zips),
event_occurrence=event_occurrence_sql))
inclusion_criteria_sql = ""
if inclusion_criteria:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment