Fuzzy Logic numpy in Django

42 views Asked by At

I'm making website for web survey project. I have fuzzy logic python program and I want to try it to implement it to Django, but I don't know how to connect it to django. This is my model, though

models.py

    from django.db import models
    from django.contrib.auth.models import User

    class Kuisioner(models.Model):
        judul = models.CharField(max_length=255)
        alias = models.SlugField(max_length=255, unique=True)

        class Meta:
            ordering = ['judul']
    
        def __str__(self):
            return self.judul

    class Pertanyaan(models.Model):
        kuisioner = models.ForeignKey(Kuisioner, 
                    related_name='pertanyaans', on_delete=models.CASCADE)
        pertanyaan = models.CharField(max_length=255)
        created = models.DateTimeField(auto_now_add=True)

        class Meta:
            ordering = ['-created']

        def __str__(self):
            return self.pertanyaan

    class Jawaban(models.Model):
        pertanyaan = models.ForeignKey(Pertanyaan,
                     related_name='jawabans', 
                     on_delete=models.CASCADE)
        user = models.ForeignKey(User, on_delete=models.CASCADE)
        jawab = models.PositiveIntegerField()

    class Hasil(models.Model):
        # m1 = mdd, m2 = sad, m3 = ptsd, m4 = gad, m5 = pa, m6 = bipo
        user = models.ForeignKey(User, on_delete=models.CASCADE)
        m1 = models.FloatField()
        m2 = models.FloatField()
        m3 = models.FloatField()
        m4 = models.FloatField()
        m5 = models.FloatField()
        m6 = models.FloatField()
        file = models.FileField(upload_to='users/% Y/% m/% d/', blank=True)

I want to gain jawaban (answer) as the input of fuzzy logic. I've planned to having 16 inputs and 8 outputs like this :

(example of one of the outputs)

Q1 = A1
Q2 = A2

Input1 = A1
Input2 = A2
Output1 = If Input1 and Input2

Q is same as pertanyaan and A is same as jawab

Is there anything that I have to prepare like models, views, urls, etc? I'm still beginner towards Django. Help will be appreciated, thanks

I tried many times, though, but failed

0

There are 0 answers