Ali2206 commited on
Commit
af77abb
·
verified ·
1 Parent(s): 91ded52

Update api/routes/patients.py

Browse files
Files changed (1) hide show
  1. api/routes/patients.py +5 -1
api/routes/patients.py CHANGED
@@ -59,9 +59,13 @@ async def process_synthea_patient(bundle: dict, file_path: str) -> Optional[dict
59
  name = resource.get('name', [{}])[0]
60
  address = resource.get('address', [{}])[0]
61
 
 
 
 
 
62
  patient_data = {
63
  'fhir_id': resource.get('id'),
64
- 'full_name': f"{' '.join(name.get('given', ['']))} {name.get('family', '')}".strip(),
65
  'gender': resource.get('gender', 'unknown'),
66
  'date_of_birth': resource.get('birthDate', ''),
67
  'address': ' '.join(address.get('line', [''])),
 
59
  name = resource.get('name', [{}])[0]
60
  address = resource.get('address', [{}])[0]
61
 
62
+ # Construct full name and remove numbers
63
+ raw_full_name = f"{' '.join(name.get('given', ['']))} {name.get('family', '')}".strip()
64
+ clean_full_name = re.sub(r'\d+', '', raw_full_name).strip()
65
+
66
  patient_data = {
67
  'fhir_id': resource.get('id'),
68
+ 'full_name': clean_full_name,
69
  'gender': resource.get('gender', 'unknown'),
70
  'date_of_birth': resource.get('birthDate', ''),
71
  'address': ' '.join(address.get('line', [''])),