original_docstring: 
      Parses G.h-format case data from raw API data.
      
docstring: Parses G.h-format case data from raw API data.
docstring_tokens: Parses G . h - format case data from raw API data .
code: def parse_cases(raw_data_file: str, source_id: str, source_url: str, last_date: str = None, manual_import: bool = False):
      """
      Parses G.h-format case data from raw API data.
      """
      with open(raw_data_file, "r") as f:
          reader = csv.DictReader(f, delimiter=",")
          for row in reader:
              confirmation_date = convert_date(row[_DATE_CONFIRMED], manual_import)
              if (
                  manual_import and last_date and confirmation_date and
                  confirmation_date["$date"] >= last_date
              ):
                  print(f"Skipping too recent case, on or after {last_date}")
                  continue
              if row[_CONFIRMED] == "Laboratory-confirmed case" and confirmation_date is not None:
                  try:
                      case = {
                          "caseReference": {"sourceId": source_id, "sourceUrl": source_url},
                          "location": {
                              "country": "United States",
                              "geoResolution": "Country",
                              "name": "United States",
                              "geometry": {
                                  "latitude": 37.0902,
                                  "longitude": -95.7129
                              }
                          },
                          "events": convert_events(
                              row[_DATE_CONFIRMED],
                              row[_DATE_SYMPTOMS],
                              row[_HOSPITALIZED],
                              row[_ICU],
                              row[_DEATH],
                              manual_import
                          ),
                          "symptoms": convert_symptoms(row[_DATE_SYMPTOMS]),
                          "demographics": convert_demographics(
                              row[_GENDER], row[_AGE], row[_ETHNICITY]
                          ),
                          "preexistingConditions": convert_preexisting_conditions(
                              row[_COMORBIDITIES]
                          )
                      }
                      yield case
                  except ValueError as ve:
                      raise ValueError(f"error converting case: {ve}")
code_tokens: def parse_cases ( raw_data_file : str , source_id : str , source_url : str , last_date : str = None , manual_import : bool = False ) : with open ( raw_data_file , "r" ) as f : reader = csv . DictReader ( f , delimiter = "," ) for row in reader : confirmation_date = convert_date ( row [ _DATE_CONFIRMED ] , manual_import ) if ( manual_import and last_date and confirmation_date and confirmation_date [ "$date" ] >= last_date ) : print ( f"Skipping too recent case, on or after {last_date}" ) continue if row [ _CONFIRMED ] == "Laboratory-confirmed case" and confirmation_date is not None : try : case = { "caseReference" : { "sourceId" : source_id , "sourceUrl" : source_url } , "location" : { "country" : "United States" , "geoResolution" : "Country" , "name" : "United States" , "geometry" : { "latitude" : 37.0902 , "longitude" : - 95.7129 } } , "events" : convert_events ( row [ _DATE_CONFIRMED ] , row [ _DATE_SYMPTOMS ] , row [ _HOSPITALIZED ] , row [ _ICU ] , row [ _DEATH ] , manual_import ) , "symptoms" : convert_symptoms ( row [ _DATE_SYMPTOMS ] ) , "demographics" : convert_demographics ( row [ _GENDER ] , row [ _AGE ] , row [ _ETHNICITY ] ) , "preexistingConditions" : convert_preexisting_conditions ( row [ _COMORBIDITIES ] ) } yield case except ValueError as ve : raise ValueError ( f"error converting case: {ve}" )
short_docstring: Parses G.h-format case data from raw API data.
short_docstring_tokens: Parses G . h - format case data from raw API data .
comment: """
      Parses G.h-format case data from raw API data.
      """