WEEK 9: ENTRY 2

 Today at my internship, I worked on merging the two data outputs I got from Elasticsearch API and Big query API calls I made. Basically, both these chunks of data have metadata of the hostnames and the hostnames itself. So too, they are in all byte format and thus I would have to change their format before being able to merge them together. As I have worked previously with converting bytes into a human readable form, I would think that it would be easier with me this time around. However, it was the total opposite because my case total was not only to convert the data format, but also to merge them. 


So what did it pan out? I was successful in making it work, but it took me longer and more difficult to implement the logic. Prior to my implementation, I wrote a pseudocode to make it easier to follow. The logic I created was to unmarshall these two data into structs so that I can access the common hostnames in each struct, check if they are the same. And when they are alike, I would merge the metadata of the hostnames including the hostnames and convert it into a json format. The first struct, say struck A, was already unmarshalled, so it was straightforward to access the hostname. Therefore, I was left with the second struct, say struck B. Having tried using the same logic of unmarshalling I used for struck A, I tried it on struck B but it was failing with some errors. Again, I had to track where the error was happening with some print statements. After inserting a couple of print statements, I did find out that I needed to unmarshall the data twice. But why? Well, unlike the data of struck A, struck B’s data was in an interface format. Thus, I searched how to do that conversion, and as usual stackoverflow did it for me again. 


The answer I found on Stackoverflow was exactly what I needed. I basically had to marshal the interface type data into a string before unmarshalling into struck B. I must say that my google searches were accurate enough and thus I did not struggle to resolve the issue. I have gained the understanding that most answers are there on the internet. It is just a matter of can you ask the correct question. In today’s experience, I have also gained the insight that because an approach worked for a similar issue, it doesn’t necessarily mean that it would work for another similar issue. In the future, I intend to apply a similar accuracy on my google searches. So too, I would look into how my data type is different before applying similar approaches.


Comments

Popular posts from this blog

WEEK 4: ENTRY 3

WEEK 6: ENTRY 3

WEEK 7: ENTRY 1