Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,962 changes: 1,236 additions & 726 deletions tests/test_metadata/synthea_graph.json

Large diffs are not rendered by default.

1,232 changes: 759 additions & 473 deletions tests/test_metadata/world_development_indicators_graph.json

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions tests/test_pipeline_custom_datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
patients
.WHERE((gender == 'F') & (ethnicity == 'italian'))
.conditions
.PARTITION(name='condition_groups', by=DESCRIPTION)
.CALCULATE(condition_description=DESCRIPTION, occurrence_count=COUNT(conditions))
.PARTITION(name='condition_groups', by=description)
.CALCULATE(condition_description=description, occurrence_count=COUNT(conditions))
.TOP_K(1, by=(occurrence_count.DESC(), condition_description.ASC()))
.CALCULATE(condition_description)
)
Expand All @@ -42,9 +42,9 @@
"""
result = (
world_development_indicators
.Country
.WHERE((IncomeGroup == 'Low income') & HAS(CountryNotes.WHERE(Series.SeriesCode == 'DT.DOD.DECT.CD')))
.CALCULATE(country_code=CountryCode)
.country
.WHERE((incomegroup == 'Low income') & HAS(countrynotes.WHERE(series.seriescode == 'DT.DOD.DECT.CD')))
.CALCULATE(country_code=countrycode)
)
""",
"world_development_indicators",
Expand Down Expand Up @@ -92,11 +92,11 @@
"""
result = (
world_development_indicators
.Country
.WHERE(ShortName == 'Albania')
.Footnotes
.WHERE(Year == 'YR2012')
.CALCULATE(footnote_description=Description)
.country
.WHERE(shortname == 'Albania')
.footnotes
.WHERE(year_ == 'YR2012')
.CALCULATE(footnote_description=description)
)
""",
"world_development_indicators",
Expand Down
2 changes: 1 addition & 1 deletion tests/test_plan_refsols/synthea_most_common_conditions.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ROOT(columns=[('condition_description', DESCRIPTION)], orderings=[(n_rows):desc_last, (DESCRIPTION):asc_first], limit=1:numeric)
AGGREGATE(keys={'DESCRIPTION': DESCRIPTION}, aggregations={'n_rows': COUNT()})
JOIN(condition=t0.patient == t1.PATIENT, type=INNER, cardinality=PLURAL_ACCESS, reverse_cardinality=SINGULAR_FILTER, columns={'DESCRIPTION': t1.DESCRIPTION})
JOIN(condition=t0.patient == t1.PATIENT, type=INNER, cardinality=PLURAL_FILTER, reverse_cardinality=SINGULAR_FILTER, columns={'DESCRIPTION': t1.DESCRIPTION})
FILTER(condition=ethnicity == 'italian':string & gender == 'F':string, columns={'patient': patient})
SCAN(table=synthea.patients, columns={'ethnicity': ethnicity, 'gender': gender, 'patient': patient})
SCAN(table=synthea.conditions, columns={'DESCRIPTION': DESCRIPTION, 'PATIENT': PATIENT})
4 changes: 2 additions & 2 deletions tests/test_plan_refsols/wdi_albania_footnotes_1978.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ ROOT(columns=[('footnote_description', Description)], orderings=[])
JOIN(condition=t0.CountryCode == t1.Countrycode, type=INNER, cardinality=PLURAL_FILTER, reverse_cardinality=SINGULAR_FILTER, columns={'Description': t1.Description})
FILTER(condition=ShortName == 'Albania':string, columns={'CountryCode': CountryCode})
SCAN(table=wdi.Country, columns={'CountryCode': CountryCode, 'ShortName': ShortName})
FILTER(condition=Year == 'YR2012':string, columns={'Countrycode': Countrycode, 'Description': Description})
SCAN(table=wdi.Footnotes, columns={'Countrycode': Countrycode, 'Description': Description, 'Year': Year})
FILTER(condition="Year" == 'YR2012':string, columns={'Countrycode': Countrycode, 'Description': Description})
SCAN(table=wdi.Footnotes, columns={'"Year"': "Year", 'Countrycode': Countrycode, 'Description': Description})
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ ROOT(columns=[('country_code', CountryCode)], orderings=[])
JOIN(condition=t0.CountryCode == t1.Countrycode, type=SEMI, columns={'CountryCode': t0.CountryCode})
FILTER(condition=IncomeGroup == 'Low income':string, columns={'CountryCode': CountryCode})
SCAN(table=wdi.Country, columns={'CountryCode': CountryCode, 'IncomeGroup': IncomeGroup})
JOIN(condition=t0.Seriescode == t1.SeriesCode, type=INNER, cardinality=SINGULAR_FILTER, reverse_cardinality=PLURAL_ACCESS, columns={'Countrycode': t0.Countrycode})
JOIN(condition=t0.Seriescode == t1.SeriesCode, type=INNER, cardinality=SINGULAR_FILTER, reverse_cardinality=PLURAL_FILTER, columns={'Countrycode': t0.Countrycode})
SCAN(table=wdi.CountryNotes, columns={'Countrycode': Countrycode, 'Seriescode': Seriescode})
FILTER(condition=SeriesCode == 'DT.DOD.DECT.CD':string, columns={'SeriesCode': SeriesCode})
SCAN(table=wdi.Series, columns={'SeriesCode': SeriesCode})
2 changes: 1 addition & 1 deletion tests/test_sql_refsols/wdi_albania_footnotes_1978_ansi.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ SELECT
footnotes.description AS footnote_description
FROM wdi.country AS country
JOIN wdi.footnotes AS footnotes
ON country.countrycode = footnotes.countrycode AND footnotes.year = 'YR2012'
ON country.countrycode = footnotes.countrycode AND footnotes."Year" = 'YR2012'
WHERE
country.shortname = 'Albania'
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ SELECT
Footnotes.description AS footnote_description
FROM wdi.Country AS Country
JOIN wdi.Footnotes AS Footnotes
ON Country.countrycode = Footnotes.countrycode AND Footnotes.year = 'YR2012'
ON Country.countrycode = Footnotes.countrycode AND Footnotes.`Year` = 'YR2012'
WHERE
Country.shortname = 'Albania'
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ SELECT
footnotes.description AS footnote_description
FROM wdi.country AS country
JOIN wdi.footnotes AS footnotes
ON country.countrycode = footnotes.countrycode AND footnotes.year = 'YR2012'
ON country.countrycode = footnotes.countrycode AND footnotes."Year" = 'YR2012'
WHERE
country.shortname = 'Albania'
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ SELECT
footnotes.description AS footnote_description
FROM wdi.country AS country
JOIN wdi.footnotes AS footnotes
ON country.countrycode = footnotes.countrycode AND footnotes.year = 'YR2012'
ON country.countrycode = footnotes.countrycode AND footnotes."Year" = 'YR2012'
WHERE
country.shortname = 'Albania'
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ SELECT
footnotes.description AS footnote_description
FROM wdi.country AS country
JOIN wdi.footnotes AS footnotes
ON country.countrycode = footnotes.countrycode AND footnotes.year = 'YR2012'
ON country.countrycode = footnotes.countrycode AND footnotes."year" = 'YR2012'
WHERE
country.shortname = 'Albania'