Please do not write anything more than what is required, and do not add any other
components that are not needed. The coding challenge is meant to be short and
showcase your level of coding skills.
Developer Coding Challenge For R-321
In this coding challenge, we would like the candidate to showcase their coding skills and knowledge. Please provide your feedback on this test after completing it (included in the upload link).
Please do not write anything more than what is required, and do not add any other components that are not needed. The coding challenge is meant to be short and showcase your level of coding skills.
A.The Backend Task:
Write a system that stores and validates the following components:
2. Protein Sequences
The first 3 components require storing the user who created them, the date they were created and the date they were last modified.
The “notification” component only requires the date it was created and a text message field in addition to the user being notified.
In addition to the fields above, the “Protein Sequences” component will store the amino acids sequence, and its corresponding DNA sequence, both of these fields can be very long strings, up to 10 thousand characters (see below examples of amino acids and DNA sequences).
Also, the DNA field should always have 3 times as many characters as the number of characters of the protein amino acids sequence field. Both the protein amino acids sequence and DNA sequence fields are required.
The “Document” component should have a text field for its content, but we must filter out HTML elements from its content to avoid XSS attacks. There should be a simple function for this which you will need to write.
The “Comment” component should also contain a text field for its content and should be protected from XSS attacks, and most importantly the “Comment” component should save which entity it belongs to, which is now a “Protein Sequences” or a “Document”, but it should also be very easy to modify the code to add other components in the future.
The “Notification” component should point to an entity (Comment, Protein Sequence, or Document) and contains the notification type which can be one of -Link, Static, or System- (It should also be very easy to modify the code to add more types in the future).
Link notifications should contain a link, and all notifications should contain a message and a basic icon name string field.
The requirement is to write classes for these entities, and we want validation over them to happen automatically when we simply call Django’s full_clean() function over objects of these models.
Please pay close attention to writing the code for these models as concisely as possible. Use multiple inheritance wherever possible. Try not to repeat fields and to name variables with clear names. Comment only on complex code segments or unclear model fields.
Create 1 or 2 dummy data objects from these models in order to test your syntax and validation.
The only requirement for this code is these classes, their autogenerated migrations, and the main function that instantiates objects from them and simulates different input configurations to show how correct the code is.
B. The Frontend Task
Subclass the provided class (BaseControl) and use it to build 4 simple components:
1. Input Field
2. Dropdown Menu
4. Text Label (simple text content not editable by users)
These components must be generic, and should not care about the logic happening in the rest of this task, but only have means in them to achieve it and any similar behavior.
You need to create another subclass of (BaseControl), that instantiates objects of these components, and links them to have the following behavior:
When a value is entered in the input, and the button is clicked, that value is added to the dropdown menu, but must not be repeated (case sensitive), also show the last input as a status message in the text label, for example:
“This value was added”
“This value already exists”
“Dropdown changed to value”
Where value is the input of the user.
Achieve this task using the provided class, and link the components using the event system. You can not call a function of component B from some code in component A directly. You can only let component A ask component B -using event system- to run some action and then component B will do the required action upon receiving the event message.
You can use composition to create new components. However, again, use only the event system to let composed components interact with each other. The job of higher level components then is only to instantiate and to link the composed components.
The Base Control class, has code for defining, accessing, and initializing HTML elements and other controls, it also has 2 methods for its event system, and a few life cycle methods (initUI, show, and remove).
Attached to the class is an example file of code subclassing BaseControl. If the code in the Base Control is not clear enough, please ask for help.
Here is an example of protein amino acid sequence and its corresponding DNA sequence:
FVWSVLITAVLLLLSLPVLAAGITMLLTDRNLNTTFFDPAGGGDPVLYQHLFWFF GHPEVYILIL DNA Sequence: