Skip to content

Instantly share code, notes, and snippets.

@disusered
Last active July 16, 2024 21:02
Show Gist options
  • Save disusered/675128c0506ec0f8a78fb84fe3a5656c to your computer and use it in GitHub Desktop.
Save disusered/675128c0506ec0f8a78fb84fe3a5656c to your computer and use it in GitHub Desktop.

Issues found interacting with new Rx endpoints

Can't fetch signature with certain fields missing

Only .patient.email is being validated. We need to validate other fields in the form, since not having these fields gives an error when fetching the signature with the minimal_rx query param. From my testing the following fields are required:

  • .patient.email
  • .medic.cedula_prof

Without these, the generated Rx give a 500 error when trying to fetch via patient landing's endpoint.

Medications do not match

The new endpoint for creating Rx has issues with products/medications. A minor issue is that it uses the hashed UPC to match products, which is unique_id in SDEndpoint but is upc in the digitize Rx endpoint. This is made more confusing because there is a upc field in SDEndpoint as well, but this value will not work with Rx endpoint.

Another issue is that even when sending the hashed UPC, the newly created eRx does not use the data from the products database, it instead uses whatever value was defined in presentation and is lacking metadata. For example:

# Create Rx with UPC for "PROBIOLOG MAX SUP ALIM CAP C/30"
curl -X "POST" "https://prescrypto-experimental-8d475ba09e68.herokuapp.com/api/v2/rx-simplified/px/" \
     -H 'Content-Type: application/json' \
     -H 'Authorization: Token 482a96336be3cb420052d3d3946c8c1004ad6886' \
     -d $'{
  "hospital": {
    "name": "Hospital del doctorWho",
    "address": "Calle WhichStreet 147",
    "contact": "My contact"
  },
  "medic": {
    "name": "Jesus DoctorWho",
    "cedula_prof": "This is my cedula"
  },
  "patient": {
    "name": "chuko",
    "email": "[email protected]"
  },
  "medications": [
    {
      "drug_upc": "65ef47ecabd9d9bb68867a1a511f7bacdd7e15c02a6067011a970b53cff39025"
    }
  ]
}'

When we fetch this Rx for Patient Landing we get:

    "medications": [
      {
        "id": 470,
        "presentation": "",
        "instructions": "",
        "drug": "None",
        "cost": 0.0,
        "bought": false,
        "qty": 1,
        "bought_qty": 0,
        "category": "",
        "qty_label": "",
        "drug_upc": "65ef47ecabd9d9bb68867a1a511f7bacdd7e15c02a6067011a970b53cff39025",
        "via": "",
        "pharmacy_fields": {
          "fraction": "",
          "is_controlled": false
        }
      }
    ]

If we query SDEndpoint for the same UPC we get missing fields such as presentation and category.

[
  {
    "package_detail": null,
    "package_detail_quantity": 0,
    "measure_units": "",
    "measure_units_quantity": "",
    "plm_url": "https://www.medicamentosplm.com//Home/productos/probiolog_max_cápsulas/92/101/63488/14",
    "updatedAt": "2022-10-31T23:05:48.653Z",
    "id": "5eecf5566d34e85ce86b3ded",
    "upc": "3760001041019",
    "package_desc": "PROBIOLOG MAX SUP ALIM CAP C/30",
    "description": "",
    "molecule": [
      "BIFIDOBACTERIUM LACTIS B12/LACTOBACILLUS ACIDOPHI"
    ],
    "brand": "",
    "image_url": "https://drugs-catalog.s3-us-west-2.amazonaws.com/default_drug.png",
    "unique_id": "65ef47ecabd9d9bb68867a1a511f7bacdd7e15c02a6067011a970b53cff39025",
    "update": "2020-06-19T17:26:46.633Z",
    "fraction": "",
    "categories": [
      "DIGESTIVO Y METABOLISMO"
    ],
    "category": "standard_drug",
    "ingredients": [],
    "presentation": "PROBIOLOG MAX SUP ALIM CAP C/30 (BIFIDOBACTERIUM LACTIS B12/LACTOBACILLUS ACIDOPHI)",
    "cofepris": "",
    "lab": "MAYOLY SPINDLER DE MEXICO, S.A          ",
    "retail_price": "530.00",
    "rank": 33,
    "phxs": [
      {
        "internal_upc": "3760001041019",
        "is_active": true,
        "update": 1592587606,
        "phx_id": "4696986a3ff4378f2babe5d826b1b4e1e67470ad453ea0d23e03c32f54291a8f",
        "time_delivery": "",
        "internal_sku": "",
        "ref": 61667,
        "id": "054986",
        "stock": ""
      },
      {
        "is_active": true,
        "time_delivery": "",
        "internal_upc": "3760001041019",
        "internal_sku": "",
        "update": 1627345184,
        "ref": "",
        "id": "",
        "phx_id": "cd67f247cde3fc6eee3c4f2988115f186da889b3d44afd2658a30ed73788724c",
        "stock": ""
      },
      {
        "phx_id": "d87f37bdea51a05039929e1f1261993be347a17c34e3aaa9f795c2dcdee39b02",
        "update": 1655896953,
        "internal_upc": "3760001041019",
        "is_active": true
      }
    ],
    "active": true,
    "source": "farmapronto"
  }
]

This causes patient landing to not render correctly since presentation is an empty string.

Caching

When we try to fetch an Rx and send the incorrect minimal_prx flag, the result is cached. This includes error results like 404. For example:

# Create Rx and get signature
curl -X "POST" "https://prescrypto-experimental-8d475ba09e68.herokuapp.com/api/v2/rx-simplified/px/" \
     -H 'Content-Type: application/json' \
     -H 'Authorization: Token 482a96336be3cb420052d3d3946c8c1004ad6886' \
     -d $'{
  "hospital": {
    "name": "Hospital del doctorWho",
    "address": "Calle WhichStreet 147",
    "contact": "My contact"
  },
  "medic": {
    "name": "Jesus DoctorWho",
    "cedula_prof": "This is my cedula"
  },
  "patient": {
    "name": "chuko",
    "email": "[email protected]"
  },
  "medications": [
    {
      "via": "",
      "drug_upc": "",
      "category": "",
      "presentation": "hola med",
      "instructions": "1 vez cada 15 días"
    }
  ]
}' | jq -r '.signature'

# Fetch rx without minimal_prx flag, it won't be found
curl "https://prescrypto-experimental-8d475ba09e68.herokuapp.com/api/v2/rx/patient-landing/0fbb67a6134a12db546b44a93d6c39e23407512abe69c7f3a4e8653c2c4f076a/" \
     -H 'Content-Type: application/json' \
     -H 'Authorization: Token 482a96336be3cb420052d3d3946c8c1004ad6886'

{"message":"No se encontro la receta con la firma o QR dado"}

# Fetch rx with minimal_prx flag, it should be found but we get the cached error response
curl "https://prescrypto-experimental-8d475ba09e68.herokuapp.com/api/v2/rx/patient-landing/0fbb67a6134a12db546b44a93d6c39e23407512abe69c7f3a4e8653c2c4f076a/?minimal_prx=1" \
     -H 'Content-Type: application/json' \
     -H 'Authorization: Token 482a96336be3cb420052d3d3946c8c1004ad6886'

{"message":"No se encontro la receta con la firma o QR dado"}

# Fetch rx with minimal_prx and no_cache flag works by busting the cache
curl "https://prescrypto-experimental-8d475ba09e68.herokuapp.com/api/v2/rx/patient-landing/0fbb67a6134a12db546b44a93d6c39e23407512abe69c7f3a4e8653c2c4f076a/?minimal_prx=1&no_cache=1" \
     -H 'Content-Type: application/json' \
     -H 'Authorization: Token 482a96336be3cb420052d3d3946c8c1004ad6886'

{"rx":{"signature":"0fbb67a6134a12db546b44a93d6c39e23407512abe69c7f3a4e8653c2c4f076a","raw_size":3360,"created_at":"2024-07-12T18:58:22.187787Z","medic":{"name":"Jesus DoctorWho","alma_mater":"","cedula_prof":"This is my cedula","specialty_no":"","specialty":""},"hospital":{"contact":"My contact"},"extras":"","medications":[{"id":464,"presentation":"hola med","instructions":"1 vez cada 15 días","drug":"hola med","cost":0.0,"bought":false,"qty":1,"bought_qty":0,"category":"","qty_label":"","drug_upc":"","via":"","pharmacy_fields":{"fraction":"4","is_controlled":false}}],"status":["available","Disponible"],"available_status":[true,"Aún puedes surtir esta receta"],"transaction_url":"","qr_link":"https://prescrypto-experimental-8d475ba09e68.herokuapp.com/r/2T","patient":{"uid":"20562432-b1f8-46cc-ad2f-809d88cf42ba","name":"chuko"}},"campaigns":[{"id":6,"short_name":"prixz","branches":[],"rank":1,"callback_redirect":"landing_view","main_site_redirect":"landing_view","display_name":"Prixz","display_phone":"55 8097 0039","display_contact":"55 8097 0039 (Whatsapp) Entrega a domicilio en toda la república. Guadalajara, mty, cdmx mismo día, resto de la rep. Entre 24 y 48hrs","cta_link":"https://prescrypto-experimental-8d475ba09e68.herokuapp.com/e/prixz/7U","picture":null,"show_discount":false,"discount_msg":false},{"id":13,"short_name":"riviera","branches":[],"rank":-2,"callback_redirect":"landing_view","main_site_redirect":"landing_view","display_name":"Farmacia de la Riviera","display_phone":"984 165 2319 (Playa del Carmen, Q.Roo)","display_contact":"Atención por Whatsapp: 984 165 2319  Venta por internet via whatsapp. Entrega a domicilio en Playa del Carmen. Entrega física en farmacia o mismo día en Calle 41 Sur, Ejidal, 77714 Playa del Carmen, Q.R.","cta_link":"https://prescrypto-experimental-8d475ba09e68.herokuapp.com/e/riviera/7U","picture":null,"show_discount":false,"discount_msg":false},{"id":12,"short_name":"uspharmex","branches":[],"rank":1,"callback_redirect":"landing_view","main_site_redirect":"landing_view","display_name":"UsPharmex","display_phone":"664 296 4636 (Whatsapp)(Tijuana, BC)","display_contact":"Atención por Whatsapp: 664 296 4636 Venta via whatsapp, entrega y pago en sucursal en:  Plaza Agua Caliente, Blvd. Agua Caliente #4558 Piso C1 Local 8, Aviacion, 22014 Tijuana, B.C.","cta_link":"https://prescrypto-experimental-8d475ba09e68.herokuapp.com/e/uspharmex/7U","picture":null,"show_discount":false,"discount_msg":false},{"id":53,"short_name":"fastfarma","branches":[],"rank":93,"callback_redirect":"landing_view","main_site_redirect":"landing_view","display_name":"fastfarma","display_phone":"55 4098 5846","display_contact":"FastFarma es la farmacia 100% en línea, a domicilio, más rápida y siempre a tiempo. #BeFast #BeFastFarma 🚀 💊. Encuentros por ahora en cdmx y área conurbada. tel:55 4098 5846 ","cta_link":"https://prescrypto-experimental-8d475ba09e68.herokuapp.com/e/fastfarma/7U","picture":null,"show_discount":false,"discount_msg":false},{"id":52,"short_name":"walmex","branches":[{"Determinante":3825,"name":"Walmart Express San Mateo","Formato":"Walmart Express","Estado":"Estado de México","address":"Camino a San Mateo Nopala #20, Col. Sta Cruz Acatlan, CP 53240 Naucalpan, Estado de México"},{"Determinante":3881,"name":"Walmart Express Santa Fe","Formato":"Walmart Express","Estado":"CD de México","address":"Cuajimalpa Av.tamaulipas #3000, Autopista México-Toluca, Col. La Rosita CP 5340, Ciudad de México"},{"Determinante":3896,"name":"Walmart Express Fuentes Del Pedregal","Formato":"Walmart Express","Estado":"CD de México","address":"Calle Unión #3, Col. Fuentes del Pedregal, Del. Tlalpan México, CP 14220, Ciudad de México"},{"Determinante":3821,"name":"Superama Lindavista","Formato":"Superama","Estado":"CD de México","address":"Av. Montevideo #360, Col. Lindavista, CP 07300 Gustavo A.Madero, Ciudad de México"},{"Determinante":3813,"name":"Superama Churubusco","Formato":"Superama","Estado":"CD de México","address":"Cerro de las torres #229, Col. Campestre Churubusco, CP 04200, Ciudad de México"},{"Determinante":3814,"name":"Superama Barrilaco","Formato":"Superama","Estado":"CD de México","address":"Calle Sierra Ventana #750, Col. Lomas de Chapultepec, CP 11000 Miguel Hidalgo, Ciudad de México"},{"Determinante":5817,"name":"Axomiatla","Formato":"Walmart Express","Estado":"CD de México","address":"Calzada de las aguilas #1819, Col. San Antonio Tarango, CP 1780, Ciudad de México"},{"Determinante":3835,"name":"Superama Lomas Anahuac","Formato":"Superama","Estado":"Estado de México","address":"Av. De Los Bosques #234, Col. Lomas De Tecamachalco, CP 37260 Huixquilucan, Estado de México"},{"Determinante":3844,"name":"Walmart Express Bosque De Minas","Formato":"Walmart Express","Estado":"Estado de México","address":"Av. Bosques de Minas #33, CP 52760 Huixquilucan, Estado de México"},{"Determinante":1053,"name":"Walmart Express Acoxpa","Formato":"Walmart Express","Estado":"CD de México","address":"Calzada acoxpa #438, Col. Ex Hacienda Coapa, CP 14300, Ciudad de México"},{"Determinante":3828,"name":"Superama Los Morales","Formato":"Superama","Estado":"CD de México","address":"Av. Horacio #1740, Col. Chapultepec Morales, CP. 11560 Del. Miguel Hidalgo, Ciudad de México"},{"Determinante":3480,"name":"Superama WTC Dakota","Formato":"Superama","Estado":"CD de México","address":"Av. Dakota  #95, Col. Napoles, CP 03810 Benito Juarez, Ciudad de México"}],"rank":87,"callback_redirect":"landing_view","main_site_redirect":"landing_view","display_name":"Walmart Express","display_phone":"","display_contact":"Disponible en farmacias seleccionadas de la Ciudad de México y Zona Metropolitana.","cta_link":"https://prescrypto-experimental-8d475ba09e68.herokuapp.com/e/walmex/7U","picture":null,"show_discount":false,"discount_msg":false},{"id":16,"short_name":"farmago","branches":[],"rank":92,"callback_redirect":"landing_view","main_site_redirect":"landing_view","display_name":"FarmaGo","display_phone":"81 1484 7250 (Whatsapp) (Monterrey, NL) (Entrega a domicilio)","display_contact":"Atención por Whatsapp: 81 1484 7250  Venta via whatsapp,  Entrega a domicilio en Monterrey. Entrega física en farmacia en:  Lic. Jose Benitez 2224-Int D, Obispado, 64060 Monterrey, N.L.","cta_link":"https://prescrypto-experimental-8d475ba09e68.herokuapp.com/e/farmago/7U","picture":null,"show_discount":false,"discount_msg":false}],"history":[]}

Another example is when we fetch with the minimal flag it works, but in subsequent requests we can skip the minimal flag and still get the minimal response.

# Create Rx and get signature
curl -X "POST" "https://prescrypto-experimental-8d475ba09e68.herokuapp.com/api/v2/rx-simplified/px/" \
     -H 'Content-Type: application/json' \
     -H 'Authorization: Token 482a96336be3cb420052d3d3946c8c1004ad6886' \
     -d $'{
  "hospital": {
    "name": "Hospital del doctorWho",
    "address": "Calle WhichStreet 147",
    "contact": "My contact"
  },
  "medic": {
    "name": "Jesus DoctorWho",
    "cedula_prof": "This is my cedula"
  },
  "patient": {
    "name": "chuko",
    "email": "[email protected]"
  },
  "medications": [
    {
      "via": "",
      "drug_upc": "",
      "category": "",
      "presentation": "hola med",
      "instructions": "1 vez cada 15 días"
    }
  ]
}' | jq -r '.signature'

# Fetch rx with minimal_prx flag, it works as expected
curl "https://prescrypto-experimental-8d475ba09e68.herokuapp.com/api/v2/rx/patient-landing/465848c7d62d7dce0b9ebfd91ad05c4d31827b4993315a008be4db5e4707131d/?minimal_prx=1" \
     -H 'Content-Type: application/json' \
     -H 'Authorization: Token 482a96336be3cb420052d3d3946c8c1004ad6886'

{"rx":{"signature":"465848c7d62d7dce0b9ebfd91ad05c4d31827b4993315a008be4db5e4707131d","raw_size":3360,"created_at":"2024-07-12T18:54:44.019404Z","medic":{"name":"Jesus DoctorWho","alma_mater":"","cedula_prof":"This is my cedula","specialty_no":"","specialty":""},"hospital":{"contact":"My contact"},"extras":"","medications":[{"id":463,"presentation":"hola med","instructions":"1 vez cada 15 días","drug":"hola med","cost":0.0,"bought":false,"qty":1,"bought_qty":0,"category":"","qty_label":"","drug_upc":"","via":"","pharmacy_fields":{"fraction":"4","is_controlled":false}}],"status":["available","Disponible"],"available_status":[true,"Aún puedes surtir esta receta"],"transaction_url":"","qr_link":"https://prescrypto-experimental-8d475ba09e68.herokuapp.com/r/2S","patient":{"uid":"0fa67657-8281-4339-bc54-f3a3325fa672","name":"chuko"}},"campaigns":[{"id":6,"short_name":"prixz","branches":[],"rank":1,"callback_redirect":"landing_view","main_site_redirect":"landing_view","display_name":"Prixz","display_phone":"55 8097 0039","display_contact":"55 8097 0039 (Whatsapp) Entrega a domicilio en toda la república. Guadalajara, mty, cdmx mismo día, resto de la rep. Entre 24 y 48hrs","cta_link":"https://prescrypto-experimental-8d475ba09e68.herokuapp.com/e/prixz/7T","picture":null,"show_discount":false,"discount_msg":false},{"id":13,"short_name":"riviera","branches":[],"rank":-2,"callback_redirect":"landing_view","main_site_redirect":"landing_view","display_name":"Farmacia de la Riviera","display_phone":"984 165 2319 (Playa del Carmen, Q.Roo)","display_contact":"Atención por Whatsapp: 984 165 2319  Venta por internet via whatsapp. Entrega a domicilio en Playa del Carmen. Entrega física en farmacia o mismo día en Calle 41 Sur, Ejidal, 77714 Playa del Carmen, Q.R.","cta_link":"https://prescrypto-experimental-8d475ba09e68.herokuapp.com/e/riviera/7T","picture":null,"show_discount":false,"discount_msg":false},{"id":12,"short_name":"uspharmex","branches":[],"rank":1,"callback_redirect":"landing_view","main_site_redirect":"landing_view","display_name":"UsPharmex","display_phone":"664 296 4636 (Whatsapp)(Tijuana, BC)","display_contact":"Atención por Whatsapp: 664 296 4636 Venta via whatsapp, entrega y pago en sucursal en:  Plaza Agua Caliente, Blvd. Agua Caliente #4558 Piso C1 Local 8, Aviacion, 22014 Tijuana, B.C.","cta_link":"https://prescrypto-experimental-8d475ba09e68.herokuapp.com/e/uspharmex/7T","picture":null,"show_discount":false,"discount_msg":false},{"id":53,"short_name":"fastfarma","branches":[],"rank":92,"callback_redirect":"landing_view","main_site_redirect":"landing_view","display_name":"fastfarma","display_phone":"55 4098 5846","display_contact":"FastFarma es la farmacia 100% en línea, a domicilio, más rápida y siempre a tiempo. #BeFast #BeFastFarma 🚀 💊. Encuentros por ahora en cdmx y área conurbada. tel:55 4098 5846 ","cta_link":"https://prescrypto-experimental-8d475ba09e68.herokuapp.com/e/fastfarma/7T","picture":null,"show_discount":false,"discount_msg":false},{"id":16,"short_name":"farmago","branches":[],"rank":58,"callback_redirect":"landing_view","main_site_redirect":"landing_view","display_name":"FarmaGo","display_phone":"81 1484 7250 (Whatsapp) (Monterrey, NL) (Entrega a domicilio)","display_contact":"Atención por Whatsapp: 81 1484 7250  Venta via whatsapp,  Entrega a domicilio en Monterrey. Entrega física en farmacia en:  Lic. Jose Benitez 2224-Int D, Obispado, 64060 Monterrey, N.L.","cta_link":"https://prescrypto-experimental-8d475ba09e68.herokuapp.com/e/farmago/7T","picture":null,"show_discount":false,"discount_msg":false},{"id":52,"short_name":"walmex","branches":[{"Determinante":3825,"name":"Walmart Express San Mateo","Formato":"Walmart Express","Estado":"Estado de México","address":"Camino a San Mateo Nopala #20, Col. Sta Cruz Acatlan, CP 53240 Naucalpan, Estado de México"},{"Determinante":3881,"name":"Walmart Express Santa Fe","Formato":"Walmart Express","Estado":"CD de México","address":"Cuajimalpa Av.tamaulipas #3000, Autopista México-Toluca, Col. La Rosita CP 5340, Ciudad de México"},{"Determinante":3896,"name":"Walmart Express Fuentes Del Pedregal","Formato":"Walmart Express","Estado":"CD de México","address":"Calle Unión #3, Col. Fuentes del Pedregal, Del. Tlalpan México, CP 14220, Ciudad de México"},{"Determinante":3821,"name":"Superama Lindavista","Formato":"Superama","Estado":"CD de México","address":"Av. Montevideo #360, Col. Lindavista, CP 07300 Gustavo A.Madero, Ciudad de México"},{"Determinante":3813,"name":"Superama Churubusco","Formato":"Superama","Estado":"CD de México","address":"Cerro de las torres #229, Col. Campestre Churubusco, CP 04200, Ciudad de México"},{"Determinante":3814,"name":"Superama Barrilaco","Formato":"Superama","Estado":"CD de México","address":"Calle Sierra Ventana #750, Col. Lomas de Chapultepec, CP 11000 Miguel Hidalgo, Ciudad de México"},{"Determinante":5817,"name":"Axomiatla","Formato":"Walmart Express","Estado":"CD de México","address":"Calzada de las aguilas #1819, Col. San Antonio Tarango, CP 1780, Ciudad de México"},{"Determinante":3835,"name":"Superama Lomas Anahuac","Formato":"Superama","Estado":"Estado de México","address":"Av. De Los Bosques #234, Col. Lomas De Tecamachalco, CP 37260 Huixquilucan, Estado de México"},{"Determinante":3844,"name":"Walmart Express Bosque De Minas","Formato":"Walmart Express","Estado":"Estado de México","address":"Av. Bosques de Minas #33, CP 52760 Huixquilucan, Estado de México"},{"Determinante":1053,"name":"Walmart Express Acoxpa","Formato":"Walmart Express","Estado":"CD de México","address":"Calzada acoxpa #438, Col. Ex Hacienda Coapa, CP 14300, Ciudad de México"},{"Determinante":3828,"name":"Superama Los Morales","Formato":"Superama","Estado":"CD de México","address":"Av. Horacio #1740, Col. Chapultepec Morales, CP. 11560 Del. Miguel Hidalgo, Ciudad de México"},{"Determinante":3480,"name":"Superama WTC Dakota","Formato":"Superama","Estado":"CD de México","address":"Av. Dakota  #95, Col. Napoles, CP 03810 Benito Juarez, Ciudad de México"}],"rank":77,"callback_redirect":"landing_view","main_site_redirect":"landing_view","display_name":"Walmart Express","display_phone":"","display_contact":"Disponible en farmacias seleccionadas de la Ciudad de México y Zona Metropolitana.","cta_link":"https://prescrypto-experimental-8d475ba09e68.herokuapp.com/e/walmex/7T","picture":null,"show_discount":false,"discount_msg":false}],"history":[]}

# Fetch rx without minimal_prx flag, it should not find it but it does because the response is cached
curl "https://prescrypto-experimental-8d475ba09e68.herokuapp.com/api/v2/rx/patient-landing/465848c7d62d7dce0b9ebfd91ad05c4d31827b4993315a008be4db5e4707131d/" \
     -H 'Content-Type: application/json' \
     -H 'Authorization: Token 482a96336be3cb420052d3d3946c8c1004ad6886'

{"rx":{"signature":"465848c7d62d7dce0b9ebfd91ad05c4d31827b4993315a008be4db5e4707131d","raw_size":3360,"created_at":"2024-07-12T18:54:44.019404Z","medic":{"name":"Jesus DoctorWho","alma_mater":"","cedula_prof":"This is my cedula","specialty_no":"","specialty":""},"hospital":{"contact":"My contact"},"extras":"","medications":[{"id":463,"presentation":"hola med","instructions":"1 vez cada 15 días","drug":"hola med","cost":0.0,"bought":false,"qty":1,"bought_qty":0,"category":"","qty_label":"","drug_upc":"","via":"","pharmacy_fields":{"fraction":"4","is_controlled":false}}],"status":["available","Disponible"],"available_status":[true,"Aún puedes surtir esta receta"],"transaction_url":"","qr_link":"https://prescrypto-experimental-8d475ba09e68.herokuapp.com/r/2S","patient":{"uid":"0fa67657-8281-4339-bc54-f3a3325fa672","name":"chuko"}},"campaigns":[{"id":6,"short_name":"prixz","branches":[],"rank":1,"callback_redirect":"landing_view","main_site_redirect":"landing_view","display_name":"Prixz","display_phone":"55 8097 0039","display_contact":"55 8097 0039 (Whatsapp) Entrega a domicilio en toda la república. Guadalajara, mty, cdmx mismo día, resto de la rep. Entre 24 y 48hrs","cta_link":"https://prescrypto-experimental-8d475ba09e68.herokuapp.com/e/prixz/7T","picture":null,"show_discount":false,"discount_msg":false},{"id":13,"short_name":"riviera","branches":[],"rank":-2,"callback_redirect":"landing_view","main_site_redirect":"landing_view","display_name":"Farmacia de la Riviera","display_phone":"984 165 2319 (Playa del Carmen, Q.Roo)","display_contact":"Atención por Whatsapp: 984 165 2319  Venta por internet via whatsapp. Entrega a domicilio en Playa del Carmen. Entrega física en farmacia o mismo día en Calle 41 Sur, Ejidal, 77714 Playa del Carmen, Q.R.","cta_link":"https://prescrypto-experimental-8d475ba09e68.herokuapp.com/e/riviera/7T","picture":null,"show_discount":false,"discount_msg":false},{"id":12,"short_name":"uspharmex","branches":[],"rank":1,"callback_redirect":"landing_view","main_site_redirect":"landing_view","display_name":"UsPharmex","display_phone":"664 296 4636 (Whatsapp)(Tijuana, BC)","display_contact":"Atención por Whatsapp: 664 296 4636 Venta via whatsapp, entrega y pago en sucursal en:  Plaza Agua Caliente, Blvd. Agua Caliente #4558 Piso C1 Local 8, Aviacion, 22014 Tijuana, B.C.","cta_link":"https://prescrypto-experimental-8d475ba09e68.herokuapp.com/e/uspharmex/7T","picture":null,"show_discount":false,"discount_msg":false},{"id":16,"short_name":"farmago","branches":[],"rank":81,"callback_redirect":"landing_view","main_site_redirect":"landing_view","display_name":"FarmaGo","display_phone":"81 1484 7250 (Whatsapp) (Monterrey, NL) (Entrega a domicilio)","display_contact":"Atención por Whatsapp: 81 1484 7250  Venta via whatsapp,  Entrega a domicilio en Monterrey. Entrega física en farmacia en:  Lic. Jose Benitez 2224-Int D, Obispado, 64060 Monterrey, N.L.","cta_link":"https://prescrypto-experimental-8d475ba09e68.herokuapp.com/e/farmago/7T","picture":null,"show_discount":false,"discount_msg":false},{"id":52,"short_name":"walmex","branches":[{"Determinante":3825,"name":"Walmart Express San Mateo","Formato":"Walmart Express","Estado":"Estado de México","address":"Camino a San Mateo Nopala #20, Col. Sta Cruz Acatlan, CP 53240 Naucalpan, Estado de México"},{"Determinante":3881,"name":"Walmart Express Santa Fe","Formato":"Walmart Express","Estado":"CD de México","address":"Cuajimalpa Av.tamaulipas #3000, Autopista México-Toluca, Col. La Rosita CP 5340, Ciudad de México"},{"Determinante":3896,"name":"Walmart Express Fuentes Del Pedregal","Formato":"Walmart Express","Estado":"CD de México","address":"Calle Unión #3, Col. Fuentes del Pedregal, Del. Tlalpan México, CP 14220, Ciudad de México"},{"Determinante":3821,"name":"Superama Lindavista","Formato":"Superama","Estado":"CD de México","address":"Av. Montevideo #360, Col. Lindavista, CP 07300 Gustavo A.Madero, Ciudad de México"},{"Determinante":3813,"name":"Superama Churubusco","Formato":"Superama","Estado":"CD de México","address":"Cerro de las torres #229, Col. Campestre Churubusco, CP 04200, Ciudad de México"},{"Determinante":3814,"name":"Superama Barrilaco","Formato":"Superama","Estado":"CD de México","address":"Calle Sierra Ventana #750, Col. Lomas de Chapultepec, CP 11000 Miguel Hidalgo, Ciudad de México"},{"Determinante":5817,"name":"Axomiatla","Formato":"Walmart Express","Estado":"CD de México","address":"Calzada de las aguilas #1819, Col. San Antonio Tarango, CP 1780, Ciudad de México"},{"Determinante":3835,"name":"Superama Lomas Anahuac","Formato":"Superama","Estado":"Estado de México","address":"Av. De Los Bosques #234, Col. Lomas De Tecamachalco, CP 37260 Huixquilucan, Estado de México"},{"Determinante":3844,"name":"Walmart Express Bosque De Minas","Formato":"Walmart Express","Estado":"Estado de México","address":"Av. Bosques de Minas #33, CP 52760 Huixquilucan, Estado de México"},{"Determinante":1053,"name":"Walmart Express Acoxpa","Formato":"Walmart Express","Estado":"CD de México","address":"Calzada acoxpa #438, Col. Ex Hacienda Coapa, CP 14300, Ciudad de México"},{"Determinante":3828,"name":"Superama Los Morales","Formato":"Superama","Estado":"CD de México","address":"Av. Horacio #1740, Col. Chapultepec Morales, CP. 11560 Del. Miguel Hidalgo, Ciudad de México"},{"Determinante":3480,"name":"Superama WTC Dakota","Formato":"Superama","Estado":"CD de México","address":"Av. Dakota  #95, Col. Napoles, CP 03810 Benito Juarez, Ciudad de México"}],"rank":77,"callback_redirect":"landing_view","main_site_redirect":"landing_view","display_name":"Walmart Express","display_phone":"","display_contact":"Disponible en farmacias seleccionadas de la Ciudad de México y Zona Metropolitana.","cta_link":"https://prescrypto-experimental-8d475ba09e68.herokuapp.com/e/walmex/7T","picture":null,"show_discount":false,"discount_msg":false},{"id":53,"short_name":"fastfarma","branches":[],"rank":50,"callback_redirect":"landing_view","main_site_redirect":"landing_view","display_name":"fastfarma","display_phone":"55 4098 5846","display_contact":"FastFarma es la farmacia 100% en línea, a domicilio, más rápida y siempre a tiempo. #BeFast #BeFastFarma 🚀 💊. Encuentros por ahora en cdmx y área conurbada. tel:55 4098 5846 ","cta_link":"https://prescrypto-experimental-8d475ba09e68.herokuapp.com/e/fastfarma/7T","picture":null,"show_discount":false,"discount_msg":false}],"history":[]}
@xtornasol512
Copy link

About 500 error with some fields

.patient.email
.medic.cedula_prof

TODO's and notes

  • Could be a FE validation to be mandatory
  • Add the validation on V1 rx-simplified endpoint

About medications match

  • First Products and V1 doesn't match excatly because was designed in that way. Products would maintain most of the Product info, meanwhile V1 just the necessary to fullfill regulatory complaints and v1 bussiness logic.
  • Nevertheless, the confusion between "ids", is real. we can create a table explanatory
  • The fields category and presentation has important notes as follows:
    • Category has 3 strings choices: "auxiliary_test"(estudio), "standard_drug"(if was selected without filters of pharmacy), "basic_drug"(if was selected by phx filter), "unstructured_drug" (when it is manual writting)
    • An analogy to Patient Landing Simplified Page would be the following:
      • standard_drug: if was selected by a select box (where we can add the hashed ID as drug_upc on payload)
      • auxiliary_test: if was selected also by box on categoy "estudios"
      • drug_upc: Only if was selected by a selector but including filters by phx
      • unstructured_drug: when the category was written by user manually

About cache system

Try using "no_cache" query param to avoid get results on cache

About get the same on simplified-rx endpoint with or without query parms

This is easy to answer, that endpoint is not mean to be for normal prescrptions just to create simplified prescriptions

The endpoint that we reutilize and need for query param, is patient landing

@disusered
Copy link
Author

disusered commented Jul 15, 2024

@xtornasol512 With regards to the 500 error and medications matching, I understand now, thank you for clarifying.

As for the cache and query param response, the examples are all GET requests to the patient-landing endpoint, I did not find any issues with the newer POST endpoint for creating rx. The POST requests are there to simulate the flows:

  1. POST an Rx using the new endpoint, 20x response
  2. GET the newly created Rx but forgetting to use the minimal_prx query param, 404 response
  3. GET the newly created Rx using the minimal_prx query_param, 404 response

It cached the 404. I was able to overcome this by using the no_cache param. The second example is:

  1. POST an Rx using the new endpoint, 200 response
  2. GET the newly created Rx with the minimal_prx flag, 200 response
  3. GET the newly created Rx without the minimal_prx flag, 200 response

This isn't a blocker and can be circumvented by skipping the cache param, but the behavior was unexpected.

@xtornasol512
Copy link

Cool! We can talk about these findings on the standup!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment