From 61abf9c1e3fc63f08719f72244065a37403df5c0 Mon Sep 17 00:00:00 2001 From: thiagotrabach Date: Fri, 1 Sep 2023 07:06:22 -0300 Subject: [PATCH] chore pretty print --- run.py | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/run.py b/run.py index 4a7701b..2fa55a2 100644 --- a/run.py +++ b/run.py @@ -1,8 +1,12 @@ from fhir_utils.utils import json_to_dict from fhir_utils.fhir.patient.parsers import fhir_to_dict from fhir_utils.fhir.patient.resource import Patient -from fhir_utils.fhir.merge import compare_resources, merge_resource +from fhir_utils.fhir.merge import compare_resources from dataclasses import replace, is_dataclass +import pprint + + +pp = pprint.PrettyPrinter(indent=4) patient_json = json_to_dict("/home/thiagotrabach/tmp/patient_sample.json") patient_json2 = json_to_dict("/home/thiagotrabach/tmp/patient_sample2.json") @@ -15,22 +19,28 @@ gabriela = Patient(name = patient["name"], cpf = patient["identifiers"]["tax"], birth_date = patient["birth_date"], + birth_country = "B", source ="vitai", mother = patient["mother"], father = patient["father"], - gender = "macho") + gender = patient["gender"]) gabriela2 = Patient(name = patient2["name"], cpf = patient2["identifiers"]["tax"], birth_date = patient2["birth_date"], + birth_country = "B", father = "Deus", source ="vitai" , - gender = patient2["gender"]) + gender = patient2["gender"], + deceased = True, + active = False) -print(compare_resources(gabriela, gabriela2)) +#print(compare_resources(gabriela, gabriela2)) +pp.pprint(gabriela.compare(gabriela2)) print() -print(gabriela) +abc = gabriela.merge(gabriela2, force_invalid_merge=True) +pp.pprint(abc) +#print(gabriela) #print(replace(gabriela2, name = "Thiago", birth_date = "1988-01-18")) #print(is_dataclass(gabriela)) -