<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Nigel Marungu on Medium]]></title>
        <description><![CDATA[Stories by Nigel Marungu on Medium]]></description>
        <link>https://medium.com/@nigelmarungu?source=rss-f7b0a640c9a6------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*7tuAmBY2bnYdTLGf46wzCA.jpeg</url>
            <title>Stories by Nigel Marungu on Medium</title>
            <link>https://medium.com/@nigelmarungu?source=rss-f7b0a640c9a6------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 18:25:36 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@nigelmarungu/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Ownership In Rust Programs]]></title>
            <link>https://medium.com/@nigelmarungu/ownership-in-rust-programs-23156febae94?source=rss-f7b0a640c9a6------2</link>
            <guid isPermaLink="false">https://medium.com/p/23156febae94</guid>
            <category><![CDATA[programming-languages]]></category>
            <category><![CDATA[rust]]></category>
            <category><![CDATA[code-newbie]]></category>
            <dc:creator><![CDATA[Nigel Marungu]]></dc:creator>
            <pubDate>Thu, 24 Oct 2024 18:05:21 GMT</pubDate>
            <atom:updated>2024-10-24T18:08:03.721Z</atom:updated>
            <content:encoded><![CDATA[<p>My journey programming in Rust started not so long ago and has been quite the learning experience but what i choose to write about has been the most intriguing to me</p><h3>Key Concepts of Ownership in Rust:</h3><h4>1. Ownership Basics:</h4><ul><li><strong>Ownership</strong> in Rust ensures that only one variable at a time can own a piece of memory. When that variable goes out of scope, Rust automatically frees the memory. This is done without a garbage collector, which makes Rust very memory-efficient.</li></ul><pre>fn main() {<br>    let s1 = String::from(&quot;hello&quot;); // s1 owns the heap-allocated string<br>    let s2 = s1; // Ownership of the string moves from s1 to s2<br><br>    // println!(&quot;{}&quot;, s1); // This would throw a compile-time error: s1 is no longer valid!<br>    println!(&quot;{}&quot;, s2); // s2 is now the owner, and we can use it<br>}</pre><h4>2. Move Semantics:</h4><ul><li>In Rust, when you assign one variable to another, the ownership of the data is <strong>moved</strong> rather than <strong>copied</strong> (unless the type implements the Copy trait, like simple integers).</li><li>Once a variable’s ownership is moved, the original variable becomes invalid and cannot be used anymore.</li></ul><pre>fn main() {<br>    let x = 5; // i32 is Copy<br>    let y = x; // x is copied to y, so both x and y are valid<br>    println!(&quot;x: {}, y: {}&quot;, x, y); // Both x and y can be used<br><br>    let s1 = String::from(&quot;hello&quot;);<br>    let s2 = s1; // Ownership of the String is moved to s2<br>    // println!(&quot;{}&quot;, s1); // This would cause an error because s1 is no longer valid<br>}</pre><h4>3. Borrowing:</h4><ul><li>Instead of moving ownership, you can <strong>borrow</strong> values using references. This allows you to use a value without taking ownership.</li></ul><pre>fn main() {<br>    let s1 = String::from(&quot;hello&quot;);<br><br>    // Pass a reference to s1 without transferring ownership<br>    let len = calculate_length(&amp;s1);<br>    println!(&quot;The length of &#39;{}&#39; is {}.&quot;, s1, len);<br>}<br><br>fn calculate_length(s: &amp;String) -&gt; usize {<br>    s.len() // Access the length of s without taking ownership<br>}</pre><h4>4. Mutable and Immutable References:</h4><ul><li>You can have <strong>immutable</strong> references, which allow multiple parts of your code to read from the same value.</li><li>You can have <strong>mutable</strong> references, but only one mutable reference to a particular value at a time.</li></ul><pre>fn main() {<br>    let mut s = String::from(&quot;hello&quot;);<br><br>    // Pass a mutable reference to s, allowing the function to modify it<br>    change(&amp;mut s);<br><br>    println!(&quot;The modified string is &#39;{}&#39;.&quot;, s);<br>}<br><br>fn change(s: &amp;mut String) {<br>    s.push_str(&quot;, world&quot;); // Modify the original string by appending &quot;, world&quot;<br>}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=23156febae94" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating The Carelink Official Landing Page .]]></title>
            <link>https://medium.com/@nigelmarungu/creating-the-carelink-official-landing-page-a10e7cee41ba?source=rss-f7b0a640c9a6------2</link>
            <guid isPermaLink="false">https://medium.com/p/a10e7cee41ba</guid>
            <dc:creator><![CDATA[Nigel Marungu]]></dc:creator>
            <pubDate>Sat, 05 Aug 2023 21:10:58 GMT</pubDate>
            <atom:updated>2023-08-26T12:04:22.062Z</atom:updated>
            <content:encoded><![CDATA[<h3>Creating The AfriCarelink Official Landing Page .</h3><p>The task at hand was to create the official website where we felt like could contain the information about our services.</p><p>We used the triple threat of HTML,CSS,JAVASCRIPT</p><p>here’s a snapshot of the design</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e8UfTN7Tadtvcx8kgSk8DQ.png" /></figure><p>link to the site : <a href="https://carelink-phi.vercel.app/">https://carelink-phi.vercel.app/</a></p><p>let’s take a look at what goes into building this magnificent website.</p><p>We’ll do analysis of the javascript :</p><pre>const showMenu = (toggleId, navId) =&gt;{<br>    const toggle = document.getElementById(toggleId),<br>    nav = document.getElementById(navId)<br>    <br>    // Validate that variables exist<br>    if(toggle &amp;&amp; nav){<br>        toggle.addEventListener(&#39;click&#39;, ()=&gt;{<br>            // We add the show-menu class to the div tag with the nav__menu class<br>            nav.classList.toggle(&#39;show-menu&#39;)<br>        })<br>    }<br>}<br>showMenu(&#39;nav-toggle&#39;,&#39;nav-menu&#39;)</pre><p>The above JavaScript code defines a function called `showMenu` that creates a mobile menu toggle for the website. It takes two parameters: `toggleId` and `navId`, representing the IDs of the toggle element and the navigation element, respectively.</p><p>The function retrieves references to the DOM elements with the specified IDs, validates their existence, and adds a click event listener to the toggle element. When the toggle element is clicked, the function toggles the presence of the CSS class ‘show-menu’ on the navigation element. This class is responsible for displaying or hiding the mobile menu using CSS styles.</p><pre>const navLink = document.querySelectorAll(&#39;.nav__link&#39;)<br><br>function linkAction(){<br>    const navMenu = document.getElementById(&#39;nav-menu&#39;)<br>    // When we click on each nav__link, we remove the show-menu class<br>    navMenu.classList.remove(&#39;show-menu&#39;)<br>}<br>navLink.forEach(n =&gt; n.addEventListener(&#39;click&#39;, linkAction))</pre><p>The JavaScript code above does the following:</p><p>1. It selects all elements with the class ‘nav__link’ and stores them in the `navLink` variable using `document.querySelectorAll(‘.nav__link’)`.</p><p>2. It defines the `linkAction` function, which is responsible for hiding the mobile menu when any of the links are clicked. The function finds the navigation menu with the ID ‘nav-menu’ using `document.getElementById(‘nav-menu’)`, and then removes the ‘show-menu’ class from it using `navMenu.classList.remove(‘show-menu’)`.</p><p>3. It adds a click event listener to each element with the class ‘nav__link’ using the `forEach` method. When any of the links are clicked, the `linkAction` function is executed, effectively hiding the mobile menu.</p><pre>const sections = document.querySelectorAll(&#39;section[id]&#39;)<br><br>function scrollActive(){<br>    const scrollY = window.pageYOffset<br><br>    sections.forEach(current =&gt;{<br>        const sectionHeight = current.offsetHeight<br>        const sectionTop = current.offsetTop - 50;<br>        sectionId = current.getAttribute(&#39;id&#39;)<br><br>        if(scrollY &gt; sectionTop &amp;&amp; scrollY &lt;= sectionTop + sectionHeight){<br>            document.querySelector(&#39;.nav__menu a[href*=&#39; + sectionId + &#39;]&#39;).classList.add(&#39;active-link&#39;)<br>        }else{<br>            document.querySelector(&#39;.nav__menu a[href*=&#39; + sectionId + &#39;]&#39;).classList.remove(&#39;active-link&#39;)<br>        }<br>    })<br>}<br>window.addEventListener(&#39;scroll&#39;, scrollActive)</pre><p>You happen to notice the smooth scrolling on our site ,well this is what causes that</p><p>The provided JavaScript code implements a scroll event listener that highlights the corresponding navigation link when its associated section is in the viewport. It is used to create a smooth scrolling effect and visually indicate the active section in the navigation menu.</p><p>Now onto what makes the site able to adjust between themes smoothly</p><pre>/*==================== DARK LIGHT THEME ====================*/ <br>const themeButton = document.getElementById(&#39;theme-button&#39;)<br>const darkTheme = &#39;dark-theme&#39;<br>const iconTheme = &#39;bx-sun&#39;<br><br>// Previously selected topic (if user selected)<br>const selectedTheme = localStorage.getItem(&#39;selected-theme&#39;)<br>const selectedIcon = localStorage.getItem(&#39;selected-icon&#39;)<br><br>// We obtain the current theme that the interface has by validating the dark-theme class<br>const getCurrentTheme = () =&gt; document.body.classList.contains(darkTheme) ? &#39;dark&#39; : &#39;light&#39;<br>const getCurrentIcon = () =&gt; themeButton.classList.contains(iconTheme) ? &#39;bx-moon&#39; : &#39;bx-sun&#39;<br><br>// We validate if the user previously chose a topic<br>if (selectedTheme) {<br>  // If the validation is fulfilled, we ask what the issue was to know if we activated or deactivated the dark<br>  document.body.classList[selectedTheme === &#39;dark&#39; ? &#39;add&#39; : &#39;remove&#39;](darkTheme)<br>  themeButton.classList[selectedIcon === &#39;bx-moon&#39; ? &#39;add&#39; : &#39;remove&#39;](iconTheme)<br>}<br><br>// Activate / deactivate the theme manually with the button<br>themeButton.addEventListener(&#39;click&#39;, () =&gt; {<br>    // Add or remove the dark / icon theme<br>    document.body.classList.toggle(darkTheme)<br>    themeButton.classList.toggle(iconTheme)<br>    // We save the theme and the current icon that the user chose<br>    localStorage.setItem(&#39;selected-theme&#39;, getCurrentTheme())<br>    localStorage.setItem(&#39;selected-icon&#39;, getCurrentIcon())<br>})</pre><p>The code begins with a comment that indicates it’s related to a dark-light theme switcher.</p><p>themeButton is assigned the reference to the HTML element with the ID “theme-button”. This element is likely the button that switches between dark and light themes.</p><p>darkTheme and iconTheme are constants representing the class names for the dark theme and the theme icon, respectively.</p><p>The script retrieves the previously selected theme and icon from the local storage using localStorage.getItem.</p><p>Two functions, getCurrentTheme and getCurrentIcon, are defined. These functions check the existence of certain classes on the body and the theme button to determine the current theme and icon, respectively.</p><p>The code checks if the user had previously selected a theme. If so, it adds or removes the dark-theme class on the body and the bx-sun or bx-moon class on the button, based on the saved values.</p><p>An event listener is set up on the themeButton element. When the button is clicked, the callback function inside the event listener is executed.</p><p>Inside the click event callback function, the dark-theme class is toggled on the body, and the bx-sun or bx-moon class is toggled on the button.</p><p>Finally, the user’s selected theme and icon are saved to local storage using localStorage.setItem to ensure that the chosen theme and icon persist across page reloads.</p><p>In summary, this script allows users to toggle between a dark and a light theme using a button. The user’s preference is stored in local storage to provide a consistent theme choice even after page refreshes or revisits.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a10e7cee41ba" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building an Interactive USSD application with Africa’s Talking and Google Maps API]]></title>
            <link>https://medium.com/@nigelmarungu/building-an-interactive-ussd-application-with-africas-talking-and-google-maps-api-56613ce88b99?source=rss-f7b0a640c9a6------2</link>
            <guid isPermaLink="false">https://medium.com/p/56613ce88b99</guid>
            <dc:creator><![CDATA[Nigel Marungu]]></dc:creator>
            <pubDate>Wed, 02 Aug 2023 20:58:58 GMT</pubDate>
            <atom:updated>2023-08-02T21:39:22.882Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*FWigRNZFjPFqFVnp" /></figure><p>Introduction:</p><p>I am responsible for contributing towards the hospital section of the application where This feature leverages location-based services to identify the user’s current location and display a list of nearby hospitals and clinics.</p><p>Users can access vital information about each facility, including contact details, address, and specialties, making it easier to find suitable healthcare services quickly.</p><p>Below is the folder structure of the application with highlight on the <strong><em>hospital.controller.js</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/578/0*cCJPN8rqDiUvtcpr" /></figure><p>Setting Up the Project:</p><p>To get started, create a new Node.js project and install the necessary dependencies, including ‘africastalking’ for user interactions and ‘maps_query’ for querying the Google Maps API. Make sure to set up Africa’s Talking API credentials and enable the Google Maps API for the project.</p><p>1. Importing Required Modules:</p><p>Let’s begin by importing the required modules:</p><p>```<br>const { menu } = require(‘../../../../config/africastalking’);<br>const { fetchHospitals, fetchPlaceDetails } = require(‘../../../../utils/maps_query’);<br>```</p><p>2. Creating the Entry Point State:</p><p>Next, we define the entry point state where users will begin interacting with the system:</p><p>```<br>menu.state(‘entry-point-to-hospitals-controller’, {<br> run: () =&gt; {<br> menu.con(‘Enter your location to continue’);<br> },<br> next: {<br> ‘*’: ‘hospitals-controller’,<br> },<br>});<br>```</p><p>3. The ‘hospitals-controller’ State Behavior:</p><p>In the ‘hospitals-controller’ state, we fetch nearby hospitals and display them to the user:</p><p>```<br>menu.state(‘hospitals-controller’, {<br> run: async () =&gt; {<br> const userLocation = menu.val;<br> const hospitals = await fetchHospitals(userLocation);</p><p>let responseMessage = ‘’;<br> const itemsToShow = 6; // Number of hospitals to show</p><p>for (let i = 0; i &lt; itemsToShow &amp;&amp; i &lt; hospitals.length; i++) {<br> responseMessage += `• ${hospitals[i].name}\n`;<br> }</p><p>menu.con(responseMessage);<br> },<br> next: {<br> ‘*’: ‘manipulate-results’,<br> },<br>});<br>```</p><p>4. The ‘manipulate-results’ State Behavior:</p><p>Once the user selects a hospital, the ‘manipulate-results’ state fetches and displays detailed information about the chosen hospital:</p><p>```<br>menu.state(‘manipulate-results’, {<br> run: async () =&gt; {<br> const hospitalDetails = await fetchPlaceDetails(menu.val);</p><p>console.log(‘hospitalDetails’, hospitalDetails);</p><p>menu.end(`Result for: ${menu.val}\n<br> Name: ${hospitalDetails.name}<br> Formatted address: ${hospitalDetails.formatted_address}<br> Rating: ${hospitalDetails.rating}<br> Status: ${hospitalDetails.business_status}<br> `);<br> },<br>});<br>```</p><p>5. Finalizing the User Interaction:</p><p>With the states defined, we can now run the menu and handle user interactions:</p><p>```<br>module.exports = async function ManualController(req, res) {<br> try {<br> menu.run(req.body, (ussdResult) =&gt; {<br> res.send(ussdResult);<br> });<br> } catch (error) {<br> console.error(error);<br> }<br>};<br>```</p><p>And with that users can now input their location, view nearby hospitals, and access detailed information about their selected hospital. This feature can be further enhanced and customized to include additional features, such as filtering hospitals by specialty or integrating with other healthcare services.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=56613ce88b99" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Revolutionising Healthcare Access: Introducing AfriCareLink Health Solutions.]]></title>
            <link>https://medium.com/@nigelmarungu/revolutionising-healthcare-access-introducing-africarelink-health-solutions-3fc36801cefe?source=rss-f7b0a640c9a6------2</link>
            <guid isPermaLink="false">https://medium.com/p/3fc36801cefe</guid>
            <category><![CDATA[healthcare]]></category>
            <dc:creator><![CDATA[Nigel Marungu]]></dc:creator>
            <pubDate>Wed, 26 Jul 2023 21:16:04 GMT</pubDate>
            <atom:updated>2023-07-26T21:21:59.614Z</atom:updated>
            <content:encoded><![CDATA[<h4><strong><em>About AfriCareLink</em></strong></h4><p>In the vast continent of Africa, where diverse cultures and landscapes meet, there lies a pressing need for accessible and quality healthcare services. The challenge of providing immediate medical attention to millions, spanning vast distances and remote regions, has been a hurdle that many have sought to overcome. Enter <strong><em>AfriCareLink </em></strong>— an ingenious fusion of cutting-edge technology and a passion for transforming lives.</p><p>This groundbreaking app emerges as a beacon of hope, bridging the gap between healthcare and technology, and ushering in a new era of wellness for the people of Africa.</p><p>Join us as we embark on a journey to revolutionise healthcare access, making it as effortless and empowering as the African spirit itself.</p><h4><em>Let’s take a look at the technology aspect of this innovative solution .</em></h4><p><strong><em>Introduction : </em></strong>An all-inclusive web app with USSD / SMS integration that solves the common user problems in africa by providing</p><ul><li>accessibility</li><li>ease of use</li><li>affordability</li></ul><h4><strong>Project Files.</strong></h4><p>Content of the repositories</p><p>a) API</p><ul><li>Authentication / Authorisation</li><li>Models — Doctors / Pharmacies / Hospitals / Patients / Health records / Appointments</li><li>Database — Relational SQL (MySQL) ie.</li></ul><figure><img alt="a demo of the relational database structure of the app" src="https://cdn-images-1.medium.com/max/1024/0*0cNjL90yKVmPLpyO" /></figure><ul><li>Google maps API integration</li><li>NHIF integration</li></ul><p>b) USSD</p><p>features</p><p><strong><em>Appointments</em></strong> :</p><p>This feature allows users to schedule medical appointments with healthcare providers directly through the app. Users can select their preferred date, time, and specialty, and the app will display available slots based on the user’s criteria. This feature streamlines the appointment booking process and ensures better time management for both patients and healthcare providers.</p><p><strong><em>Subscription(change language) :</em></strong></p><p>This feature offers users the option to change the app’s language to cater to their linguistic preferences. This is especially important in diverse regions like Africa, where multiple languages are spoken. Users can select their desired language, and the app’s interface will adapt accordingly, enhancing user experience and accessibility.</p><p><strong><em>SMS chat with doctors :</em></strong></p><p>This feature enables users to engage in real-time text-based conversations with healthcare professionals directly through SMS. Users can seek medical advice, ask questions, or discuss their health concerns with doctors conveniently, making healthcare consultations more accessible and user-friendly.</p><p><strong><em>SMS push notifications and reminders of set appointments :</em></strong></p><p>To improve patient compliance and reduce appointment no-shows, the app sends SMS push notifications and reminders to users about their scheduled appointments. These reminders serve as prompts and help users stay organised, leading to better patient-doctor communication and overall healthcare outcomes.</p><p><strong><em>Find a hospital near you :</em></strong></p><p>This feature leverages location-based services to identify the user’s current location and display a list of nearby hospitals and clinics. Users can access vital information about each facility, including contact details, address, and specialties, making it easier to find suitable healthcare services quickly.</p><p><strong><em>Emergency services — USSD + Call :</em></strong></p><p>In critical situations, this feature provides users with two options for seeking immediate medical assistance. Users can either dial the emergency number through the app, initiating a direct call, or use the USSD option to request emergency services quickly.</p><p><strong><em>Health tips — SMS (subscription) :</em></strong></p><p>This feature offers users a subscription-based service, where they receive informative health tips and wellness advice via SMS regularly. These health tips aim to promote healthy habits, preventive care, and general well-being among users.</p><p><strong><em>Medication reminders — SMS :</em></strong></p><p>This feature sends users SMS notifications to remind them to take their prescribed medications at the designated times. This feature is especially beneficial for patients with chronic conditions or complex medication regimens, ensuring adherence and better treatment outcomes.</p><p><strong><em>Medication refills — USSD :</em></strong></p><p>This feature simplifies the process of refilling prescriptions for users. Through the USSD option, users can request medication refills from their healthcare providers or authorised pharmacies conveniently, promoting medication adherence.</p><p><strong><em>Chatbot — consultation (GPT 3.5) :</em></strong></p><p>The app’s “Chatbot” feature utilises advanced artificial intelligence, such as GPT-3.5, to provide users with virtual consultation services. The chatbot can engage in interactive conversations, ask relevant health-related questions based on the user’s input (e.g., symptoms, age, gender), and offer initial medical guidance or triage before connecting users with healthcare professionals, if necessary.</p><p><strong><em>Quick consultation — gender, age, symptom :</em></strong></p><p>This feature allows users to provide essential information, such as gender, age, and symptoms, to initiate a rapid consultation process. This quick assessment can help users receive timely advice or relevant medical guidance before proceeding with a more detailed consultation.</p><p>In conclusion, this is a comprehensive and user-centric platform designed to enhance healthcare accessibility and convenience for users across Africa. By incorporating advanced technologies, location-based services, and interactive features, the app bridges the gap between patients and healthcare providers, improving healthcare outcomes and overall well-being in the region.</p><p>c) Folder structure</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/383/0*ueGA5bXz5h9z7cq3" /></figure><h4><strong>WireFrame Inspirations for our telemedicine application</strong></h4><p>This will give you an idea of what to expect of the product</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/0*Fam9ZeAePr5JbpA3" /><figcaption>sample 1</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*VrWzmzcT6oyVAtCJ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/752/0*P9OTI5v6sDyyUqtJ" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3fc36801cefe" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>