<commit_before>-- This fixes the badly nested geometry that's in the shapefiles

select substring(supplemental_id, 3, 3) as county , st_union(geom) into temp_county from redistricting_geounit where geolevel_id = 3 group by county;

update redistricting_geounit set geom = st_multi(st_union), simple = ST_MULTI(ST_SIMPLIFY(st_union, 10)) from temp_county where temp_county.county = supplemental_id;

select substring(supplemental_id, 0, 12) || '.0' as tract , st_union(geom) into temp_tracts from redistricting_geounit where geolevel_id = 3 group by tract;

update redistricting_geounit set geom = st_multi(st_union), simple = ST_MULTI(ST_SIMPLIFY(st_union, 10)) from temp_tracts where temp_tracts.tract = supplemental_id;

drop table temp_county;
drop table temp_tracts;<commit_msg>Used ST_SIMPLIFYPRESERVETOPOLOGY, instead of ST_SIMPLIFY<commit_after>-- This fixes the badly nested geometry that's in the shapefiles

select substring(supplemental_id, 3, 3) as county , st_union(geom) into temp_county from redistricting_geounit where geolevel_id = 3 group by county;

update redistricting_geounit set geom = st_multi(st_union), simple = ST_MULTI(ST_SIMPLIFYPRESERVETOPOLOGY(st_union, 10)) from temp_county where temp_county.county = supplemental_id;

select substring(supplemental_id, 0, 12) || '.0' as tract , st_union(geom) into temp_tracts from redistricting_geounit where geolevel_id = 3 group by tract;

update redistricting_geounit set geom = st_multi(st_union), simple = ST_MULTI(ST_SIMPLIFYPRESERVETOPOLOGY(st_union, 10)) from temp_tracts where temp_tracts.tract = supplemental_id;

drop table temp_county;
drop table temp_tracts;
{'fraction_non_alphanumeric': 0.0701647345942648, 'fraction_numerical': 0.01464307504575961, 'mean_word_length': 7.159203980099503, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1314071', 'n_tokens_mistral': 600, 'n_tokens_neox': 536, 'n_words': 159}