<commit_before>PARAMETERS ( SPECIES VARCHAR, SEARCH_COLUMN_NAME VARCHAR )
SELECT
  po.date,
  po.performedby,
  po.outcome,
  po.infantid,
  po.project,
  po.remark
FROM pregnancy_outcomes po
WHERE po.pregnancyid = (SELECT p.lsid
                        FROM pregnancies p
                        WHERE p.objectid = PARENT_RECORD_ID
                        LIMIT 1)
ORDER BY po.date DESC<commit_msg>used to query table to automatically determine estimated gestation day based on ultrasound measurements<commit_after>PARAMETERS ( SPECIES VARCHAR, SEARCH_COLUMN_NAME VARCHAR , SEARCH_VALUE FLOAT)

SELECT gestational_day
FROM wnprc.gestational_days
WHERE species = SPECIES
ORDER BY
  CASE
  WHEN SEARCH_COLUMN_NAME = 'beats_per_minute' THEN abs(SEARCH_VALUE - beats_per_minute)
  WHEN SEARCH_COLUMN_NAME = 'crown_rump_mm' THEN abs(SEARCH_VALUE - crown_rump_mm)
  WHEN SEARCH_COLUMN_NAME = 'head_circumference_mm' THEN abs(SEARCH_VALUE - head_circumference_mm)
  WHEN SEARCH_COLUMN_NAME = 'femur_length_mm' THEN abs(SEARCH_VALUE - femur_length_mm)
  WHEN SEARCH_COLUMN_NAME = 'biparietal_diameter_mm' THEN abs(SEARCH_VALUE - biparietal_diameter_mm)
  ELSE -1
END ASC
LIMIT 1
{'fraction_non_alphanumeric': 0.05550811272416738, 'fraction_numerical': 0.0025619128949615714, 'mean_word_length': 4.117903930131004, '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': '5996660', 'n_tokens_mistral': 424, 'n_tokens_neox': 400, 'n_words': 96}